@formatjs/cli
Advanced tools
Comparing version 1.1.22 to 1.2.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.2.0](https://github.com/formatjs/formatjs/compare/@formatjs/cli@1.1.22...@formatjs/cli@1.2.0) (2020-03-18) | ||
### Features | ||
* **@formatjs/cli:** Add option to ignore a glob of files ([#564](https://github.com/formatjs/formatjs/issues/564)) ([843d82b](https://github.com/formatjs/formatjs/commit/843d82b2190458deab2f4393cb854cc4d36f6dfc)) | ||
## [1.1.22](https://github.com/formatjs/formatjs/compare/@formatjs/cli@1.1.21...@formatjs/cli@1.1.22) (2020-03-05) | ||
@@ -8,0 +19,0 @@ |
@@ -70,7 +70,12 @@ "use strict"; | ||
].join(''), false) | ||
.option('--ignore <files>', 'List of glob paths to **not** extract translations from.') | ||
.action(async (files, cmdObj) => { | ||
files = files.reduce((all, f) => all.concat(glob_1.sync(f, { | ||
cwd: process.cwd(), | ||
})), []); | ||
await extract_1.default(files, { | ||
const processedFiles = []; | ||
for (const f of files) { | ||
processedFiles.push(...glob_1.sync(f, { | ||
cwd: process.cwd(), | ||
ignore: cmdObj.ignore, | ||
})); | ||
} | ||
await extract_1.default(processedFiles, { | ||
outFile: cmdObj.outFile, | ||
@@ -77,0 +82,0 @@ idInterpolationPattern: cmdObj.idInterpolationPattern || '[contenthash:5]', |
import { OptionsSchema } from 'babel-plugin-react-intl/dist/options'; | ||
import { IOptions as GlobOptions } from 'glob'; | ||
export declare type ExtractCLIOptions = Omit<OptionsSchema, 'overrideIdFn'> & { | ||
outFile?: string; | ||
idInterpolationPattern?: string; | ||
ignore?: GlobOptions['ignore']; | ||
}; | ||
export default function extract(files: readonly string[], { outFile, idInterpolationPattern, ...extractOpts }: ExtractCLIOptions): Promise<void>; |
{ | ||
"name": "@formatjs/cli", | ||
"version": "1.1.22", | ||
"version": "1.2.0", | ||
"description": "A CLI for formatjs.", | ||
@@ -51,3 +51,3 @@ "keywords": [ | ||
"babel-plugin-const-enum": "^0.0.2", | ||
"babel-plugin-react-intl": "^6.0.1", | ||
"babel-plugin-react-intl": "^6.1.0", | ||
"commander": "4.0.0-1", | ||
@@ -63,3 +63,3 @@ "fs-extra": "^8.1.0", | ||
}, | ||
"gitHead": "4251f2f0e83cce43abd7dc65b6a690ce5016f274" | ||
"gitHead": "42e02426fd9a41b160ffbb8980c8ea77a252e174" | ||
} |
@@ -44,3 +44,4 @@ # `formatjs-cli` | ||
description: 'baz'})` (default: false) | ||
--ignore List of glob paths to **not** extract translations from. | ||
-h, --help output usage information | ||
``` |
@@ -101,13 +101,17 @@ import commander from 'commander'; | ||
) | ||
.option( | ||
'--ignore <files>', | ||
'List of glob paths to **not** extract translations from.' | ||
) | ||
.action(async (files: readonly string[], cmdObj: ExtractCLIOptions) => { | ||
files = files.reduce( | ||
(all: string[], f) => | ||
all.concat( | ||
globSync(f, { | ||
cwd: process.cwd(), | ||
}) | ||
), | ||
[] | ||
); | ||
await extract(files, { | ||
const processedFiles = []; | ||
for (const f of files) { | ||
processedFiles.push( | ||
...globSync(f, { | ||
cwd: process.cwd(), | ||
ignore: cmdObj.ignore, | ||
}) | ||
); | ||
} | ||
await extract(processedFiles, { | ||
outFile: cmdObj.outFile, | ||
@@ -114,0 +118,0 @@ idInterpolationPattern: |
@@ -8,2 +8,3 @@ import {ExtractedMessageDescriptor} from 'babel-plugin-react-intl/dist'; | ||
import {interpolateName} from 'loader-utils'; | ||
import {IOptions as GlobOptions} from 'glob'; | ||
@@ -13,2 +14,3 @@ export type ExtractCLIOptions = Omit<OptionsSchema, 'overrideIdFn'> & { | ||
idInterpolationPattern?: string; | ||
ignore?: GlobOptions['ignore']; | ||
}; | ||
@@ -15,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
43685
614
47