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

Commit 3106618

Browse files
author
Long Ho
committed
feat(@formatjs/cli): add --output-empty-json option
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.
1 parent a4f85ab commit 3106618

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/cli/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ Options:
4242
`intl.formatMessage({ id: 'foo', defaultMessage: 'bar',
4343
description: 'baz'})` (default: false)
4444
--ignore List of glob paths to **not** extract translations from.
45+
--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.
4546
-h, --help output usage information
4647
```

packages/cli/src/cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ async function main(argv: string[]) {
9898
].join(''),
9999
false
100100
)
101+
.option(
102+
'--output-empty-json',
103+
'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.',
104+
false
105+
)
101106
.option(
102107
'--ignore <files>',
103108
'List of glob paths to **not** extract translations from.'
@@ -122,6 +127,7 @@ async function main(argv: string[]) {
122127
removeDefaultMessage: cmdObj.removeDefaultMessage,
123128
additionalComponentNames: cmdObj.additionalComponentNames,
124129
extractFromFormatMessageCall: cmdObj.extractFromFormatMessageCall,
130+
outputEmptyJson: cmdObj.outputEmptyJson,
125131
});
126132
process.exit(0);
127133
});

0 commit comments

Comments
 (0)