refactor: 💡 replace commander with sade

This commit is contained in:
Christian Kaisermann 2020-11-05 17:51:26 -03:00
parent c664bc6123
commit 2663893792
2 changed files with 6 additions and 4 deletions

View File

@ -32,7 +32,6 @@
"lint": "eslint \"{src,test}/**/*.ts\"",
"format": "prettier --loglevel silent --write \"{src,test}/**/*.ts\"",
"release": " git add package.json && git commit -m \"chore(release): v$npm_package_version :tada:\"",
"pretest": "npm run build",
"prebuild": "yarn clean",
"postbuild": "yarn build:types",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1 && git add CHANGELOG.md",
@ -80,6 +79,7 @@
"@types/estree": "0.0.45",
"@types/intl": "^1.2.0",
"@types/jest": "^26.0.14",
"@types/sade": "^1.7.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^26.3.0",
"conventional-changelog-cli": "^2.1.0",
@ -100,11 +100,11 @@
"typescript": "^4.0.3"
},
"dependencies": {
"commander": "^4.0.1",
"deepmerge": "^4.2.2",
"dlv": "^1.1.3",
"estree-walker": "^0.9.0",
"intl-messageformat": "^7.5.2",
"sade": "^1.7.4",
"tiny-glob": "^0.2.6"
}
}

View File

@ -1,7 +1,7 @@
import fs from 'fs';
import { dirname, resolve } from 'path';
import program from 'commander';
import sade from 'sade';
import glob from 'tiny-glob';
import { preprocess } from 'svelte/compiler';
@ -14,9 +14,11 @@ const fileExists = (path: string) =>
.then(() => true)
.catch(() => false);
const program = sade('svelte-i18n');
program
.command('extract <glob> [output]')
.description('extract all message definitions from files to a json')
.describe('extract all message definitions from files to a json')
.option(
'-s, --shallow',
'extract to a shallow dictionary (ids with dots interpreted as strings, not paths)',