cleanup-package-json
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -24,2 +24,6 @@ #!/usr/bin/env node | ||
}) | ||
.options('v', { | ||
alias: 'version', | ||
describe: 'Prints version.' | ||
}) | ||
.usage('Usage: cleanup-package-json [options]') | ||
@@ -30,6 +34,13 @@ .boolean(['h', 'v']) | ||
constructor(opt) { | ||
this.package = {}; | ||
let packageJSONPath = path.join(__dirname, '../package.json'); | ||
this.package = JSON.parse(fs.readFileSync(packageJSONPath, 'utf8')); | ||
let argv = opt.argv; | ||
if (argv.help) { | ||
this.printVersion(); | ||
console.info(opt.help()); | ||
} | ||
else if (argv.version) { | ||
this.printVersion(); | ||
} | ||
else { | ||
@@ -102,3 +113,6 @@ let configFileName = argv.config || DEFAULT_CONFIG_NAME; | ||
} | ||
printVersion() { | ||
console.info(`Version ${this.package['version']} \n`); | ||
} | ||
} | ||
new Cli(opt); |
{ | ||
"name": "cleanup-package-json", | ||
"version": "0.0.1", | ||
"description": "Cleans package.json file.", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "tsc -p .", | ||
"prepublish": "npm run build" | ||
}, | ||
"author": "Martynas Zilinskas <martynas@quatrodev.com>", | ||
"license": "GPL-3.0", | ||
"devDependencies": { | ||
"@types/node": "^6.0.31", | ||
"@types/optimist": "0.0.28", | ||
"typescript": "^2.0.0", | ||
"typings": "^1.3.1" | ||
}, | ||
"dependencies": { | ||
"optimist": "^0.6.1" | ||
}, | ||
"bin": { | ||
"cleanup-package-json": "./dist/cli.js" | ||
} | ||
} | ||
"name": "cleanup-package-json", | ||
"version": "0.1.0", | ||
"description": "Cleans package.json file.", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "tsc -p .", | ||
"prepublish": "npm run build" | ||
}, | ||
"author": "Martynas Zilinskas <martynas@quatrodev.com>", | ||
"license": "GPL-3.0", | ||
"devDependencies": { | ||
"@types/node": "^6.0.31", | ||
"@types/optimist": "0.0.28", | ||
"typescript": "^2.0.0", | ||
"typings": "^1.3.1" | ||
}, | ||
"dependencies": { | ||
"optimist": "^0.6.1" | ||
}, | ||
"bin": { | ||
"cpj": "./dist/cli.js" | ||
} | ||
} |
@@ -6,3 +6,3 @@ cleanup-package-json | ||
```sh | ||
$ npm install cleanup-package-json -g | ||
$ npm install cpj -g | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
```sh | ||
$ scss-bundle -h | ||
$ cpj -h | ||
``` | ||
@@ -25,8 +25,8 @@ | ||
```sh | ||
$ cleanup-package-json | ||
$ cpj | ||
``` | ||
_With custom name config:_ | ||
_With custom file config:_ | ||
```sh | ||
$ cleanup-package-json -c custom-config.json | ||
$ cpj -c custom-config.json | ||
``` | ||
@@ -33,0 +33,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45038
230