Skip to content

Commit 13c2f51

Browse files
committed
bug(auth): fix broken @fxa imports
Because: - Build finalize was clobbering js output produces by build-ts which effectively undid any tsc-aliases applied by typescript compilation This Commit: - Creates a script for copying assets and not code - Removes the build-finalize script that was clobbering assets
1 parent 38c3fe1 commit 13c2f51

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

packages/fxa-auth-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
},
1111
"scripts": {
1212
"prebuild": "nx l10n-prime && nx install-ejs",
13-
"build": "nx build-l10n && nx build-ts && nx build-css && nx build-finalize",
13+
"build": "nx build-l10n && nx build-css && nx build-ts && nx build-copy-assets",
1414
"build-l10n": "nx l10n-merge && nx l10n-merge-test",
15+
"build-copy-assets": "./scripts/copy-assets.sh",
1516
"build-css": "nx emails-scss",
1617
"build-ts": "tsc --build && tsc-alias",
17-
"build-finalize": "cp -R config public lib scripts dist/packages/fxa-auth-server",
1818
"build-storybook": "NODE_OPTIONS=--openssl-legacy-provider STORYBOOK_BUILD=true storybook build && yarn build-storybook-copy-locales && yarn build-storybook-copy-templates",
1919
"build-storybook-copy-locales": "mkdir -p ./storybook-static/public/locales && cp -R ./public/locales ./storybook-static/public",
2020
"build-storybook-copy-templates": "mkdir -p ./storybook-static/lib/senders/emails/templates && cp -R ./lib/senders/emails ./storybook-static/lib/senders",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -e
2+
3+
#Make sure all directories exist
4+
find config lib scripts bin public -type d | \
5+
xargs -L1 bash -c 'mkdir -p dist/packages/fxa-auth-server/$0'
6+
7+
# Copy all non-code files into the dist. Basically everything except javascript, typescript and shell scripts.
8+
find config lib scripts bin public -type f | \
9+
grep --invert -E "\.js$|\.ts$|\.sh" | \
10+
xargs -L1 bash -c 'cp $0 dist/packages/fxa-auth-server/$0'

packages/fxa-auth-server/tsconfig.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
"noImplicitAny": false
1515
},
1616
"include": [
17-
"bin/*", // Include bin so that it's included in `build-ts`, specifically for "tsc-alias".
18-
"lib/**/*.ts",
19-
"lib/**/*.js",
20-
"scripts/**/*.ts"
17+
// Note, we want to include javascript and type script files. This ensures
18+
// ts aliases (ie imports for @fxa/...) work.
19+
"bin/*",
20+
"config/*",
21+
"lib/**/*",
22+
"scripts/**/*"
2123
]
2224
}

0 commit comments

Comments
 (0)