diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d9c265ec0..5b8fa1568 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4435,6 +4435,37 @@ importers: specifier: ^1.1.0 version: 1.1.0(@types/node@20.10.5)(@vitest/ui@1.0.4)(jsdom@23.0.1) + solutions/typescript/2023/25: + dependencies: + '@alexaegis/advent-of-code-lib': + specifier: workspace:^ + version: link:../../libs/lib + devDependencies: + '@alexaegis/eslint-config-vitest': + specifier: ^0.9.2 + version: 0.9.2 + '@alexaegis/ts': + specifier: ^0.9.2 + version: 0.9.2 + '@alexaegis/vite': + specifier: ^0.9.2 + version: 0.9.2(@types/node@20.10.5) + '@alexaegis/vitest': + specifier: ^0.9.2 + version: 0.9.2(@types/node@20.10.5)(svelte@4.2.8)(vite@5.0.10) + '@types/node': + specifier: ^20.10.5 + version: 20.10.5 + benny: + specifier: ^3.7.1 + version: 3.7.1 + vite: + specifier: ^5.0.10 + version: 5.0.10(@types/node@20.10.5) + vitest: + specifier: ^1.1.0 + version: 1.1.0(@types/node@20.10.5)(@vitest/ui@1.0.4)(jsdom@23.0.1) + solutions/typescript/libs/ecs: dependencies: '@alexaegis/advent-of-code-lib': diff --git a/solutions/typescript/2023/25/.eslintignore b/solutions/typescript/2023/25/.eslintignore new file mode 100644 index 000000000..9bad44ce0 --- /dev/null +++ b/solutions/typescript/2023/25/.eslintignore @@ -0,0 +1,13 @@ +# managed-by-autotool + +package-lock.json +node_modules +vite.config.ts.* +vitest.config.ts.* +shims +typedoc + +# sveltekit +.svelte-kit +.vercel +build diff --git a/solutions/typescript/2023/25/.eslintrc.cjs b/solutions/typescript/2023/25/.eslintrc.cjs new file mode 100644 index 000000000..1cfd8cafe --- /dev/null +++ b/solutions/typescript/2023/25/.eslintrc.cjs @@ -0,0 +1,6 @@ +// managed-by-autotool + +/** @type {import('eslint').Linter.Config} */ +module.exports = { + extends: ['../../../../.eslintrc.cjs', '@alexaegis/eslint-config-vitest'], +}; diff --git a/solutions/typescript/2023/25/.prettierignore b/solutions/typescript/2023/25/.prettierignore new file mode 100644 index 000000000..188c2af87 --- /dev/null +++ b/solutions/typescript/2023/25/.prettierignore @@ -0,0 +1,39 @@ +# managed-by-autotool +# Add files here to ignore them from prettier formatting + +# node +node_modules +package-lock.json +pnpm-lock.yaml +yarn.lock + +# build artifacts +dist +public/build +build +.svelte-kit +.vercel +typedoc +**/.vitepress/cache + +# test artifacts +coverage +.vscode/chrome +.nyc_output +vite.config.ts.* +vitest.config.ts.* + +# turbo +.turbo + +# rust +target +*.lock + +# python +.pytest_cache + +# others +.cache +.benchmark +CHANGELOG.md diff --git a/solutions/typescript/2023/25/package.json b/solutions/typescript/2023/25/package.json new file mode 100644 index 000000000..a20872c1b --- /dev/null +++ b/solutions/typescript/2023/25/package.json @@ -0,0 +1,79 @@ +{ + "name": "@alexaegis/advent-of-code-2023-25", + "description": "Advent of Code 2023 25 solutions", + "version": "1.0.0", + "license": "mit", + "private": true, + "archetype": { + "platform": "node", + "framework": "adventofcode", + "language": "ts" + }, + "keywords": [ + "advent-of-code", + "javascript", + "js", + "managed-by-autotool", + "ts", + "typescript" + ], + "type": "module", + "aoc": { + "day": 25, + "year": 2023 + }, + "scripts": { + "lint:depcheck": "turbo run lint:depcheck_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "lint:depcheck_": "depcheck", + "lint:es": "turbo run lint:es_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "lint:es_": "eslint --max-warnings=0 --fix --no-error-on-unmatched-pattern .", + "lint:format": "turbo run lint:format_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "lint:format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --check .", + "lint:md": "turbo run lint:md_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "lint:md_": "remark --frail --no-stdout --silently-ignore .", + "lint:tsc": "turbo run lint:tsc_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "lint:tsc_": "tsc --noEmit", + "test": "turbo run test_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "test_": "vitest --passWithNoTests --coverage --run", + "test:watch": "vitest --passWithNoTests --coverage", + "all": "BUILD_REASON='publish' turbo run all_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "bench": "ts-node-esm src/bench.ts", + "build": "turbo run build-lib_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "build-lib_": "vite build", + "format": "turbo run format_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-25", + "format_": "prettier --cache-location .cache/prettier --plugin prettier-plugin-svelte --plugin prettier-plugin-tailwindcss --write .", + "p1": "RUN=1 NODE_NO_WARNINGS=1 ts-node-esm src/p1.ts", + "p2": "RUN=1 NODE_NO_WARNINGS=1 ts-node-esm src/p2.ts" + }, + "exports": { + "./bench": { + "types": "./src/bench.ts", + "import": "./dist/bench.js", + "default": "./dist/bench.js" + }, + "./p1": { + "types": "./src/p1.ts", + "import": "./dist/p1.js", + "default": "./dist/p1.js" + }, + "./p2": { + "types": "./src/p2.ts", + "import": "./dist/p2.js", + "default": "./dist/p2.js" + }, + "./readme": "./readme.md" + }, + "dependencies": { + "@alexaegis/advent-of-code-lib": "workspace:^" + }, + "devDependencies": { + "@alexaegis/eslint-config-vitest": "^0.9.2", + "@alexaegis/ts": "^0.9.2", + "@alexaegis/vite": "^0.9.2", + "@alexaegis/vitest": "^0.9.2", + "@types/node": "^20.10.5", + "benny": "^3.7.1", + "vite": "^5.0.10", + "vitest": "^1.1.0" + } +} diff --git a/solutions/typescript/2023/25/readme.md b/solutions/typescript/2023/25/readme.md new file mode 100644 index 000000000..23e0dcff8 --- /dev/null +++ b/solutions/typescript/2023/25/readme.md @@ -0,0 +1,9 @@ +# [Day 25](https://adventofcode.com/2023/day/25) + +## [Part One](https://adventofcode.com/2023/day/25#part1) + +> [TypeScript](/solutions/typescript/2023/25/src/p1.ts) + +## [Part Two](https://adventofcode.com/2023/day/25#part2) + +> [TypeScript](/solutions/typescript/2023/25/src/p2.ts) diff --git a/solutions/typescript/2023/25/src/bench.ts b/solutions/typescript/2023/25/src/bench.ts new file mode 100644 index 000000000..e37b7eae7 --- /dev/null +++ b/solutions/typescript/2023/25/src/bench.ts @@ -0,0 +1,18 @@ +import { loadTaskResources } from '@alexaegis/advent-of-code-lib'; +import { defaultBench } from '@alexaegis/advent-of-code-lib/benchmark'; +import { add } from 'benny'; +import packageJson from '../package.json'; +import { p1 } from './p1.js'; +import { p2 } from './p2.js'; + +await defaultBench( + '2023 - Day 25', + add('Part One', async () => { + const { input } = await loadTaskResources(packageJson.aoc); + return () => p1(input); + }), + add('Part Two', async () => { + const { input } = await loadTaskResources(packageJson.aoc); + return () => p2(input); + }), +); diff --git a/solutions/typescript/2023/25/src/p1.spec.ts b/solutions/typescript/2023/25/src/p1.spec.ts new file mode 100644 index 000000000..944fcfaf6 --- /dev/null +++ b/solutions/typescript/2023/25/src/p1.spec.ts @@ -0,0 +1,20 @@ +import { loadTaskResources } from '@alexaegis/advent-of-code-lib'; +import { describe, expect, it } from 'vitest'; +import packageJson from '../package.json'; +import { p1 } from './p1.js'; + +describe.skip('2023 25 p1', () => { + describe('the input', () => { + it('should solve the input', async () => { + const resources = await loadTaskResources(packageJson.aoc); + expect(p1(resources.input)).toEqual(0); + }); + }); + + describe('example 1', () => { + it('should be solved', async () => { + const resources = await loadTaskResources(packageJson.aoc, 'example.1.txt'); + expect(p1(resources.input)).toEqual(0); + }); + }); +}); diff --git a/solutions/typescript/2023/25/src/p1.ts b/solutions/typescript/2023/25/src/p1.ts new file mode 100644 index 000000000..d508a960e --- /dev/null +++ b/solutions/typescript/2023/25/src/p1.ts @@ -0,0 +1,8 @@ +import { task } from '@alexaegis/advent-of-code-lib'; +import packageJson from '../package.json'; + +export const p1 = (_input: string): number => { + return 0; +}; + +await task(p1, packageJson.aoc); // 0 ~0ms diff --git a/solutions/typescript/2023/25/src/p2.spec.ts b/solutions/typescript/2023/25/src/p2.spec.ts new file mode 100644 index 000000000..d3d30f8b0 --- /dev/null +++ b/solutions/typescript/2023/25/src/p2.spec.ts @@ -0,0 +1,20 @@ +import { loadTaskResources } from '@alexaegis/advent-of-code-lib'; +import { describe, expect, it } from 'vitest'; +import packageJson from '../package.json'; +import { p2 } from './p2.js'; + +describe.skip('2023 25 p2', () => { + describe('the input', () => { + it('should solve the input', async () => { + const { input } = await loadTaskResources(packageJson.aoc); + expect(p2(input)).toEqual(0); + }); + }); + + describe('example 1', () => { + it('should be solved', async () => { + const { input } = await loadTaskResources(packageJson.aoc, 'example.1.txt'); + expect(p2(input)).toEqual(0); + }); + }); +}); diff --git a/solutions/typescript/2023/25/src/p2.ts b/solutions/typescript/2023/25/src/p2.ts new file mode 100644 index 000000000..68c39bd1c --- /dev/null +++ b/solutions/typescript/2023/25/src/p2.ts @@ -0,0 +1,8 @@ +import { task } from '@alexaegis/advent-of-code-lib'; +import packageJson from '../package.json'; + +export const p2 = (_input: string): number => { + return 0; +}; + +await task(p2, packageJson.aoc); // 0 ~0ms diff --git a/solutions/typescript/2023/25/tsconfig.json b/solutions/typescript/2023/25/tsconfig.json new file mode 100644 index 000000000..14734b74d --- /dev/null +++ b/solutions/typescript/2023/25/tsconfig.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig?mark=managed-by-autotool", + "extends": "@alexaegis/ts/node", + "compilerOptions": { + "rootDir": "../../../../", + "outDir": ".cache/tsc" + }, + "files": ["package.json", "../../../../package.json"], + "include": [ + "src/**/*", + "static/**/*", + "__mocks__/**/*", + "*", + ".*", + "*.json", + ".*.json", + "**/*.json" + ], + "exclude": [ + "node_modules", + "dist", + "coverage", + "typedoc", + ".turbo", + ".cache", + "vite*.config.ts.timestamp-*" + ] +} diff --git a/solutions/typescript/2023/25/typedoc.json b/solutions/typescript/2023/25/typedoc.json new file mode 100644 index 000000000..0f3238ede --- /dev/null +++ b/solutions/typescript/2023/25/typedoc.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://typedoc.org/schema.json?mark=managed-by-autotool", + "extends": ["../../../../.config/typedoc.base.json"], + "entryPoints": ["src/*"] +} diff --git a/solutions/typescript/2023/25/vite.config.ts b/solutions/typescript/2023/25/vite.config.ts new file mode 100644 index 000000000..b6d107cd0 --- /dev/null +++ b/solutions/typescript/2023/25/vite.config.ts @@ -0,0 +1,19 @@ +// managed-by-autotool + +import { pakk } from '@alexaegis/vite'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + build: { + target: 'es2022', + lib: { + entry: [], + formats: ['es'], + }, + }, + plugins: [ + pakk({ + dts: false, + }), + ], +}); diff --git a/solutions/typescript/2023/25/vitest.config.ts b/solutions/typescript/2023/25/vitest.config.ts new file mode 100644 index 000000000..d82b44605 --- /dev/null +++ b/solutions/typescript/2023/25/vitest.config.ts @@ -0,0 +1,3 @@ +// managed-by-autotool + +export { vitestNodeConfig as default } from '@alexaegis/vitest';