Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8fd157802b | ||
|
1db4794ee9 | ||
|
1eb1d0092d | ||
|
4d3a3529b8 |
33
README.md
33
README.md
@@ -78,7 +78,7 @@ _('Extract me');
|
||||
`ngx-translate-extract ... -m _`
|
||||
|
||||
## Commandline arguments
|
||||
```shell
|
||||
```
|
||||
Usage:
|
||||
ngx-translate-extract [options]
|
||||
|
||||
@@ -89,23 +89,22 @@ Options:
|
||||
can use path expansion, glob patterns and multiple
|
||||
paths
|
||||
[array] [default: current working path]
|
||||
--patterns, -p Extract strings from the following file patterns
|
||||
[array] [required] [default: current working path]
|
||||
--patterns, -p Extract strings from the following file patterns
|
||||
[array] [default: ["/**/*.html","/**/*.ts"]]
|
||||
--output, -o Paths where you would like to save extracted
|
||||
strings. You can use path expansion, glob patterns
|
||||
and multiple paths [array] [required]
|
||||
--format, -f Output format
|
||||
--output, -o Paths where you would like to save extracted
|
||||
strings. You can use path expansion, glob
|
||||
patterns and multiple paths [array] [required]
|
||||
--format, -f Output format
|
||||
[string] [choices: "json", "namespaced-json", "pot"] [default: "json"]
|
||||
--format-indentation, --fi Output format indentation [string] [default: " "]
|
||||
--replace, -r Replace the contents of output file if it exists
|
||||
(Merges by default) [boolean] [default: false]
|
||||
--sort, -s Sort strings in alphabetical order when saving
|
||||
[boolean] [default: false]
|
||||
--clean, -c Remove obsolete strings when merging
|
||||
[boolean] [default: false]
|
||||
--format-indentation, --fi Output format indentation [string] [default: " "]
|
||||
--replace, -r Replace the contents of output file if it exists
|
||||
(Merges by default) [boolean]
|
||||
--sort, -s Sort strings in alphabetical order when saving
|
||||
[boolean]
|
||||
--clean, -c Remove obsolete strings when merging [boolean]
|
||||
--key-as-default-value, -k Use key as default value for translations
|
||||
[boolean] [default: false]
|
||||
[boolean]
|
||||
--null-as-default-value, -n Use null as default value for translations
|
||||
[boolean] [default: false]
|
||||
|
||||
Arguments key-as-default-value and null-as-default-value are mutually exclusive
|
||||
[boolean]
|
||||
```
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@biesbjerg/ngx-translate-extract",
|
||||
"version": "4.1.0",
|
||||
"version": "4.2.0",
|
||||
"description": "Extract strings from projects using ngx-translate",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
|
@@ -25,12 +25,13 @@ export const cli = yargs
|
||||
.option('input', {
|
||||
alias: 'i',
|
||||
describe: 'Paths you would like to extract strings from. You can use path expansion, glob patterns and multiple paths',
|
||||
default: process.env.PWD,
|
||||
default: [process.env.PWD],
|
||||
type: 'array',
|
||||
normalize: true
|
||||
normalize: true,
|
||||
required: true
|
||||
})
|
||||
.check(options => {
|
||||
(options.input as unknown as string[]).forEach((dir: string) => {
|
||||
options.input.forEach((dir: string) => {
|
||||
if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
|
||||
throw new Error(`The path you supplied was not found: '${dir}'`);
|
||||
}
|
||||
@@ -67,38 +68,33 @@ export const cli = yargs
|
||||
.option('replace', {
|
||||
alias: 'r',
|
||||
describe: 'Replace the contents of output file if it exists (Merges by default)',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('sort', {
|
||||
alias: 's',
|
||||
describe: 'Sort strings in alphabetical order when saving',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('clean', {
|
||||
alias: 'c',
|
||||
describe: 'Remove obsolete strings when merging',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('key-as-default-value', {
|
||||
alias: 'k',
|
||||
describe: 'Use key as default value for translations',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('null-as-default-value', {
|
||||
alias: 'n',
|
||||
describe: 'Use null as default value for translations',
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
})
|
||||
.conflicts('key-as-default-value', 'null-as-default-value')
|
||||
.exitProcess(true)
|
||||
.parse(process.argv);
|
||||
|
||||
const extractTask = new ExtractTask(cli.input as unknown as string[], cli.output, {
|
||||
const extractTask = new ExtractTask(cli.input, cli.output, {
|
||||
replace: cli.replace,
|
||||
patterns: cli.patterns
|
||||
});
|
||||
|
@@ -12,7 +12,10 @@
|
||||
],
|
||||
"module": "commonjs",
|
||||
"outDir": "./dist/",
|
||||
"sourceMap": true
|
||||
"sourceMap": true,
|
||||
"typeRoots" : [
|
||||
"./node_modules/@types"
|
||||
],
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
|
Reference in New Issue
Block a user