@formatjs/cli-lib 6.5.1 → 6.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +10 -10
  2. package/src/cli.js +11 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/cli-lib",
3
- "version": "6.5.1",
3
+ "version": "6.5.2",
4
4
  "description": "Lib for CLI for formatjs.",
5
5
  "keywords": [
6
6
  "intl",
@@ -32,19 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@types/estree": "^1.0.0",
35
- "@types/fs-extra": "^9.0.1",
36
- "@types/json-stable-stringify": "^1.0.32",
35
+ "@types/fs-extra": "9 || 10 || 11",
36
+ "@types/json-stable-stringify": "1",
37
37
  "@types/node": "14 || 16 || 17 || 18 || 20",
38
- "chalk": "^4.0.0",
39
- "commander": "8",
40
- "fast-glob": "^3.2.7",
41
- "fs-extra": "10",
42
- "json-stable-stringify": "^1.0.1",
43
- "loud-rejection": "^2.2.0",
38
+ "chalk": "5",
39
+ "commander": "12",
40
+ "fast-glob": "3",
41
+ "fs-extra": "9 || 10 || 11",
42
+ "json-stable-stringify": "1",
43
+ "loud-rejection": "2",
44
44
  "tslib": "^2.7.0",
45
45
  "typescript": "5",
46
46
  "@formatjs/icu-messageformat-parser": "2.8.0",
47
- "@formatjs/ts-transformer": "3.13.17",
47
+ "@formatjs/ts-transformer": "3.13.18",
48
48
  "@formatjs/icu-skeleton-parser": "1.8.4"
49
49
  },
50
50
  "peerDependencies": {
package/src/cli.js CHANGED
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const commander_1 = require("commander");
5
+ const fast_glob_1 = require("fast-glob");
5
6
  const loud_rejection_1 = tslib_1.__importDefault(require("loud-rejection"));
6
- const extract_1 = tslib_1.__importDefault(require("./extract"));
7
7
  const compile_1 = tslib_1.__importDefault(require("./compile"));
8
8
  const compile_folder_1 = tslib_1.__importDefault(require("./compile_folder"));
9
- const fast_glob_1 = require("fast-glob");
10
9
  const console_utils_1 = require("./console_utils");
10
+ const extract_1 = tslib_1.__importDefault(require("./extract"));
11
11
  const KNOWN_COMMANDS = ['extract'];
12
12
  async function main(argv) {
13
13
  (0, loud_rejection_1.default)();
@@ -99,11 +99,8 @@ sentences are not translator-friendly.`)
99
99
  });
100
100
  commander_1.program
101
101
  .command('compile [translation_files...]')
102
- .description(`Compile extracted translation file into react-intl consumable JSON
103
- We also verify that the messages are valid ICU and not malformed.
104
- <translation_files> can be a glob like "foo/**/en.json"`)
105
- .option('--format <path>', `Path to a formatter file that converts \`<translation_file>\` to \`Record<string, string>\`
106
- so we can compile. The file must export a function named \`compile\` with the signature:
102
+ .description(`Compile extracted translation file into react-intl consumable JSON We also verify that the messages are valid ICU and not malformed. <translation_files> can be a glob like "foo/**/en.json"`)
103
+ .option('--format <path>', `Path to a formatter file that converts \`<translation_file>\` to \`Record<string, string>\` so we can compile. The file must export a function named \`compile\` with the signature:
107
104
  \`\`\`
108
105
  type CompileFn = <T = Record<string, MessageDescriptor>>(
109
106
  msgs: T
@@ -111,15 +108,11 @@ type CompileFn = <T = Record<string, MessageDescriptor>>(
111
108
  \`\`\`
112
109
  This is especially useful to convert from a TMS-specific format back to react-intl format
113
110
  `)
114
- .option('--out-file <path>', `Compiled translation output file.
115
- If this is not provided, result will be printed to stdout`)
116
- .option('--ast', `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages
117
- for more information`)
111
+ .option('--out-file <path>', `Compiled translation output file. If this is not provided, result will be printed to stdout`)
112
+ .option('--ast', `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages for more information`)
118
113
  .option('--skip-errors', `Whether to continue compiling messages after encountering an error. Any keys with errors will not be included in the output file.`)
119
- .option('--pseudo-locale <pseudoLocale>', `Whether to generate pseudo-locale files. See https://formatjs.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values.
120
- "--ast" is required for this to work.`)
121
- .option('--ignore-tag', `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow
122
- simple tags without any attributes.`)
114
+ .option('--pseudo-locale <pseudoLocale>', `Whether to generate pseudo-locale files. See https://formatjs.io/docs/tooling/cli#--pseudo-locale-pseudolocale for possible values. "--ast" is required for this to work.`)
115
+ .option('--ignore-tag', `Whether the parser to treat HTML/XML tags as string literal instead of parsing them as tag token. When this is false we only allow simple tags without any attributes.`)
123
116
  .action(async (filePatterns, opts) => {
124
117
  (0, console_utils_1.debug)('File pattern:', filePatterns);
125
118
  (0, console_utils_1.debug)('Options:', opts);
@@ -132,11 +125,8 @@ simple tags without any attributes.`)
132
125
  });
133
126
  commander_1.program
134
127
  .command('compile-folder <folder> <outFolder>')
135
- .description(`Batch compile all extracted translation JSON files in <folder> to <outFolder> containing
136
- react-intl consumable JSON. We also verify that the messages are
137
- valid ICU and not malformed.`)
138
- .option('--format <path>', `Path to a formatter file that converts JSON files in \`<folder>\` to \`Record<string, string>\`
139
- so we can compile. The file must export a function named \`compile\` with the signature:
128
+ .description(`Batch compile all extracted translation JSON files in <folder> to <outFolder> containing react-intl consumable JSON. We also verify that the messages are valid ICU and not malformed.`)
129
+ .option('--format <path>', `Path to a formatter file that converts JSON files in \`<folder>\` to \`Record<string, string>\` so we can compile. The file must export a function named \`compile\` with the signature:
140
130
  \`\`\`
141
131
  type CompileFn = <T = Record<string, MessageDescriptor>>(
142
132
  msgs: T
@@ -144,8 +134,7 @@ type CompileFn = <T = Record<string, MessageDescriptor>>(
144
134
  \`\`\`
145
135
  This is especially useful to convert from a TMS-specific format back to react-intl format
146
136
  `)
147
- .option('--ast', `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages
148
- for more information`)
137
+ .option('--ast', `Whether to compile to AST. See https://formatjs.io/docs/guides/advanced-usage#pre-parsing-messages for more information`)
149
138
  .action(async (folder, outFolder, opts) => {
150
139
  (0, console_utils_1.debug)('Folder:', folder);
151
140
  (0, console_utils_1.debug)('Options:', opts);