Add script in bin/ and building of .ts files
This commit is contained in:
parent
7f35a9a6b1
commit
69791951ab
|
|
@ -1,2 +1,3 @@
|
|||
node_modules/
|
||||
yarn-error.log
|
||||
yarn-error.log
|
||||
dist/
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env node
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const fs = require("fs");
|
||||
const { generateZwo } = require("../dist/generateZwo");
|
||||
const { parse } = require("../dist/parser");
|
||||
const { stats } = require("../dist/stats");
|
||||
const { parseCliOptions } = require("../dist/parseCliOptions");
|
||||
|
||||
const opts = parseCliOptions();
|
||||
|
||||
const workout = parse(fs.readFileSync(opts.file, "utf8"));
|
||||
|
||||
if (opts.stats) {
|
||||
console.log(stats(workout));
|
||||
} else {
|
||||
console.log(generateZwo(workout));
|
||||
}
|
||||
|
|
@ -13,7 +13,11 @@
|
|||
"test:stats:1": "ts-node src/index.ts --stats examples/threshold-pushing.txt",
|
||||
"test:stats:2": "ts-node src/index.ts --stats examples/darth-vader.txt",
|
||||
"start": "ts-node src/index.ts",
|
||||
"format:js": "prettier --write src/"
|
||||
"format:js": "prettier --write src/",
|
||||
"build": "tsc"
|
||||
},
|
||||
"bin": {
|
||||
"make-workout": "./bin/make-workout.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue