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,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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue