Skip to content

Commit

Permalink
chore: prepared 2023 day 14
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAegis committed Dec 14, 2023
1 parent 27625e1 commit d3758ef
Show file tree
Hide file tree
Showing 17 changed files with 310 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added resources/2023/14/example.1.txt
Empty file.
Empty file added resources/2023/14/input.txt
Empty file.
13 changes: 13 additions & 0 deletions solutions/typescript/2023/14/.eslintignore
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions solutions/typescript/2023/14/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// managed-by-autotool

/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: ['../../../../.eslintrc.cjs', '@alexaegis/eslint-config-vitest'],
};
38 changes: 38 additions & 0 deletions solutions/typescript/2023/14/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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

# 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
84 changes: 84 additions & 0 deletions solutions/typescript/2023/14/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"name": "@alexaegis/advent-of-code-2023-14",
"description": "Advent of Code 2023 14 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": 14,
"year": 2023
},
"scripts": {
"lint:depcheck": "turbo run lint:depcheck_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-14",
"lint:depcheck_": "depcheck",
"lint:es": "turbo run lint:es_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-14",
"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-14",
"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-14",
"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-14",
"lint:tsc_": "tsc --noEmit",
"test": "turbo run test_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-14",
"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-14",
"bench": "ts-node-esm src/bench.ts",
"build": "turbo run build-lib_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-14",
"build-lib_": "vite build",
"format": "turbo run format_ --concurrency 16 --cache-dir .cache/turbo --filter @alexaegis/advent-of-code-2023-14",
"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"
},
"./parse": {
"types": "./src/parse.ts",
"import": "./dist/parse.js",
"default": "./dist/parse.js"
},
"./readme": "./readme.md"
},
"dependencies": {
"@alexaegis/advent-of-code-lib": "workspace:^"
},
"devDependencies": {
"@alexaegis/eslint-config-vitest": "^0.9.1",
"@alexaegis/ts": "^0.9.1",
"@alexaegis/vite": "^0.9.1",
"@alexaegis/vitest": "^0.9.1",
"@types/node": "^20.10.4",
"benny": "^3.7.1",
"vite": "^5.0.7",
"vitest": "^1.0.4"
}
}
9 changes: 9 additions & 0 deletions solutions/typescript/2023/14/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# [Day 14](https://adventofcode.com/2023/day/14)

## [Part One](https://adventofcode.com/2023/day/14#part1)

> [TypeScript](/solutions/typescript/2023/14/src/p1.ts)
## [Part Two](https://adventofcode.com/2023/day/14#part2)

> [TypeScript](/solutions/typescript/2023/14/src/p2.ts)
18 changes: 18 additions & 0 deletions solutions/typescript/2023/14/src/bench.ts
Original file line number Diff line number Diff line change
@@ -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 14',
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);
}),
);
20 changes: 20 additions & 0 deletions solutions/typescript/2023/14/src/p1.spec.ts
Original file line number Diff line number Diff line change
@@ -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('2023 14 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);
});
});
});
8 changes: 8 additions & 0 deletions solutions/typescript/2023/14/src/p1.ts
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions solutions/typescript/2023/14/src/p2.spec.ts
Original file line number Diff line number Diff line change
@@ -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('2023 14 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);
});
});
});
8 changes: 8 additions & 0 deletions solutions/typescript/2023/14/src/p2.ts
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions solutions/typescript/2023/14/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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-*"
]
}
5 changes: 5 additions & 0 deletions solutions/typescript/2023/14/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://typedoc.org/schema.json?mark=managed-by-autotool",
"extends": ["../../../../.config/typedoc.base.json"],
"entryPoints": ["src/*"]
}
19 changes: 19 additions & 0 deletions solutions/typescript/2023/14/vite.config.ts
Original file line number Diff line number Diff line change
@@ -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,
}),
],
});
3 changes: 3 additions & 0 deletions solutions/typescript/2023/14/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// managed-by-autotool

export { vitestNodeConfig as default } from '@alexaegis/vitest';

0 comments on commit d3758ef

Please sign in to comment.