try preset
This commit is contained in:
parent
a1f4d2238f
commit
d08e00ae79
@ -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",
|
||||
|
1
preset/year/.gitignore
vendored
Normal file
1
preset/year/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
19
preset/year/README.md
Normal file
19
preset/year/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
<p align="center">
|
||||
<br />
|
||||
<a href="https://preset.dev">
|
||||
<img width="100" src="https://raw.githubusercontent.com/preset/preset/main/.github/assets/logo.svg" alt="Logo of Preset">
|
||||
</a>
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<h2 align="center">year</h2>
|
||||
<pre><div align="center">npx @preset/cli apply username//home/yanick/work/javascript/adventofcode/preset/year</div></pre>
|
||||
|
||||
<br />
|
||||
|
||||
<div align="center">
|
||||
This preset was made by Yanick Champoux.
|
||||
<br />
|
||||
<br />
|
||||
<a href="https://preset.dev">Learn more</a>
|
||||
</div>
|
9
preset/year/package.json
Normal file
9
preset/year/package.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"private": true,
|
||||
"author": "Yanick Champoux <yanick@babyl.ca>",
|
||||
"license": "MIT",
|
||||
"preset": "preset.ts",
|
||||
"devDependencies": {
|
||||
"@preset/core": "^0.11.2"
|
||||
}
|
||||
}
|
30
preset/year/preset.ts
Normal file
30
preset/year/preset.ts
Normal file
@ -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',
|
||||
});
|
||||
|
||||
},
|
||||
})
|
0
preset/year/templates/.gitkeep
Normal file
0
preset/year/templates/.gitkeep
Normal file
35
preset/year/templates/Taskfile.yaml
Normal file
35
preset/year/templates/Taskfile.yaml
Normal file
@ -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
|
||||
|
12
preset/year/templates/package.json
Normal file
12
preset/year/templates/package.json
Normal file
@ -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 <yanick@babyl.ca> (http://techblog.babyl.ca/)",
|
||||
"license": "ISC"
|
||||
}
|
9
preset/year/templates/vitest.config.js
Normal file
9
preset/year/templates/vitest.config.js
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference types="vitest" />
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
include: ["**/*test.js"],
|
||||
// ...
|
||||
},
|
||||
});
|
18
preset/year/tsconfig.json
Normal file
18
preset/year/tsconfig.json
Normal file
@ -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"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user