feat: so many greater things now
This commit is contained in:
parent
60205795d0
commit
8373956717
6 changed files with 23 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,5 +2,6 @@ node_modules
|
||||||
src/day*
|
src/day*
|
||||||
./ligma.config.js
|
./ligma.config.js
|
||||||
dist
|
dist
|
||||||
|
stats.json
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"clearMocks": true,
|
"clearMocks": true,
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"@code/(.*)": [
|
"@code/(.*)": [
|
||||||
"<rootDir>/src/day9/$1"
|
"<rootDir>/src/day1/$1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"preset": "ts-jest"
|
"preset": "ts-jest"
|
||||||
|
|
|
||||||
12
package.json
12
package.json
|
|
@ -19,15 +19,5 @@
|
||||||
"prettier": "prettier --write ./src",
|
"prettier": "prettier --write ./src",
|
||||||
"generate": "./scripts/generate",
|
"generate": "./scripts/generate",
|
||||||
"day": "echo /home/mpaulson/personal/kata/src/day9"
|
"day": "echo /home/mpaulson/personal/kata/src/day9"
|
||||||
},
|
|
||||||
"kata_stats": {
|
|
||||||
"ArrayList": 3,
|
|
||||||
"DijkstraList": 5,
|
|
||||||
"InsertionSort": 4,
|
|
||||||
"MergeSort": 4,
|
|
||||||
"Queue": 4,
|
|
||||||
"Stack": 4,
|
|
||||||
"QuickSort": 4,
|
|
||||||
"PrimsList": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,31 @@
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports.package_json = function(config, day_path) {
|
module.exports.stats = function(config, day_path) {
|
||||||
const package_json = require("../package.json");
|
let stats;
|
||||||
package_json.scripts.test = `jest ${config.dsa.join(" ")}`;
|
try {
|
||||||
package_json.scripts.day = `echo ${day_path}`;
|
stats = require("../stats.json");
|
||||||
|
} catch(e) {
|
||||||
|
stats = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
package_json.kata_stats = config.dsa.reduce((acc, ds) => {
|
stats = config.dsa.reduce((acc, ds) => {
|
||||||
if (!acc[ds]) {
|
if (!acc[ds]) {
|
||||||
acc[ds] = 0;
|
acc[ds] = 0;
|
||||||
}
|
}
|
||||||
acc[ds]++;
|
acc[ds]++;
|
||||||
return acc;
|
return acc;
|
||||||
}, package_json.kata_stats || {});
|
}, stats || {});
|
||||||
|
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(__dirname, "..", "stats.json"),
|
||||||
|
JSON.stringify(package_json, null, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.package_json = function(config, day_path) {
|
||||||
|
const package_json = require("../package.json");
|
||||||
|
package_json.scripts.test = `jest ${config.dsa.join(" ")}`;
|
||||||
|
package_json.scripts.day = `echo ${day_path}`;
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(__dirname, "..", "package.json"),
|
path.join(__dirname, "..", "package.json"),
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,5 @@ const align = require("./align-configs");
|
||||||
align.jest(day_name);
|
align.jest(day_name);
|
||||||
align.ts_config(day_name);
|
align.ts_config(day_name);
|
||||||
align.package_json(config, day_path);
|
align.package_json(config, day_path);
|
||||||
|
align.stats(config, day_path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@code/*": [
|
"@code/*": [
|
||||||
"day9/*"
|
"day1/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue