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*
|
||||
./ligma.config.js
|
||||
dist
|
||||
stats.json
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"clearMocks": true,
|
||||
"moduleNameMapper": {
|
||||
"@code/(.*)": [
|
||||
"<rootDir>/src/day9/$1"
|
||||
"<rootDir>/src/day1/$1"
|
||||
]
|
||||
},
|
||||
"preset": "ts-jest"
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -19,15 +19,5 @@
|
|||
"prettier": "prettier --write ./src",
|
||||
"generate": "./scripts/generate",
|
||||
"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 path = require("path");
|
||||
|
||||
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}`;
|
||||
module.exports.stats = function(config, day_path) {
|
||||
let stats;
|
||||
try {
|
||||
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]) {
|
||||
acc[ds] = 0;
|
||||
}
|
||||
acc[ds]++;
|
||||
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(
|
||||
path.join(__dirname, "..", "package.json"),
|
||||
|
|
|
|||
|
|
@ -78,4 +78,5 @@ const align = require("./align-configs");
|
|||
align.jest(day_name);
|
||||
align.ts_config(day_name);
|
||||
align.package_json(config, day_path);
|
||||
align.stats(config, day_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"baseUrl": "src",
|
||||
"paths": {
|
||||
"@code/*": [
|
||||
"day9/*"
|
||||
"day1/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue