Skip to content

Commit

Permalink
Add version option to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoespeon committed Dec 19, 2018
1 parent e1dab95 commit 7b43413
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
"dataviz"
],
"bin": {
"sassgraphviz": "dist/cli.js",
"sgv": "dist/cli.js"
"sassgraphviz": "dist/src/cli.js",
"sgv": "dist/src/cli.js"
},
"files": [
"dist"
],
"author": "Nicolas Carlo <[email protected]>",
"license": "MIT",
"main": "dist/index.js",
"main": "dist/src/index.js",
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc",
"postbuild": "chmod +x dist/cli.js && npm run copy-static-files",
"copy-static-files": "copyup src/rendering/**/*.{js,css,pug,json} dist",
"postbuild": "chmod +x dist/src/cli.js && npm run copy-static-files",
"copy-static-files": "copyup src/rendering/**/*.{js,css,pug,json} dist/src",
"build:watch": "npm run prebuild && tsc-watch --onSuccess \"npm run postbuild\"",
"test": "jest",
"prepare": "npm run build",
Expand Down
2 changes: 2 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import * as program from "commander";
import * as path from "path";

import { version } from "../package.json";
import { generateVisualGraph } from "./index";

const DEFAULT_PORT = 3000;

program
.arguments("<target>")
.version(version, "-v, --version")
.option(
"-e, --exclude-externals",
"Omit files that are not under given target",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true
"noUnusedLocals": true,
"resolveJsonModule": true
},
"files": ["src/index.ts", "src/cli.ts"],
"includes": ["examples/**/*.ts"]
Expand Down

0 comments on commit 7b43413

Please sign in to comment.