feat(l10n): update l10n ftl scripts for nx apps v2

Because:

* Fluent ftl files need to be added to apps in the nx apps/ directory.

This commit:

* Updates bundle and prime scripts to support the apps/ directory, without affecting existing packages apps.

Closes #FXA-8823
This commit is contained in:
Reino Muhl 2024-03-14 10:41:02 -04:00
Родитель b781bc59a0
Коммит f80ba7ff45
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C86660FCF998897A
9 изменённых файлов: 37 добавлений и 13 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -154,6 +154,9 @@ packages/fxa-settings/legal-docs/
packages/fxa-settings/public/legal-docs
packages/fxa-settings/test/
# payments-next
apps/payments/next/public/locales
Library
.node
process.yml

Просмотреть файл

@ -18,12 +18,18 @@ if [ -z "$BUNDLES" ]; then
exit 1
fi
#Split PACKAGE by /
PACKAGE_FOLDER_ARR=(${PACKAGE//\// })
# Move to monorepo root
cd "$(dirname "$0")/../.."
# No cd necessary for apps/*
# Applications in apps/* should already be in monorepo root
if [[ "${PACKAGE_FOLDER_ARR[0]}" == "packages" ]]; then
# Move to monorepo root
cd "$(dirname "$0")/../.."
fi
# Check path is valid
target_folder="packages/$PACKAGE/$FOLDER"
target_folder="$PACKAGE/$FOLDER"
if [ ! -d "$target_folder" ]; then
echo "$PREFIX: Invalid location! The path $target_folder must exist. Did a yarn l10n:prime command get called."
exit 1

Просмотреть файл

@ -11,9 +11,18 @@ if [ -z "$PACKAGE" ]; then
exit 1
fi
# Move to monorepo root
cd "$(dirname "$0")/../.."
#Split PACKAGE by /
PACKAGE_FOLDER_ARR=(${PACKAGE//\// })
# No cd necessary for apps/*
# Applications in apps/* should already be in monorepo root
if [[ "${PACKAGE_FOLDER_ARR[0]}" == "packages" ]]; then
# Move to monorepo root
cd "$(dirname "$0")/../.."
fi
ROOT_FOLDER=$(pwd)
echo $ROOT_FOLDER
if [ ! -d "$ROOT_FOLDER/external/l10n/locale" ]; then
echo "$PREFIX: No external/l10n folder exists! Run yarn l10n:clone script first."
@ -21,7 +30,7 @@ if [ ! -d "$ROOT_FOLDER/external/l10n/locale" ]; then
fi
# Check path is valid
TARGET_FOLDER="packages/$PACKAGE/$FOLDER"
TARGET_FOLDER="$PACKAGE/$FOLDER"
rm -rf "$TARGET_FOLDER"
mkdir -p "$TARGET_FOLDER"

Просмотреть файл

@ -82,6 +82,12 @@
"l10n-merge": {
"command": "yarn grunt --gruntfile='apps/payments/next/Gruntfile.js' merge-ftl"
},
"l10n-prime": {
"command": "./_scripts/l10n/prime.sh apps/payments/next"
},
"l10n-bundle": {
"command": "./_scripts/l10n/bundle.sh apps/payments/next branding,react,payments"
},
"storybook": {
"executor": "@nx/storybook:storybook",
"options": {

Просмотреть файл

@ -26,7 +26,7 @@
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"glean-generate": "yarn glean translate ../fxa-shared/metrics/glean/fxa-backend-pings.yaml ../fxa-shared/metrics/glean/fxa-backend-metrics.yaml -f typescript_server -o lib/metrics/glean",
"glean-lint": "yarn glean glinter ../fxa-shared/metrics/glean/fxa-backend-pings.yaml ../fxa-shared/metrics/glean/fxa-backend-metrics.yaml",
"l10n-prime": "yarn l10n:prime fxa-auth-server",
"l10n-prime": "yarn l10n:prime packages/fxa-auth-server",
"l10n-merge": "yarn grunt merge-ftl",
"l10n-merge-test": "yarn grunt merge-ftl:test",
"l10n-watch": "yarn grunt watch-ftl",

Просмотреть файл

@ -15,7 +15,7 @@
"glean-generate": "yarn glean translate ../fxa-shared/metrics/glean/fxa-ui-pings.yaml ../fxa-shared/metrics/glean/fxa-ui-metrics.yaml -f javascript -o app/scripts/lib/glean",
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"l10n-create-json": "NODE_OPTIONS=--openssl-legacy-provider grunt l10n-create-json",
"l10n-prime": "yarn l10n:prime fxa-content-server",
"l10n-prime": "yarn l10n:prime packages/fxa-content-server",
"lint": "yarn lint-glean && eslint app server tests --cache",
"lint-glean": "yarn glean glinter ../fxa-shared/metrics/glean/fxa-ui-pings.yaml ../fxa-shared/metrics/glean/fxa-ui-metrics.yaml",
"start": "pm2 start pm2.config.js && yarn check:url localhost:3030/bundle/app.bundle.js",

Просмотреть файл

@ -14,8 +14,8 @@
"clean": "rimraf dist",
"l10n-merge": "yarn grunt merge-ftl",
"l10n-merge-test": "yarn grunt merge-ftl:test",
"l10n-prime": "yarn l10n:prime fxa-payments-server",
"l10n-bundle": "yarn l10n:bundle fxa-payments-server branding,react,payments",
"l10n-prime": "yarn l10n:prime packages/fxa-payments-server",
"l10n-bundle": "yarn l10n:bundle packages/fxa-payments-server branding,react,payments",
"l10n-watch": "yarn grunt watch-ftl",
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"start": "pm2 start pm2.config.js && yarn check:url localhost:3031/__lbheartbeat__",

Просмотреть файл

@ -20,7 +20,7 @@
"build-l10n": "nx l10n-merge && nx l10n-merge-test",
"compile": "nx build-ts",
"clean": "rimraf dist",
"l10n-prime": "yarn l10n:prime fxa-react",
"l10n-prime": "yarn l10n:prime packages/fxa-react",
"l10n-merge": "yarn grunt merge-ftl",
"l10n-merge-test": "yarn grunt merge-ftl:test",
"l10n-watch": "yarn grunt watch-ftl",

Просмотреть файл

@ -14,8 +14,8 @@
"clean": "rimraf dist",
"compile": "tsc --noEmit",
"gql-extract": "persistgraphql src ../../configs/gql/allowlist/fxa-settings.json --js --extension=ts ",
"l10n-bundle": "yarn l10n:bundle fxa-settings branding,react,settings",
"l10n-prime": "yarn l10n:prime fxa-settings",
"l10n-bundle": "yarn l10n:bundle packages/fxa-settings branding,react,settings",
"l10n-prime": "yarn l10n:prime packages/fxa-settings",
"l10n-merge": "yarn grunt merge-ftl",
"l10n-merge-test": "yarn grunt merge-ftl:test",
"legal-prime": "yarn legal:clone fxa-settings",