Compare commits

..

5 Commits

Author SHA1 Message Date
Kim Biesbjerg
8aa2774eca Bump version 2020-03-21 12:21:14 +01:00
Kim Biesbjerg
37ca29648a Remove files committed by mistake 2020-03-21 12:20:06 +01:00
Kim Biesbjerg
97d844c3d2 Fix paths on Windows. Closes #171 2020-03-21 04:18:07 -07:00
Kim Biesbjerg
e7795c5349 Use rimraf to support Windows 2020-03-21 04:17:17 -07:00
Kim Biesbjerg
9da4939f5d Fix readme 2020-03-19 14:04:00 +01:00
4 changed files with 26 additions and 11 deletions

View File

@@ -91,12 +91,12 @@ Options:
patterns and multiple paths [array] [required]
Examples:
cli.js -i ./src-a/ -i ./src-b/ -o strings.json Extract (ts, html) from multiple paths
cli.js -i './{src-a,src-b}/' -o strings.json Extract (ts, html) from multiple paths using brace
ngx-translate-extract -i ./src-a/ -i ./src-b/ -o strings.json Extract (ts, html) from multiple paths
ngx-translate-extract -i './{src-a,src-b}/' -o strings.json Extract (ts, html) from multiple paths using brace
expansion
cli.js -i ./src/ -o ./i18n/da.json -o ./i18n/en.json Extract (ts, html) and save to da.json and en.json
cli.js -i ./src/ -o './i18n/{en,da}.json' Extract (ts, html) and save to da.json and en.json
ngx-translate-extract -i ./src/ -o ./i18n/da.json -o ./i18n/en.json Extract (ts, html) and save to da.json and en.json
ngx-translate-extract -i ./src/ -o './i18n/{en,da}.json' Extract (ts, html) and save to da.json and en.json
using brace expansion
cli.js -i './src/**/*.{ts,tsx,html}' -o strings.json Extract from ts, tsx and html
cli.js -i './src/**/!(*.spec).{ts,html}' -o Extract from ts, html, excluding files with ".spec"
ngx-translate-extract -i './src/**/*.{ts,tsx,html}' -o strings.json Extract from ts, tsx and html
ngx-translate-extract -i './src/**/!(*.spec).{ts,html}' -o Extract from ts, html, excluding files with ".spec"
strings.json

10
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "@biesbjerg/ngx-translate-extract",
"version": "4.2.0",
"version": "5.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1978,6 +1978,14 @@
}
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"requires": {
"glob": "^7.1.3"
}
},
"rxjs": {
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "@biesbjerg/ngx-translate-extract",
"version": "5.0.0",
"version": "5.0.1",
"description": "Extract strings from projects using ngx-translate",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
@@ -14,7 +14,7 @@
"scripts": {
"build": "npm run clean && tsc",
"watch": "npm run clean && tsc --watch",
"clean": "rm -rf ./dist",
"clean": "rimraf ./dist",
"lint": "tslint --force './src/**/*.ts'",
"test": "mocha -r ts-node/register tests/**/*.spec.ts"
},
@@ -79,7 +79,8 @@
"tslint": "^6.1.0",
"tslint-config-prettier": "^1.18.0",
"tslint-eslint-rules": "^5.4.0",
"tslint-etc": "^1.10.1"
"tslint-etc": "^1.10.1",
"rimraf": "^3.0.2"
},
"dependencies": {
"@angular/compiler": "^9.0.7",

View File

@@ -2,6 +2,12 @@ import * as os from 'os';
import * as fs from 'fs';
import * as braces from 'braces';
declare module 'braces' {
interface Options {
keepEscaping?: boolean; // Workaround for option not present in @types/braces 3.0.0
}
}
export function normalizeHomeDir(path: string): string {
if (path.substring(0, 1) === '~') {
return `${os.homedir()}/${path.substring(1)}`;
@@ -10,7 +16,7 @@ export function normalizeHomeDir(path: string): string {
}
export function expandPattern(pattern: string): string[] {
return braces(pattern, { expand: true });
return braces(pattern, { expand: true, keepEscaping: true });
}
export function normalizePaths(patterns: string[], defaultPatterns: string[] = []): string[] {