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