diff --git a/2023/Taskfile.yaml b/2023/Taskfile.yaml new file mode 100644 index 0000000..b4ed16a --- /dev/null +++ b/2023/Taskfile.yaml @@ -0,0 +1,35 @@ +# https://taskfile.dev + +version: "3" + +vars: + YEAR: 2023 + DAY: + sh: date '+%d' | perl -pe's/^0//' + DAY_FORMATTED: + sh: date '+%d' + +tasks: + aoc-cli:install: cargo install aoc-cli + + "precommit:init": pre-commit install -t pre-merge-commit -t pre-push + + integrate: + cmds: + - git is-clean + - git co main + - git weld - + + lint:fix: + cmds: + - npx prettier --write {{.CLI_ARGS | default "." }} + + page: + cmds: + - firefox https://adventofcode.com/{{.YEAR}}/day/{{.DAY}} + + download: + cmds: + - hygen day new --day {{.DAY_FORMATTED}} + - aoc download -d {{.DAY}} -o -p {{.DAY_FORMATTED}}/puzzle.md -i {{.DAY_FORMATTED}}/input + diff --git a/2023/package.json b/2023/package.json new file mode 100644 index 0000000..6b82c36 --- /dev/null +++ b/2023/package.json @@ -0,0 +1,15 @@ +{ + "name": "2023", + "version": "1.0.0", + "description": "", + "main": "vitest.config.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Yanick Champoux (http://techblog.babyl.ca/)", + "license": "ISC", + "dependencies": { + "vitest": "^0.34.6" + } +} diff --git a/2023/vitest.config.js b/2023/vitest.config.js new file mode 100644 index 0000000..aca2fa2 --- /dev/null +++ b/2023/vitest.config.js @@ -0,0 +1,9 @@ +/// +import { defineConfig } from "vite"; + +export default defineConfig({ + test: { + include: ["**/*test.js"], + // ... + }, +}); diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcd8354 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ + +Get aoc-cli from https://github.com/scarvalhojr/aoc-cli diff --git a/_templates/year/new/Taskfile.ejs.template b/_templates/year/new/Taskfile.ejs.template new file mode 100644 index 0000000..67ef9e6 --- /dev/null +++ b/_templates/year/new/Taskfile.ejs.template @@ -0,0 +1,38 @@ +--- +to: <%= year %>/Taskfile.yaml +--- +# https://taskfile.dev + +version: "3" + +vars: + YEAR: <%= year %> + DAY: + sh: date '+%d' | perl -pe's/^0//' + DAY_FORMATTED: + sh: date '+%d' + +tasks: + aoc-cli:install: cargo install aoc-cli + + "precommit:init": pre-commit install -t pre-merge-commit -t pre-push + + integrate: + cmds: + - git is-clean + - git co main + - git weld - + + lint:fix: + cmds: + - npx prettier --write {{.CLI_ARGS | default "." }} + + page: + cmds: + - firefox https://adventofcode.com/{{.YEAR}}/day/{{.DAY}} + + download: + cmds: + - hygen day new --day {{.DAY_FORMATTED}} + - aoc download -d {{.DAY}} -o -p {{.DAY_FORMATTED}}/puzzle.md -i {{.DAY_FORMATTED}}/input + diff --git a/_templates/year/new/package.json.template b/_templates/year/new/package.json.template new file mode 100644 index 0000000..b039fc0 --- /dev/null +++ b/_templates/year/new/package.json.template @@ -0,0 +1,18 @@ +--- +to: <%= year %>/package.json +--- +{ + "name": "<%= year %>", + "version": "1.0.0", + "description": "", + "main": "vitest.config.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Yanick Champoux (http://techblog.babyl.ca/)", + "license": "ISC", + "dependencies": { + "vitest": "^0.34.6" + } +} diff --git a/_templates/year/new/prompt.js b/_templates/year/new/prompt.js new file mode 100644 index 0000000..08984f7 --- /dev/null +++ b/_templates/year/new/prompt.js @@ -0,0 +1,3 @@ +module.exports = [ + { type: 'input', name: 'year', message: 'advent year?' } +]; diff --git a/_templates/year/new/vitest.config.js b/_templates/year/new/vitest.config.js new file mode 100644 index 0000000..40be2a0 --- /dev/null +++ b/_templates/year/new/vitest.config.js @@ -0,0 +1,12 @@ +--- +to: <%= year %>/vitest.config.js +--- +/// +import { defineConfig } from "vite"; + +export default defineConfig({ + test: { + include: ["**/*test.js"], + // ... + }, +}); diff --git a/package.json b/package.json index b49046c..f1934f9 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "license": "ISC", "dependencies": { "@a-robu/victor": "^2.2.2", - "@yanick/vyktor": "link:../vyktor", "combinatorial-generators": "^1.1.2", "debug": "^4.3.4", "fs-extra": "^11.1.0", diff --git a/preset/year/.gitignore b/preset/year/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/preset/year/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/preset/year/README.md b/preset/year/README.md new file mode 100644 index 0000000..8121126 --- /dev/null +++ b/preset/year/README.md @@ -0,0 +1,19 @@ +

