Skip to content

Commit

Permalink
feat: initialize graphics programming lib
Browse files Browse the repository at this point in the history
  • Loading branch information
vighnesh153 committed Sep 21, 2023
1 parent 99edc49 commit d370b8c
Show file tree
Hide file tree
Showing 11 changed files with 423 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nodejs-tools/nodejs-docker-tools/youtube-dl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"license": "MIT",
"scripts": {
"docker": "docker-compose up && docker-compose down --rmi"
"docker": "docker-compose up; docker-compose down --rmi all"
},
"dependencies": {
},
Expand Down
4 changes: 4 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.js
*.cjs
*.d.ts
dist
7 changes: 7 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['vighnesh153/ts-base.eslintrc.cjs'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Graphics programming

Visit the [demo](https://vighnesh153.dev/projects/graphics) and check out the different graphics projects.
34 changes: 34 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "@vighnesh153/graphics-programming",
"private": true,
"type": "module",
"exports": {
"types": "./dist/src/index.d.ts",
"import": "./dist/main.js"
},
"main": "./dist/main.js",
"types": "./dist/src/index.d.ts",
"license": "MIT",
"scripts": {
"build:once:types": "tsc",
"build:once:bundle": "tsup",
"build:watch:bundle": "tsup --watch",
"build": "run-s build:once:bundle build:once:types",
"dev": "npm-run-all --parallel build:watch:*",
"test:watch": "vitest --passWithNoTests",
"test": "vitest run --passWithNoTests"
},
"files": [
"dist"
],
"devDependencies": {
"@types/node": "*",
"@vighnesh153/tsconfig": "*",
"@vighnesh153/utils": "*",
"eslint-config-vighnesh153": "*",
"npm-run-all": "^4.1.5",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vitest": "0.34.2"
}
}
91 changes: 91 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/src/collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
interface GraphicsProject {
imageLink: string;
title: string;
}

const barnsleysFern: GraphicsProject = {
imageLink: 'https://i.imgur.com/8F9Y1DQ.png',
title: `Barnsley's Fern`,
};

const brickBreakerGame: GraphicsProject = {
imageLink: 'https://i.imgur.com/C0N3twn.png',
title: 'Brick Breaker Game',
};

const connectingParticles: GraphicsProject = {
imageLink: 'https://i.imgur.com/ZKYXBhX.png',
title: 'Connecting Particles',
};

const flappyBlockGame: GraphicsProject = {
imageLink: 'https://i.imgur.com/hKgLkKy.png',
title: 'Flappy Block Game',
};

const gridPathFinderGame: GraphicsProject = {
imageLink: 'https://i.imgur.com/j0JsNwY.png',
title: 'Grid Path Finder',
};

const pongGame: GraphicsProject = {
imageLink: 'https://i.imgur.com/9c0kEFU.png',
title: 'Pong Game',
};

const pseudoHilbertCurve: GraphicsProject = {
imageLink: 'https://i.imgur.com/Lcyw7DQ.png',
title: 'Pseudo Hilbert Curve',
};

const serpinskisTriangle: GraphicsProject = {
imageLink: 'https://i.imgur.com/J2zUHcl.png',
title: `Sierpinski's Triangle`,
};

const snakeGame: GraphicsProject = {
imageLink: 'https://i.imgur.com/spwnsPX.png',
title: 'Snake Game',
};

const sortingVisualizer: GraphicsProject = {
imageLink: 'https://i.imgur.com/YHKu6TN.png',
title: 'Sorting Visualizer',
};

const symmetricBinaryTree: GraphicsProject = {
imageLink: 'https://i.imgur.com/tzA2Pyf.png',
title: 'Symmetric Binary Tree',
};

const towerOfHanoi: GraphicsProject = {
imageLink: 'https://i.imgur.com/kIsetz4.png',
title: 'Tower of Hanoi',
};

const treePathFinder: GraphicsProject = {
imageLink: 'https://i.imgur.com/879Zf9b.png',
title: 'Tree Path Finder',
};

const twinklingStars: GraphicsProject = {
imageLink: 'https://i.imgur.com/Zhk91iE.png',
title: 'Twinkling Stars',
};

export const graphicsProjects: GraphicsProject[] = [
gridPathFinderGame,
serpinskisTriangle,
towerOfHanoi,
symmetricBinaryTree,
connectingParticles,
pseudoHilbertCurve,
sortingVisualizer,
twinklingStars,
treePathFinder,
pongGame,
barnsleysFern,
snakeGame,
flappyBlockGame,
brickBreakerGame,
];
1 change: 1 addition & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './collection';
13 changes: 13 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "@vighnesh153/tsconfig/typescript-library.json",
"compilerOptions": {
"baseUrl": ".",
"types": ["vitest/globals"],
"outDir": "dist",
"paths": {
"@/*": ["src/*"]
}
},
"include": [".", "src", "tests"],
"exclude": ["dist", "build", "node_modules"]
}
17 changes: 17 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from 'tsup';

export default defineConfig(() => ({
entry: {
main: './src/index.ts',
},
splitting: false,
clean: true,
minify: true,
treeshake: true,
format: ['esm'],
outExtension({ format }) {
let js: string | undefined;
if (format === 'esm') js = `.js`;
return { js };
},
}));
13 changes: 13 additions & 0 deletions nodejs-tools/nodejs-lib/graphics-programming/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from 'node:path';
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});
Loading

0 comments on commit d370b8c

Please sign in to comment.