Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit 59d7f20

Browse files
committed
Change build-locales.js to have less knowlerge on expected files structure
1 parent e264fba commit 59d7f20

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

build-locales.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const locales = fs
88

99
const [basename] = __filename.split('/').reverse();
1010

11-
code = `
12-
// WARNING: This file is generated by ${basename}. Please do not modify it directly (including formatting).
11+
process.stdout.write(`
12+
// WARNING: This code is generated by ${basename}. Please do not modify it directly (including formatting).
1313
export const locales: string[] = ${JSON.stringify(locales, undefined, 4)};
14-
`;
15-
16-
fs.writeFileSync(__dirname + '/src/locales.ts', Buffer.from(code));
14+
`);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"clean": "rimraf dist/* *.tsbuildinfo",
3030
"prebuild": "npm run clean && npm run build:locales && npm run prettier:check",
3131
"build": "npm run intl:compile && npm run build:esm && npm run build:cjs",
32-
"build:locales": "node ./build-locales.js && prettier --write ./src/locales.ts",
32+
"build:locales": "node ./build-locales.js > ./src/locales.ts && prettier --write ./src/locales.ts",
3333
"build:esm": "tsc --project tsconfig.esm.json && babel --config-file=./babel.esm.js src/ --extensions=.ts --out-dir=dist/esm/ --out-file-extension=.mjs",
3434
"build:cjs": "tsc --project tsconfig.cjs.json && babel --config-file=./babel.cjs.js src/ --extensions=.ts --out-dir=dist/cjs/",
3535
"watch": "tsc --watch --preserveWatchOutput --project .",

src/locales.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: This file is generated by build-locales.js. Please do not modify it directly (including formatting).
1+
// WARNING: This code is generated by build-locales.js. Please do not modify it directly (including formatting).
22
export const locales: string[] = [
33
'af',
44
'ar',

0 commit comments

Comments
 (0)