+
+ + Logo of Preset + +
+

+ +

year

+
npx @preset/cli apply username//home/yanick/work/javascript/adventofcode/preset/year
+ +
+ +
+ This preset was made by Yanick Champoux. +
+
+ Learn more +
diff --git a/preset/year/package.json b/preset/year/package.json new file mode 100644 index 0000000..1133618 --- /dev/null +++ b/preset/year/package.json @@ -0,0 +1,9 @@ +{ + "private": true, + "author": "Yanick Champoux ", + "license": "MIT", + "preset": "preset.ts", + "devDependencies": { + "@preset/core": "^0.11.2" + } +} diff --git a/preset/year/preset.ts b/preset/year/preset.ts new file mode 100644 index 0000000..a70c2ea --- /dev/null +++ b/preset/year/preset.ts @@ -0,0 +1,30 @@ +import path from 'path'; +//import { definePreset } from '@preset/core'; + +export default definePreset({ + name: 'year', + options: { + // ... + }, + handler: async(context) => { + await extractTemplates(); + + await editFiles({ + files: [ + 'package.json', + 'Taskfile.yaml', + ], + operations: [ {type: 'replace-variables', + variables: { + year: context.prompts.year + }}] + }); + + await installPackages({ + for: 'node', + packages: [ 'vitest' ], + packageManager: 'pnpm', + }); + + }, +}) diff --git a/preset/year/templates/.gitkeep b/preset/year/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/preset/year/templates/Taskfile.yaml b/preset/year/templates/Taskfile.yaml new file mode 100644 index 0000000..dc52e58 --- /dev/null +++ b/preset/year/templates/Taskfile.yaml @@ -0,0 +1,35 @@ +# https://taskfile.dev + +version: "3" + +vars: + YEAR: @@year + DAY: + sh: date '+%d' | perl -pe's/^0//' + DAY_FORMATTED: + sh: date '+%d' + +tasks: + aoc-cli:install: cargo install aoc-cli + + "precommit:init": pre-commit install -t pre-merge-commit -t pre-push + + integrate: + cmds: + - git is-clean + - git co main + - git weld - + + lint:fix: + cmds: + - npx prettier --write {{.CLI_ARGS | default "." }} + + page: + cmds: + - firefox https://adventofcode.com/{{.YEAR}}/day/{{.DAY}} + + download: + cmds: + - hygen day new --day {{.DAY_FORMATTED}} + - aoc download -d {{.DAY}} -o -p {{.DAY_FORMATTED}}/puzzle.md -i {{.DAY_FORMATTED}}/input + diff --git a/preset/year/templates/package.json b/preset/year/templates/package.json new file mode 100644 index 0000000..a1f88cb --- /dev/null +++ b/preset/year/templates/package.json @@ -0,0 +1,12 @@ +{ + "name": "@@year", + "version": "1.0.0", + "description": "", + "main": "vitest.config.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "Yanick Champoux (http://techblog.babyl.ca/)", + "license": "ISC" +} diff --git a/preset/year/templates/vitest.config.js b/preset/year/templates/vitest.config.js new file mode 100644 index 0000000..aca2fa2 --- /dev/null +++ b/preset/year/templates/vitest.config.js @@ -0,0 +1,9 @@ +/// +import { defineConfig } from "vite"; + +export default defineConfig({ + test: { + include: ["**/*test.js"], + // ... + }, +}); diff --git a/preset/year/tsconfig.json b/preset/year/tsconfig.json new file mode 100644 index 0000000..5dcab8a --- /dev/null +++ b/preset/year/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "esnext", + "baseUrl": ".", + "target": "es2016", + "lib": ["esnext"], + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "types": ["node", "@preset/core/globals"] + }, + "include": [ + "./*.ts", + "./src/**/*.ts" + ], + "exclude": ["templates", "node_modules"] +}