feat: deno base project
This commit is contained in:
12
deno.json
Normal file
12
deno.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"tasks": {
|
||||
"dev": "deno run -R --watch src/main.ts",
|
||||
"today:dev": "deno run -R --watch src/main.ts $(date +%e)",
|
||||
"today": "deno run -R src/main.ts $(date +%e)",
|
||||
"test": "deno test --parallel src"
|
||||
},
|
||||
"imports": {
|
||||
"@std/assert": "jsr:@std/assert@1",
|
||||
"@/": "./src/"
|
||||
}
|
||||
}
|
||||
23
deno.lock
generated
Normal file
23
deno.lock
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": "5",
|
||||
"specifiers": {
|
||||
"jsr:@std/assert@1": "1.0.14",
|
||||
"jsr:@std/internal@^1.0.10": "1.0.10"
|
||||
},
|
||||
"jsr": {
|
||||
"@std/assert@1.0.14": {
|
||||
"integrity": "68d0d4a43b365abc927f45a9b85c639ea18a9fab96ad92281e493e4ed84abaa4",
|
||||
"dependencies": [
|
||||
"jsr:@std/internal"
|
||||
]
|
||||
},
|
||||
"@std/internal@1.0.10": {
|
||||
"integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7"
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"jsr:@std/assert@1"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
src/exercises/assets/day_1_input.txt
Normal file
1
src/exercises/assets/day_1_input.txt
Normal file
@@ -0,0 +1 @@
|
||||
Test
|
||||
4
src/exercises/day_1.ts
Normal file
4
src/exercises/day_1.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function FirstDayExerciseName() {
|
||||
console.log("test_module");
|
||||
return 1;
|
||||
}
|
||||
17
src/main.ts
Normal file
17
src/main.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
async function main(): Promise<number> {
|
||||
const args = Deno.args;
|
||||
if (!args || args.length !== 1) {
|
||||
return Promise.resolve(-1);
|
||||
}
|
||||
const day = parseInt(args[0]);
|
||||
|
||||
const module = await import(`./exercises/day_${day}.ts`);
|
||||
module.default();
|
||||
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
|
||||
if (import.meta.main) {
|
||||
await main();
|
||||
}
|
||||
6
src/main_test.ts
Normal file
6
src/main_test.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { assertEquals } from "@std/assert";
|
||||
import { add } from "./main.ts";
|
||||
|
||||
Deno.test(function addTest() {
|
||||
assertEquals(add(2, 3), 5);
|
||||
});
|
||||
Reference in New Issue
Block a user