Skip to content

Commit d6bfa5d

Browse files
Merge pull request #19897 from mozilla/FXA-12878
fix(storybook): dedup locale files in build output
2 parents 8f6bb44 + 832cb1f commit d6bfa5d

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

libs/accounts/email-renderer/.storybook/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ export default {
1010
options: {},
1111
},
1212
stories: ['../src/**/*.stories.ts'],
13-
staticDirs:
14-
process.env.STORYBOOK_BUILD !== 'true' ? ['../public'] : undefined,
13+
staticDirs: process.env.STORYBOOK_BUILD === 'true' ? undefined : ['..'],
1514
addons: [
1615
'@storybook/addon-webpack5-compiler-babel',
1716
'@storybook/addon-docs',

libs/accounts/email-renderer/project.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"dependsOn": ["l10n-merge", "build-css", "build-ts"],
6363
"options": {
6464
"commands": [
65-
"nx run accounts-email-renderer:build-storybook-only",
65+
"STORYBOOK_BUILD=true nx run accounts-email-renderer:build-storybook-only",
6666
"nx run accounts-email-renderer:build-storybook-copy-locales",
6767
"nx run accounts-email-renderer:build-storybook-copy-templates"
6868
],
@@ -97,7 +97,7 @@
9797
},
9898
"storybook": {
9999
"executor": "@nx/storybook:storybook",
100-
"dependsOn": ["build-css", "build-ts"],
100+
"dependsOn": ["l10n-merge", "build-css", "build-ts"],
101101
"options": {
102102
"port": 4400,
103103
"configDir": "libs/accounts/email-renderer/.storybook",
@@ -116,7 +116,10 @@
116116
"cwd": "."
117117
},
118118
"inputs": ["{projectRoot}/gruntfile.js", "{projectRoot}/src/**/en.ftl"],
119-
"outputs": ["{projectRoot}/public/locales/en/branding.ftl", "{projectRoot}/public/locales/en/emails.ftl"]
119+
"outputs": [
120+
"{projectRoot}/public/locales/en/branding.ftl",
121+
"{projectRoot}/public/locales/en/emails.ftl"
122+
]
120123
},
121124
"l10n-merge": {
122125
"dependsOn": ["l10n-prime"],

nx.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"cache": true
2222
},
2323
"build-storybook": {
24-
"dependsOn": ["build"],
24+
"dependsOn": ["prebuild", "^build"],
2525
"inputs": ["production", "^production"],
2626
"outputs": ["{projectRoot}/storybook-static"],
2727
"cache": true
@@ -141,9 +141,7 @@
141141
},
142142
"l10n-prime": {
143143
"inputs": ["{workspaceRoot}/external/l10n/**/*.@(ftl)"],
144-
"outputs": [
145-
"{projectRoot}/public"
146-
],
144+
"outputs": ["{projectRoot}/public"],
147145
"cache": true
148146
},
149147
"@nx/jest:jest": {
@@ -257,9 +255,7 @@
257255
"buildDepsTargetName": "build-deps",
258256
"watchDepsTargetName": "watch-deps"
259257
},
260-
"exclude": [
261-
"packages/**/*"
262-
]
258+
"exclude": ["packages/**/*"]
263259
}
264260
],
265261
"tui": {

packages/fxa-react/.storybook/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
module.exports = {
66
stories: ['../**/*.stories.tsx'],
7+
staticDirs: ['../public'],
78
core: {
89
builder: 'webpack5',
910
},

packages/fxa-react/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
"build": "nx build-l10n && nx build-css && nx build-ts",
1717
"build-css": "npx tailwindcss -i ./styles/tailwind.css -o ./styles/tailwind.out.css",
1818
"build-ts": "tsc --build && tsc-alias",
19-
"build-storybook": "NODE_ENV=production yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/locales ./storybook-static/locales",
20-
"build-l10n": "nx l10n-merge && nx l10n-merge-test",
19+
"build-storybook": "nx build-l10n && NODE_ENV=production yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build",
20+
"build-l10n": "nx l10n-merge && nx l10n-bundle && nx l10n-merge-test",
2121
"compile": "nx build-ts",
2222
"clean": "rimraf dist",
23+
"l10n-bundle": "yarn l10n:bundle packages/fxa-react branding,react",
2324
"l10n-prime": "yarn l10n:prime packages/fxa-react",
2425
"l10n-merge": "yarn grunt merge-ftl",
2526
"l10n-merge-test": "yarn grunt merge-ftl:test",

packages/fxa-settings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build-static": "yarn grunt hash-static",
1010
"build-ts": "tsc --build",
1111
"build-css": "NODE_ENV=production tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
12-
"build-storybook": "NODE_ENV=production STORYBOOK_BUILD=1 yarn build-css && NODE_OPTIONS=--openssl-legacy-provider sb build && cp -r public/locales ./storybook-static/locales",
12+
"build-storybook": "nx build-l10n && NODE_ENV=production STORYBOOK_BUILD=1 yarn build-css && NODE_OPTIONS=--openssl-legacy-provider sb build",
1313
"build-l10n": "nx l10n-merge && nx l10n-bundle && nx l10n-merge-test",
1414
"build-react": "nx build-react-dev && nx build-react-stage && nx build-react-prod",
1515
"build-react-dev": "SKIP_PREFLIGHT_CHECK=true INLINE_RUNTIME_CHUNK=false NODE_OPTIONS=--openssl-legacy-provider BUILD_PATH=build/dev node scripts/build.js",

0 commit comments

Comments
 (0)