Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Commit 794ea89

Browse files
author
Long Ho
committed
chore(@formatjs/cli): update CLI docs
1 parent f962fdf commit 794ea89

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

packages/babel-plugin-react-intl/test/fixtures/overrideIdFn/actual.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import React, {Component} from 'react';
2-
import {
3-
defineMessages,
4-
FormattedMessage,
5-
} from 'react-intl';
2+
import {defineMessages, FormattedMessage} from 'react-intl';
63

74
const msgs = defineMessages({
85
header: {

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Options:
3434
(default: false)
3535
--additional-component-names <comma-separated-names> Additional component names to extract messages from, e.g:
3636
`['FormattedFooBarMessage']`. **NOTE**: By default we check for
37-
the fact that `FormattedMessage` & `FormattedHTMLMessage` are
37+
the fact that `FormattedMessage` are
3838
imported from `moduleSourceName` to make sure variable alias
3939
works. This option does not do that so it's less safe.
4040
--extract-from-format-message-call Opt-in to extract from `intl.formatMessage` call with the same

packages/cli/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ async function main(argv: string[]) {
8383
'--additional-component-names <comma-separated-names>',
8484
[
8585
"Additional component names to extract messages from, e.g: `['FormattedFooBarMessage']`. ",
86-
'**NOTE**: By default we check for the fact that `FormattedMessage` & ',
87-
'`FormattedHTMLMessage` are imported from `moduleSourceName` to make sure variable alias ',
86+
'**NOTE**: By default we check for the fact that `FormattedMessage` ',
87+
'is imported from `moduleSourceName` to make sure variable alias ',
8888
"works. This option does not do that so it's less safe.",
8989
].join(''),
9090
(val: string) => val.split(',')

packages/cli/tests/extract/integration_tests/__snapshots__/index.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Options:
132132
--remove-default-message Remove \`defaultMessage\` field in generated js after extraction (default: false)
133133
--additional-component-names <comma-separated-names> Additional component names to extract messages from, e.g: \`['FormattedFooBarMessage']\`. **NOTE**: By default we check for the fact that \`FormattedMessage\` & \`FormattedHTMLMessage\` are imported from \`moduleSourceName\` to make sure variable alias works. This option does not do that so it's less safe.
134134
--extract-from-format-message-call Opt-in to extract from \`intl.formatMessage\` call with the same restrictions, e.g: has to be called with object literal such as \`intl.formatMessage({ id: 'foo', defaultMessage: 'bar', description: 'baz'})\` (default: false)
135+
--output-empty-json Output file with empty [] if src has no messages. For build systems like bazel that relies on specific output mapping, not writing out a file can cause issues. (default: false)
135136
--ignore <files> List of glob paths to **not** extract translations from.
136137
-h, --help output usage information
137138
"

packages/cli/tests/extract/unit.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ test('it passes camelCase-converted arguments to babel API', () => {
6363
require.resolve('babel-plugin-react-intl'),
6464
{
6565
...pluginOptions,
66+
outputEmptyJson: false,
6667
overrideIdFn: expect.any(Function),
6768
},
6869
],
@@ -77,7 +78,11 @@ test('it passes camelCase-converted arguments to babel API', () => {
7778
plugins: [
7879
[
7980
require.resolve('babel-plugin-react-intl'),
80-
{...pluginOptions, overrideIdFn: expect.any(Function)},
81+
{
82+
...pluginOptions,
83+
outputEmptyJson: false,
84+
overrideIdFn: expect.any(Function),
85+
},
8186
],
8287
],
8388
})

0 commit comments

Comments
 (0)