зеркало из https://github.com/mozilla/fxa.git
task(CI): Improve nx caching for CI pipelines
Because: - Not all CI operations where taking advantage of NX caches This Commit: - Adjusts nx.json config to ensure correct caching behavior - Adjusts nx.json config to ensure proper target chains. ie build is dependent on pre-build - Uses nx to directly run integration tests - Uses nx to directly run unit tests - Phases out dependency on generated .list files - Ensures 'start up' for services for functional tests is done with nx and uses nx caches. - Creates nx tags to facilitate test commands - Fixes linter errors encountered - Updates docker images to nx for builds - Updates nx ignore files
This commit is contained in:
Родитель
33ff19c697
Коммит
d96797ae6a
|
@ -45,19 +45,7 @@ else
|
||||||
echo '=============================================================================='
|
echo '=============================================================================='
|
||||||
echo 'Congrats! No changes detected on yarn.lock.'
|
echo 'Congrats! No changes detected on yarn.lock.'
|
||||||
echo '------------------------------------------------------------------------------'
|
echo '------------------------------------------------------------------------------'
|
||||||
echo 'Skipping yarn install and running postinstall directly.\n'
|
echo 'Skipping yarn install!\n'
|
||||||
echo '=============================================================================='
|
echo '=============================================================================='
|
||||||
echo -e '\n\n'
|
echo -e '\n\n'
|
||||||
|
|
||||||
|
|
||||||
# If we skip the yarn install, postinstall may still be needed on any workspace that have changed
|
|
||||||
# since the base docker image was built. We exclude wome workspaces because their post install is just
|
|
||||||
# another build call, which will be taken care of in a following step.
|
|
||||||
set -x
|
|
||||||
yarn workspaces foreach \
|
|
||||||
--topological-dev \
|
|
||||||
-piv $(cat .lists/postinstall-includes.list) \
|
|
||||||
--exclude=fxa-shared \
|
|
||||||
--exclude=fxa-auth-client \
|
|
||||||
run postinstall
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#/bin/bash -ex
|
|
||||||
|
|
||||||
# The build list should usuallytake care of this, but just to be safe, always build
|
|
||||||
# these common workspaces. Our fucntional tests, which always regardless of the change
|
|
||||||
# set now assume these workspaces have been pre-built.
|
|
||||||
yarn workspaces foreach \
|
|
||||||
-piv \
|
|
||||||
--topological-dev \
|
|
||||||
--include fxa-shared \
|
|
||||||
--include fxa-auth-client \
|
|
||||||
--include fxa-react \
|
|
||||||
run build
|
|
||||||
|
|
||||||
# Build workspaces with changes.
|
|
||||||
LIST=".lists/ts-build-includes.list"
|
|
||||||
if [[ ! -f $LIST ]]; then
|
|
||||||
echo "List isn't a valid file: $LIST"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -s .lists/$LIST ]]; then
|
|
||||||
echo "$LIST contains no operations. Exiting early!"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
yarn workspaces foreach \
|
|
||||||
-piv \
|
|
||||||
--topological-dev \
|
|
||||||
$(cat $LIST) \
|
|
||||||
--exclude fxa-shared \
|
|
||||||
--exclude fxa-auth-client \
|
|
||||||
--exclude fxa-react \
|
|
||||||
run compile
|
|
|
@ -54,6 +54,8 @@ executors:
|
||||||
resource_class: small
|
resource_class: small
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/node:18.17
|
- image: cimg/node:18.17
|
||||||
|
environment:
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# For creating docker builds
|
# For creating docker builds
|
||||||
docker-build-executor:
|
docker-build-executor:
|
||||||
|
@ -75,16 +77,18 @@ executors:
|
||||||
YARN_ENABLE_GLOBAL_CACHE: true
|
YARN_ENABLE_GLOBAL_CACHE: true
|
||||||
# Enabling hard links saves about 1.2 GB of space in the image.
|
# Enabling hard links saves about 1.2 GB of space in the image.
|
||||||
YARN_NM_MODE: hardlinks-global
|
YARN_NM_MODE: hardlinks-global
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# Contains prebuilt image with low install overhead. Perfect for the first build
|
# Contains prebuilt image with low install overhead. Perfect for the first build
|
||||||
# step, and the saving the initial a workspace state.
|
# step, and the saving the initial a workspace state.
|
||||||
build-executor:
|
build-executor:
|
||||||
docker:
|
docker:
|
||||||
- image: mozilla/fxa-circleci:ci-builder
|
- image: mozilla/fxa-circleci:ci-builder-nx
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
FIRESTORE_EMULATOR_HOST: localhost:9090
|
FIRESTORE_EMULATOR_HOST: localhost:9090
|
||||||
CUSTOMS_SERVER_URL: none
|
CUSTOMS_SERVER_URL: none
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# Contains minimal image for running common jobs like linting or unit tests.
|
# Contains minimal image for running common jobs like linting or unit tests.
|
||||||
# This image requires a restored workspace state.
|
# This image requires a restored workspace state.
|
||||||
|
@ -95,11 +99,12 @@ executors:
|
||||||
default: medium
|
default: medium
|
||||||
resource_class: << parameters.resource_class >>
|
resource_class: << parameters.resource_class >>
|
||||||
docker:
|
docker:
|
||||||
- image: mozilla/fxa-circleci:ci-test-runner
|
- image: mozilla/fxa-circleci:ci-test-runner-nx
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
FIRESTORE_EMULATOR_HOST: localhost:9090
|
FIRESTORE_EMULATOR_HOST: localhost:9090
|
||||||
CUSTOMS_SERVER_URL: none
|
CUSTOMS_SERVER_URL: none
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# A minimal image for anything job needs infrastructure. Perfect for integration tests.
|
# A minimal image for anything job needs infrastructure. Perfect for integration tests.
|
||||||
# This image requires a restored workspace state.
|
# This image requires a restored workspace state.
|
||||||
|
@ -110,7 +115,7 @@ executors:
|
||||||
default: large
|
default: large
|
||||||
resource_class: << parameters.resource_class >>
|
resource_class: << parameters.resource_class >>
|
||||||
docker:
|
docker:
|
||||||
- image: mozilla/fxa-circleci:ci-test-runner
|
- image: mozilla/fxa-circleci:ci-test-runner-nx
|
||||||
- image: cimg/mysql:8.0.28
|
- image: cimg/mysql:8.0.28
|
||||||
command: --default-authentication-plugin=mysql_native_password
|
command: --default-authentication-plugin=mysql_native_password
|
||||||
- image: jdlk7/firestore-emulator
|
- image: jdlk7/firestore-emulator
|
||||||
|
@ -122,6 +127,7 @@ executors:
|
||||||
FIRESTORE_EMULATOR_HOST: localhost:9090
|
FIRESTORE_EMULATOR_HOST: localhost:9090
|
||||||
CUSTOMS_SERVER_URL: none
|
CUSTOMS_SERVER_URL: none
|
||||||
REDIS_PASSWORD: fxa123
|
REDIS_PASSWORD: fxa123
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# For anything that needs a full stack to run and needs browsers available for
|
# For anything that needs a full stack to run and needs browsers available for
|
||||||
# ui test automation. This image requires a restored workspace state.
|
# ui test automation. This image requires a restored workspace state.
|
||||||
|
@ -132,7 +138,7 @@ executors:
|
||||||
default: large
|
default: large
|
||||||
resource_class: << parameters.resource_class >>
|
resource_class: << parameters.resource_class >>
|
||||||
docker:
|
docker:
|
||||||
- image: mozilla/fxa-circleci:ci-functional-test-runner
|
- image: mozilla/fxa-circleci:ci-functional-test-runner-nx
|
||||||
- image: redis
|
- image: redis
|
||||||
command: --requirepass fxa123
|
command: --requirepass fxa123
|
||||||
- image: memcached
|
- image: memcached
|
||||||
|
@ -161,6 +167,7 @@ executors:
|
||||||
REACT_CONVERSION_POST_VERIFY_CAD_VIA_QR_ROUTES: true
|
REACT_CONVERSION_POST_VERIFY_CAD_VIA_QR_ROUTES: true
|
||||||
CUSTOMS_SERVER_URL: none
|
CUSTOMS_SERVER_URL: none
|
||||||
REDIS_PASSWORD: fxa123
|
REDIS_PASSWORD: fxa123
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
# Contains a pre-installed fxa stack and browsers for doing ui test
|
# Contains a pre-installed fxa stack and browsers for doing ui test
|
||||||
# automation. Perfect for running smoke tests against remote targets.
|
# automation. Perfect for running smoke tests against remote targets.
|
||||||
|
@ -171,10 +178,11 @@ executors:
|
||||||
default: medium+
|
default: medium+
|
||||||
resource_class: << parameters.resource_class >>
|
resource_class: << parameters.resource_class >>
|
||||||
docker:
|
docker:
|
||||||
- image: mozilla/fxa-circleci:ci-functional-test-runner
|
- image: mozilla/fxa-circleci:ci-functional-test-runner-nx
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development
|
NODE_ENV: development
|
||||||
CUSTOMS_SERVER_URL: none
|
CUSTOMS_SERVER_URL: none
|
||||||
|
HUSKY_SKIP_INSTALL: 1
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
git-clone:
|
git-clone:
|
||||||
|
@ -236,13 +244,9 @@ commands:
|
||||||
command: |
|
command: |
|
||||||
./_scripts/l10n/clone.sh
|
./_scripts/l10n/clone.sh
|
||||||
./.circleci/base-install.sh
|
./.circleci/base-install.sh
|
||||||
./.circleci/create-lists.sh
|
|
||||||
./_scripts/create-version-json.sh
|
./_scripts/create-version-json.sh
|
||||||
yarn gql:allowlist
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ./packages/version.json
|
path: ./packages/version.json
|
||||||
- store_artifacts:
|
|
||||||
path: ./.lists
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: ./configs/gql
|
path: ./configs/gql
|
||||||
|
|
||||||
|
@ -299,23 +303,22 @@ commands:
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Linting
|
name: Linting
|
||||||
command: npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=3 -t lint
|
command: npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=2 -t lint
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
steps:
|
steps:
|
||||||
|
- run:
|
||||||
|
name: Pre building shared libraries
|
||||||
|
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx run-many -t build --projects=tag:scope:shared:lib --parallel=2
|
||||||
|
environment:
|
||||||
|
NODE_ENV: test
|
||||||
|
CI: false
|
||||||
- run:
|
- run:
|
||||||
name: Compiling TypeScript
|
name: Compiling TypeScript
|
||||||
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=1 -t compile
|
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=1 -t compile
|
||||||
|
environment:
|
||||||
report-coverage:
|
NODE_ENV: test
|
||||||
# Not currently used. But should be soon once coverage reports are fixed up.
|
CI: false
|
||||||
parameters:
|
|
||||||
list:
|
|
||||||
type: string
|
|
||||||
default: ''
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
command: ./.circleci/report-coverage.sh << parameters.list >>
|
|
||||||
|
|
||||||
run-playwright-tests:
|
run-playwright-tests:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -331,8 +334,9 @@ commands:
|
||||||
else
|
else
|
||||||
export FEATURE_FLAGS_SHOW_RECOVERY_KEY_V2=true
|
export FEATURE_FLAGS_SHOW_RECOVERY_KEY_V2=true
|
||||||
fi
|
fi
|
||||||
cd packages/functional-tests
|
cd packages/functional-tests/tests
|
||||||
TEST_FILES=$(circleci tests glob "tests/**/*.spec.ts")
|
TEST_FILES=$(circleci tests glob "./**/*.spec.ts")
|
||||||
|
cd ..
|
||||||
echo $TEST_FILES | circleci tests run --command="xargs yarn playwright test --project=<< parameters.project >>" --verbose --split-by=timings
|
echo $TEST_FILES | circleci tests run --command="xargs yarn playwright test --project=<< parameters.project >>" --verbose --split-by=timings
|
||||||
environment:
|
environment:
|
||||||
NODE_OPTIONS: --dns-result-order=ipv4first
|
NODE_OPTIONS: --dns-result-order=ipv4first
|
||||||
|
@ -358,66 +362,55 @@ commands:
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: artifacts/tests
|
path: artifacts/tests
|
||||||
|
|
||||||
ts-build:
|
build:
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
name: Build Common Typescript Packages
|
name: Build
|
||||||
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx run-many --parallel=1 -t build --projects=fxa-shared,fxa-auth-client,fxa-react
|
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx run-many -t build --parallel=2 --all --verbose
|
||||||
- run:
|
environment:
|
||||||
name: Compile Changed Typescript Packages
|
NODE_ENV: test
|
||||||
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=3 -t compile
|
CI: false
|
||||||
|
|
||||||
save-workspace:
|
save-init-workspace:
|
||||||
steps:
|
steps:
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: /home/circleci/project
|
root: /home/circleci/project
|
||||||
paths:
|
paths:
|
||||||
- .lists
|
|
||||||
- external
|
- external
|
||||||
- configs/gql/allowlist
|
|
||||||
- node_modules
|
- node_modules
|
||||||
- packages
|
- packages/**/node_modules
|
||||||
|
- packages/version.json
|
||||||
|
|
||||||
|
save-build-workspace:
|
||||||
|
steps:
|
||||||
|
- persist_to_workspace:
|
||||||
|
name: Save Build Workspace
|
||||||
|
root: /home/circleci/project
|
||||||
|
paths:
|
||||||
|
- node_modules/.cache/nx
|
||||||
|
- packages/**/dist
|
||||||
|
- packages/**/public
|
||||||
|
- packages/**/src/styles
|
||||||
|
- packages/**/styles
|
||||||
|
- packages/**/vendor
|
||||||
|
- packages/**/var
|
||||||
|
- configs/gql/allowlist
|
||||||
|
|
||||||
restore-workspace:
|
restore-workspace:
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: /home/circleci/project
|
at: /home/circleci/project
|
||||||
|
|
||||||
run-tests:
|
|
||||||
parameters:
|
|
||||||
test_name:
|
|
||||||
type: string
|
|
||||||
# Name of file in ./lists folder holding tests to execute in parallel
|
|
||||||
list:
|
|
||||||
type: string
|
|
||||||
# Controls the number of parallel operations and essentially correlates to the --jobs argument of the
|
|
||||||
# parallel command. A value of NONE, indicates the argument is not supplied at all.
|
|
||||||
# For exact usage see:
|
|
||||||
# https://www.gnu.org/software/parallel/parallel_tutorial.html#number-of-simultaneous-jobs
|
|
||||||
max_jobs:
|
|
||||||
type: string
|
|
||||||
default: 'NONE'
|
|
||||||
index:
|
|
||||||
type: integer
|
|
||||||
default: 0
|
|
||||||
total:
|
|
||||||
type: integer
|
|
||||||
default: 1
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: << parameters.test_name >>
|
|
||||||
command: ./.circleci/run-list-parallel.sh << parameters.list >> << parameters.max_jobs >> << parameters.index >>:<< parameters.total >>
|
|
||||||
- store-artifacts
|
|
||||||
|
|
||||||
fail-fast:
|
fail-fast:
|
||||||
steps:
|
steps:
|
||||||
- run: sleep 10
|
- run: sleep 10
|
||||||
- run:
|
- run:
|
||||||
name: Fail Fast
|
name: Fail Fast
|
||||||
when: on_fail
|
when: on_fail
|
||||||
command: |
|
command: echo "DISABLE"
|
||||||
echo "Canceling workflow as a step resulted in failure"
|
# command: |
|
||||||
node .circleci/cancel-jobs.mjs;
|
# echo "Canceling workflow as a step resulted in failure"
|
||||||
|
# node .circleci/cancel-jobs.mjs;
|
||||||
|
|
||||||
rebuild-check:
|
rebuild-check:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -459,7 +452,7 @@ commands:
|
||||||
docker build . \
|
docker build . \
|
||||||
-f ./project/_dev/docker/ci/Dockerfile \
|
-f ./project/_dev/docker/ci/Dockerfile \
|
||||||
--target << parameters.target >> \
|
--target << parameters.target >> \
|
||||||
-t mozilla/fxa-circleci:ci-<< parameters.target >>
|
-t mozilla/fxa-circleci:ci-<< parameters.target >>-nx
|
||||||
|
|
||||||
create-fxa-ci-images:
|
create-fxa-ci-images:
|
||||||
# Build CI images. Images are built on top of each other. Each is optimized for a specific task.
|
# Build CI images. Images are built on top of each other. Each is optimized for a specific task.
|
||||||
|
@ -488,10 +481,10 @@ commands:
|
||||||
name: Push CI Images and Extract Yarn Cache
|
name: Push CI Images and Extract Yarn Cache
|
||||||
command: |
|
command: |
|
||||||
docker login -u $DOCKER_USER_fxa_circleci -p $DOCKER_PASS_fxa_circleci
|
docker login -u $DOCKER_USER_fxa_circleci -p $DOCKER_PASS_fxa_circleci
|
||||||
.circleci/docker-copy-cache.sh mozilla/fxa-circleci:ci-builder
|
.circleci/docker-copy-cache.sh mozilla/fxa-circleci:ci-builder-nx
|
||||||
docker push mozilla/fxa-circleci:ci-test-runner
|
docker push mozilla/fxa-circleci:ci-test-runner-nx
|
||||||
docker push mozilla/fxa-circleci:ci-functional-test-runner
|
docker push mozilla/fxa-circleci:ci-functional-test-runner-nx
|
||||||
docker push mozilla/fxa-circleci:ci-builder
|
docker push mozilla/fxa-circleci:ci-builder-nx
|
||||||
wait
|
wait
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -528,7 +521,6 @@ jobs:
|
||||||
type: executor
|
type: executor
|
||||||
force-deploy:
|
force-deploy:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
|
||||||
executor: << parameters.executor >>
|
executor: << parameters.executor >>
|
||||||
steps:
|
steps:
|
||||||
# Run with layer caching to speed up builds
|
# Run with layer caching to speed up builds
|
||||||
|
@ -536,7 +528,7 @@ jobs:
|
||||||
docker_layer_caching: true
|
docker_layer_caching: true
|
||||||
- git-clone
|
- git-clone
|
||||||
- rebuild-check:
|
- rebuild-check:
|
||||||
force-deploy: << pipeline.parameters.force-deploy-fxa-ci-images >>
|
force-deploy: << parameters.force-deploy >>
|
||||||
- install-test-browsers
|
- install-test-browsers
|
||||||
- cache-restore-yarn
|
- cache-restore-yarn
|
||||||
- create-fxa-ci-images
|
- create-fxa-ci-images
|
||||||
|
@ -545,19 +537,27 @@ jobs:
|
||||||
# The initial step for many pipelines, this step installs packages and does a build on
|
# The initial step for many pipelines, this step installs packages and does a build on
|
||||||
# the code. It then stores the resulting state into a CircleCI workspace for later
|
# the code. It then stores the resulting state into a CircleCI workspace for later
|
||||||
# use.
|
# use.
|
||||||
build:
|
init:
|
||||||
executor: build-executor
|
executor: build-executor
|
||||||
resource_class: large
|
resource_class: large
|
||||||
steps:
|
steps:
|
||||||
- git-checkout
|
- git-checkout
|
||||||
- provision
|
- provision
|
||||||
- ts-build
|
- save-init-workspace
|
||||||
- save-workspace
|
|
||||||
|
build:
|
||||||
|
executor: default-executor
|
||||||
|
resource_class: large
|
||||||
|
steps:
|
||||||
|
- git-checkout
|
||||||
|
- restore-workspace
|
||||||
|
- build
|
||||||
|
- save-build-workspace
|
||||||
|
|
||||||
# Runs linter on packages that have changes.
|
# Runs linter on packages that have changes.
|
||||||
lint:
|
lint:
|
||||||
executor: default-executor
|
executor: default-executor
|
||||||
resource_class: medium
|
resource_class: small
|
||||||
steps:
|
steps:
|
||||||
- git-checkout
|
- git-checkout
|
||||||
- restore-workspace
|
- restore-workspace
|
||||||
|
@ -574,51 +574,54 @@ jobs:
|
||||||
# Runs unit tests in parallel across packages with changes.
|
# Runs unit tests in parallel across packages with changes.
|
||||||
unit-test:
|
unit-test:
|
||||||
executor: default-executor
|
executor: default-executor
|
||||||
resource_class: large
|
|
||||||
steps:
|
|
||||||
- git-checkout
|
|
||||||
- restore-workspace
|
|
||||||
- run:
|
|
||||||
name: Run unit tests
|
|
||||||
command: npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=1 -t test-unit
|
|
||||||
environment:
|
|
||||||
NODE_ENV: test
|
|
||||||
|
|
||||||
integration-test-libs:
|
|
||||||
executor: fullstack-executor
|
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
steps:
|
steps:
|
||||||
- git-checkout
|
- git-checkout
|
||||||
- restore-workspace
|
- restore-workspace
|
||||||
- wait-for-infrastructure
|
- run:
|
||||||
|
name: Build shared libs
|
||||||
|
command: NODE_OPTIONS="--max-old-space-size=7168" npx nx run-many -t build --projects=tag:scope:shared:lib --parallel=2
|
||||||
- run:
|
- run:
|
||||||
name: Run unit tests
|
name: Run unit tests
|
||||||
command: npx nx run-many -t test-integration --projects=tag:lib
|
command: npx nx affected --base=main --head=$CIRCLE_SHA1 --parallel=2 -t test-unit
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: test
|
NODE_ENV: test
|
||||||
|
CI: false
|
||||||
|
- store-artifacts
|
||||||
|
|
||||||
# Runs integration tests suites across packages with changes. Integration tests can take
|
# Runs integration tests suites across packages with changes. Integration tests can take
|
||||||
# longer to run, so this job supports splitting.
|
# longer to run, so this job supports splitting.
|
||||||
integration-test-part:
|
integration-test:
|
||||||
parameters:
|
parameters:
|
||||||
|
target:
|
||||||
|
type: string
|
||||||
|
default: -t test-integration
|
||||||
|
projects:
|
||||||
|
type: string
|
||||||
|
default: --all
|
||||||
|
parallel:
|
||||||
|
type: string
|
||||||
|
default: --parallel=1
|
||||||
|
nx_run:
|
||||||
|
type: string
|
||||||
|
default: run-many
|
||||||
resource_class:
|
resource_class:
|
||||||
type: string
|
type: string
|
||||||
default: medium
|
default: medium
|
||||||
index:
|
|
||||||
type: integer
|
|
||||||
total:
|
|
||||||
type: integer
|
|
||||||
executor: fullstack-executor
|
executor: fullstack-executor
|
||||||
|
resource_class: << parameters.resource_class >>
|
||||||
steps:
|
steps:
|
||||||
- git-checkout
|
- git-checkout
|
||||||
- restore-workspace
|
- restore-workspace
|
||||||
- wait-for-infrastructure
|
- wait-for-infrastructure
|
||||||
- run-tests:
|
- run:
|
||||||
test_name: Integration Test (many)
|
name: Run API Integration Tests
|
||||||
list: integration-test.list
|
command: |
|
||||||
max_jobs: '1'
|
npx nx << parameters.nx_run >> << parameters.parallel >> << parameters.target >> << parameters.projects >>
|
||||||
index: << parameters.index >>
|
environment:
|
||||||
total: << parameters.total >>
|
NODE_ENV: test
|
||||||
|
CI: false
|
||||||
|
- store-artifacts
|
||||||
|
|
||||||
# This job is manually triggered for now. see .circleci/README.md
|
# This job is manually triggered for now. see .circleci/README.md
|
||||||
test-content-server-remote:
|
test-content-server-remote:
|
||||||
|
@ -684,7 +687,7 @@ jobs:
|
||||||
default: large
|
default: large
|
||||||
parallelism:
|
parallelism:
|
||||||
type: integer
|
type: integer
|
||||||
default: 4
|
default: 6
|
||||||
executor: functional-test-executor
|
executor: functional-test-executor
|
||||||
resource_class: << parameters.resource_class >>
|
resource_class: << parameters.resource_class >>
|
||||||
parallelism: << parameters.parallelism >>
|
parallelism: << parameters.parallelism >>
|
||||||
|
@ -700,6 +703,8 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Start services for playwright tests
|
name: Start services for playwright tests
|
||||||
command: ./packages/functional-tests/scripts/start-services.sh
|
command: ./packages/functional-tests/scripts/start-services.sh
|
||||||
|
environment:
|
||||||
|
NODE_ENV: test
|
||||||
- run-playwright-tests:
|
- run-playwright-tests:
|
||||||
project: local
|
project: local
|
||||||
- store-artifacts
|
- store-artifacts
|
||||||
|
@ -715,6 +720,16 @@ jobs:
|
||||||
command: |
|
command: |
|
||||||
STORYBOOKS_USE_YARN_WORKSPACES=false npx github:mozilla-fxa/storybook-gcp-publisher
|
STORYBOOKS_USE_YARN_WORKSPACES=false npx github:mozilla-fxa/storybook-gcp-publisher
|
||||||
|
|
||||||
|
update-yarn-cache:
|
||||||
|
executor: default-executor
|
||||||
|
resource_class: medium+
|
||||||
|
steps:
|
||||||
|
- git-checkout
|
||||||
|
- run:
|
||||||
|
name: Base Install
|
||||||
|
command: ./.circleci/base-install.sh
|
||||||
|
- cache-save-yarn
|
||||||
|
|
||||||
# A nice way to finalize a workflow. This will also notify jira.
|
# A nice way to finalize a workflow. This will also notify jira.
|
||||||
on-complete:
|
on-complete:
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -736,75 +751,58 @@ workflows:
|
||||||
# run on PR drafts.
|
# run on PR drafts.
|
||||||
when: << pipeline.parameters.enable_test_pull_request >>
|
when: << pipeline.parameters.enable_test_pull_request >>
|
||||||
jobs:
|
jobs:
|
||||||
- build:
|
- init:
|
||||||
name: Build (PR)
|
name: Init (PR)
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /main/
|
ignore: /main/
|
||||||
tags:
|
tags:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
|
- build:
|
||||||
|
name: Build (PR)
|
||||||
|
requires:
|
||||||
|
- Init (PR)
|
||||||
- lint:
|
- lint:
|
||||||
name: Lint (PR)
|
name: Lint (PR)
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Init (PR)
|
||||||
|
post-steps:
|
||||||
|
- fail-fast
|
||||||
- compile:
|
- compile:
|
||||||
name: Compile (PR)
|
name: Compile (PR)
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Init (PR)
|
||||||
|
post-steps:
|
||||||
|
- fail-fast
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: Unit Test (PR)
|
name: Unit Test (PR)
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Build (PR)
|
||||||
post-steps:
|
post-steps:
|
||||||
- fail-fast
|
- fail-fast
|
||||||
- integration-test-part:
|
- integration-test:
|
||||||
name: Integration Test 1 (PR)
|
name: Integration Test - Frontends (PR)
|
||||||
index: 0
|
resource_class: large
|
||||||
total: 6
|
nx_run: affected --base=main --head=$CIRCLE_SHA1
|
||||||
|
projects: --exclude '*,!tag:scope:frontend'
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Build (PR)
|
||||||
- integration-test-part:
|
- integration-test:
|
||||||
name: Integration Test 2 (PR)
|
name: Integration Test - Servers (PR)
|
||||||
index: 1
|
nx_run: affected --base=main --head=$CIRCLE_SHA1
|
||||||
total: 6
|
projects: --exclude '*,!tag:scope:server'
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Build (PR)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Servers - Auth (PR)
|
||||||
- integration-test-part:
|
nx_run: affected --base=main --head=$CIRCLE_SHA1
|
||||||
name: Integration Test 3 (PR)
|
projects: --exclude '*,!tag:scope:server:auth'
|
||||||
index: 2
|
|
||||||
total: 6
|
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Build (PR)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Libraries (PR)
|
||||||
- integration-test-part:
|
nx_run: affected --base=main --head=$CIRCLE_SHA1
|
||||||
name: Integration Test 4 (PR)
|
projects: --exclude '*,!tag:scope:shared:*'
|
||||||
index: 3
|
|
||||||
total: 6
|
|
||||||
requires:
|
|
||||||
- Build (PR)
|
|
||||||
post-steps:
|
|
||||||
- fail-fast
|
|
||||||
- integration-test-part:
|
|
||||||
name: Integration Test 5 (PR)
|
|
||||||
index: 4
|
|
||||||
total: 6
|
|
||||||
requires:
|
|
||||||
- Build (PR)
|
|
||||||
post-steps:
|
|
||||||
- fail-fast
|
|
||||||
- integration-test-part:
|
|
||||||
name: Integration Test 6 (PR)
|
|
||||||
index: 5
|
|
||||||
total: 6
|
|
||||||
requires:
|
|
||||||
- Build (PR)
|
|
||||||
post-steps:
|
|
||||||
- fail-fast
|
|
||||||
- integration-test-libs:
|
|
||||||
name: Integration Test Libs (PR)
|
|
||||||
requires:
|
requires:
|
||||||
- Build (PR)
|
- Build (PR)
|
||||||
- playwright-functional-tests:
|
- playwright-functional-tests:
|
||||||
|
@ -824,10 +822,10 @@ workflows:
|
||||||
- Lint (PR)
|
- Lint (PR)
|
||||||
- Compile (PR)
|
- Compile (PR)
|
||||||
- Unit Test (PR)
|
- Unit Test (PR)
|
||||||
- Integration Test 1 (PR)
|
- Integration Test - Frontends (PR)
|
||||||
- Integration Test 2 (PR)
|
- Integration Test - Servers (PR)
|
||||||
- Integration Test 3 (PR)
|
- Integration Test - Servers - Auth (PR)
|
||||||
- Integration Test Libs (PR)
|
- Integration Test - Libraries (PR)
|
||||||
- Functional Tests - Playwright (PR)
|
- Functional Tests - Playwright (PR)
|
||||||
- Deploy Storybooks (PR)
|
- Deploy Storybooks (PR)
|
||||||
|
|
||||||
|
@ -901,6 +899,7 @@ workflows:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
|
force-deploy: << pipeline.parameters.force-deploy-fxa-ci-images >>
|
||||||
|
|
||||||
deploy_story_book:
|
deploy_story_book:
|
||||||
# This workflow is triggered after a PR lands on main. It requires approval.
|
# This workflow is triggered after a PR lands on main. It requires approval.
|
||||||
|
@ -925,6 +924,13 @@ workflows:
|
||||||
# live infrastructure.
|
# live infrastructure.
|
||||||
when: << pipeline.parameters.enable_test_and_deploy_tag >>
|
when: << pipeline.parameters.enable_test_and_deploy_tag >>
|
||||||
jobs:
|
jobs:
|
||||||
|
- init:
|
||||||
|
name: Init
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
- build:
|
- build:
|
||||||
name: Build
|
name: Build
|
||||||
filters:
|
filters:
|
||||||
|
@ -932,6 +938,8 @@ workflows:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
|
requires:
|
||||||
|
- Init
|
||||||
- lint:
|
- lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
filters:
|
filters:
|
||||||
|
@ -940,7 +948,7 @@ workflows:
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Init
|
||||||
- compile:
|
- compile:
|
||||||
name: Compile
|
name: Compile
|
||||||
filters:
|
filters:
|
||||||
|
@ -949,7 +957,7 @@ workflows:
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Init
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: Unit Test
|
name: Unit Test
|
||||||
filters:
|
filters:
|
||||||
|
@ -959,41 +967,45 @@ workflows:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Build
|
||||||
- integration-test-part:
|
- integration-test:
|
||||||
name: Integration Test 1
|
name: Integration Test - Frontends
|
||||||
|
resource_class: large
|
||||||
|
projects: --tag=scope:frontend
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
index: 0
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Build
|
||||||
- integration-test-part:
|
- integration-test:
|
||||||
name: Integration Test 2
|
name: Integration Test - Servers
|
||||||
|
projects: --tag=scope:server
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
index: 1
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Build
|
||||||
- integration-test-part:
|
- integration-test:
|
||||||
name: Integration Test 3
|
name: Integration Test - Servers - Auth
|
||||||
|
projects: --tag=scope:server:auth
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
index: 2
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Build
|
||||||
- integration-test-libs:
|
- integration-test:
|
||||||
name: Integration Test Libs
|
name: Integration Test - Libraries
|
||||||
|
projects: --tag=scope:shared*
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
requires:
|
requires:
|
||||||
- Build
|
- Build
|
||||||
- playwright-functional-tests:
|
- playwright-functional-tests:
|
||||||
|
@ -1026,10 +1038,10 @@ workflows:
|
||||||
- Lint
|
- Lint
|
||||||
- Compile
|
- Compile
|
||||||
- Unit Test
|
- Unit Test
|
||||||
- Integration Test 1
|
- Integration Test - Frontends
|
||||||
- Integration Test 2
|
- Integration Test - Servers
|
||||||
- Integration Test 3
|
- Integration Test - Servers - Auth
|
||||||
- Integration Test Libs
|
- Integration Test - Libraries
|
||||||
- Functional Tests - Playwright
|
- Functional Tests - Playwright
|
||||||
- Create FxA Image
|
- Create FxA Image
|
||||||
|
|
||||||
|
@ -1043,6 +1055,13 @@ workflows:
|
||||||
branches:
|
branches:
|
||||||
only: main
|
only: main
|
||||||
jobs:
|
jobs:
|
||||||
|
- init:
|
||||||
|
name: Init (nightly)
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: main
|
||||||
|
tags:
|
||||||
|
ignore: /.*/
|
||||||
- build:
|
- build:
|
||||||
name: Build (nightly)
|
name: Build (nightly)
|
||||||
filters:
|
filters:
|
||||||
|
@ -1050,46 +1069,41 @@ workflows:
|
||||||
only: main
|
only: main
|
||||||
tags:
|
tags:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
|
requires:
|
||||||
|
- Init (nightly)
|
||||||
- lint:
|
- lint:
|
||||||
name: Lint (nightly)
|
name: Lint (nightly)
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Init (nightly)
|
||||||
- compile:
|
- compile:
|
||||||
name: Compile (nightly)
|
name: Compile (nightly)
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Init (nightly)
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: Unit Test (nightly)
|
name: Unit Test (nightly)
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Build (nightly)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Frontends (nightly)
|
||||||
- integration-test-part:
|
resource_class: large
|
||||||
name: Integration Test 1 (nightly)
|
projects: --tag=scope:frontend
|
||||||
index: 0
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Build (nightly)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Servers (nightly)
|
||||||
- integration-test-part:
|
projects: --tag=scope:server
|
||||||
name: Integration Test 2 (nightly)
|
|
||||||
index: 1
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Build (nightly)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Servers - Auth (nightly)
|
||||||
- integration-test-part:
|
projects: --tag=scope:server:auth
|
||||||
name: Integration Test 3 (nightly)
|
target: --targets test-integration-local test-integration-remote test-integration-scripts
|
||||||
index: 2
|
|
||||||
total: 3
|
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Build (nightly)
|
||||||
post-steps:
|
- integration-test:
|
||||||
- fail-fast
|
name: Integration Test - Libraries (nightly)
|
||||||
- integration-test-libs:
|
# TODO - Get payments cart tests working
|
||||||
name: Integration Test Libs (nightly)
|
projects: --tag=scope:shared* --exclude=payments-cart
|
||||||
requires:
|
requires:
|
||||||
- Build (nightly)
|
- Build (nightly)
|
||||||
- playwright-functional-tests:
|
- playwright-functional-tests:
|
||||||
|
@ -1105,10 +1119,10 @@ workflows:
|
||||||
- Lint (nightly)
|
- Lint (nightly)
|
||||||
- Compile (nightly)
|
- Compile (nightly)
|
||||||
- Unit Test (nightly)
|
- Unit Test (nightly)
|
||||||
- Integration Test 1 (nightly)
|
- Integration Test - Frontends (nightly)
|
||||||
- Integration Test 2 (nightly)
|
- Integration Test - Servers (nightly)
|
||||||
- Integration Test 3 (nightly)
|
- Integration Test - Servers - Auth (nightly)
|
||||||
- Integration Test Libs (nightly)
|
- Integration Test - Libraries (nightly)
|
||||||
- Functional Tests - Playwright (nightly)
|
- Functional Tests - Playwright (nightly)
|
||||||
- build-and-deploy-storybooks:
|
- build-and-deploy-storybooks:
|
||||||
name: Deploy Storybooks (nightly)
|
name: Deploy Storybooks (nightly)
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
# Determine which workspaces have been modified
|
|
||||||
node .circleci/modules-to-test.js | tee packages/test.list
|
|
||||||
|
|
||||||
# Create empty files
|
|
||||||
mkdir -p .lists
|
|
||||||
touch .lists/ts-build-includes.list
|
|
||||||
touch .lists/lint.list
|
|
||||||
touch .lists/lint-includes.list
|
|
||||||
touch .lists/unit-test.list
|
|
||||||
touch .lists/unit-test-includes.list
|
|
||||||
touch .lists/integration-test.list
|
|
||||||
touch .lists/integration-test-includes.list
|
|
||||||
|
|
||||||
function genWorkspaceCmd() {
|
|
||||||
if [ -f "packages/$1/package.json" ]; then
|
|
||||||
if [[ $(cat packages/$1/package.json | jq ".scripts.\"$2\"") != null ]]; then
|
|
||||||
echo ".circleci/notify.sh 'Starting $1 -> $2' && NODE_ENV=test yarn workspace $1 run $2" >> .lists/$3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
function genIncludeArgs() {
|
|
||||||
if [ -f "packages/$1/package.json" ]; then
|
|
||||||
echo "Processing packages/$1/package.json "
|
|
||||||
if [[ $(cat packages/$1/package.json | jq ".scripts.\"$2\"") != null ]]; then
|
|
||||||
echo "--include $1" >> .lists/$3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $(cat packages/test.list) == *all* ]]; then
|
|
||||||
echo "Testing All Packages";
|
|
||||||
ls -1 packages > .lists/test.list
|
|
||||||
else
|
|
||||||
cp packages/test.list .lists/test.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Loop over test.list and look for common scripts that might be applicable to run.
|
|
||||||
while read pkg
|
|
||||||
do
|
|
||||||
|
|
||||||
# Creates a list of --include filters for yarn various workspace commands.
|
|
||||||
genIncludeArgs $pkg compile ts-build-includes.list
|
|
||||||
genIncludeArgs $pkg lint lint-includes.list
|
|
||||||
genIncludeArgs $pkg postinstall postinstall-includes.list
|
|
||||||
genIncludeArgs $pkg test-unit unit-test-includes.list
|
|
||||||
genIncludeArgs $pkg test-integration integration-test-includes.list
|
|
||||||
|
|
||||||
# Creates a list of yarn workspace commands that can be run with gnu parallels.
|
|
||||||
# This will ensure the script exists prior to generating the command.
|
|
||||||
genWorkspaceCmd $pkg test-unit unit-test.list
|
|
||||||
genWorkspaceCmd $pkg test-integration integration-test.list
|
|
||||||
|
|
||||||
done < .lists/test.list
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
LIST=$1
|
|
||||||
|
|
||||||
if [[ $LIST == "" ]]; then
|
|
||||||
echo "Missing list argument! Supply an argument. e.g. report-coverage.sh packages/unit-test-includes.list"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $LIST ]; then
|
|
||||||
echo "List isn't a valid file: $LIST"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
yarn workspaces foreach \
|
|
||||||
-piv
|
|
||||||
$(cat $LIST) \
|
|
||||||
exec '../../_scripts/report-coverage.sh $npm_package_name'
|
|
|
@ -1,105 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
LIST=$1
|
|
||||||
MAX_JOBS=$2
|
|
||||||
|
|
||||||
if [[ $1 == "" || $2 == "" ]]; then
|
|
||||||
echo "Missing arguments! Invocation should be, run-list-parallel.sh \$LIST \$MAX_JOBS \$GROUP. i.e. run-list-parallel.sh unit-test.list -1 3/4"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f .lists/$LIST ]]; then
|
|
||||||
echo "List isn't a valid file: $LIST"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -s .lists/$LIST ]]; then
|
|
||||||
echo "$LIST contains no operations. Exiting early!"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
JOBLOG="--joblog artifacts/tests/$LIST.log"
|
|
||||||
|
|
||||||
if [[ $MAX_JOBS == "NONE" ]]; then
|
|
||||||
MAX_JOBS=""
|
|
||||||
else
|
|
||||||
MAX_JOBS="-j $2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
GROUP=$3
|
|
||||||
if [[ $GROUP == "" ]]; then
|
|
||||||
INDEX=0
|
|
||||||
TOTAL=1
|
|
||||||
else
|
|
||||||
arr=(${GROUP//:/ })
|
|
||||||
INDEX=$((${arr[0]}))
|
|
||||||
TOTAL=$((${arr[1]}))
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Quick integrity check on total / index
|
|
||||||
if [[ "$TOTAL" -gt "24" ]]; then
|
|
||||||
echo "Invalid GROUP argument - $GROUP. Total groups must be be less than 24."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ "$INDEX" -lt "0" || "$INDEX" -ge "$TOTAL" ]]; then
|
|
||||||
echo "Invalid GROUP argument - $GROUP. INDEX must be positive and less than total."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Determine the total number of operaitons in the list file
|
|
||||||
TOTAL_OPERATIONS=$(cat .lists/$LIST | wc -l | sed -e 's/ //g' )
|
|
||||||
|
|
||||||
# Divide the total operations by the total parts requrested to get group size
|
|
||||||
GROUP_SIZE=$(echo "$TOTAL_OPERATIONS $TOTAL" | awk '{print $1/$2}')
|
|
||||||
FLOOR_GROUP_SIZE=$(echo "$TOTAL_OPERATIONS $TOTAL" | awk '{print int($1/$2)}')
|
|
||||||
if [[ $GROUP_SIZE != $FLOOR_GROUP_SIZE ]]; then
|
|
||||||
echo "$TOTAL groups were requested and there are $TOTAL_OPERATIONS operations. Rounding group size up to ensure no operations are lost!"
|
|
||||||
GROUP_SIZE=$(($FLOOR_GROUP_SIZE+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Split file into N parts, which will produce files like $name-aa, $name-ab, etc...
|
|
||||||
# Next determine split files postfix. 97 is the ascii character code for 'a', by adding
|
|
||||||
# our current index to this value we will get the correct postfix of the file we want
|
|
||||||
# to target.
|
|
||||||
#
|
|
||||||
# Note that we limit the value of TOTAL to 24, which ensures no more than xaa - xaz
|
|
||||||
# file parts are created.
|
|
||||||
#
|
|
||||||
split -l $GROUP_SIZE .lists/$LIST .lists/$LIST-
|
|
||||||
SPLIT_FILE=a$(printf "\x$(printf %x $((97+$INDEX)))")
|
|
||||||
echo "Running operations in parallel"
|
|
||||||
echo " - Group: $((INDEX+1)) of $TOTAL."
|
|
||||||
echo " - Operation Count: $GROUP_SIZE"
|
|
||||||
echo " - Operation list: .lists/$LIST-$SPLIT_FILE"
|
|
||||||
echo " - Max Parallelization: ${MAX_JOBS}"
|
|
||||||
|
|
||||||
|
|
||||||
# Make sure the test folder exists in the artifacts dir
|
|
||||||
mkdir -p artifacts/tests
|
|
||||||
|
|
||||||
if [[ -f .lists/$LIST-$SPLIT_FILE ]]; then
|
|
||||||
|
|
||||||
# Provide some info about what is being run. This can be helpful in the event an operation hangs.
|
|
||||||
echo " - Conducting the following operations: "
|
|
||||||
cat .lists/$LIST-$SPLIT_FILE
|
|
||||||
|
|
||||||
# This controls whether parallels writes to standard out immediately, or collects output and prints
|
|
||||||
# it all at once. When our max parallel jobs is set to 1, there is no reason to group output, and
|
|
||||||
# it's better to stream to stdout in real time. When our max parallel jobs are greater than 1, then
|
|
||||||
# streaming out results in interleaved output that is difficult to read. Another downside of group
|
|
||||||
# is that we may never see the output if a process crashes.
|
|
||||||
if [[ "$MAX_JOBS" == "-j 1" ]]; then
|
|
||||||
GROUP_ARG="--ungroup"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Executes the command in the LIST file in parallel. Some notes on options
|
|
||||||
# Setting --load let's us wait for a heavy test suite to finish before starting another one
|
|
||||||
# Setting --joblog preserves the output in a log file.
|
|
||||||
parallel $MAX_JOBS $GROUP_ARG --load 50% --halt 0 --joblog artifacts/tests/$LIST-$SPLIT_FILE.log < .lists/$LIST-$SPLIT_FILE
|
|
||||||
else
|
|
||||||
# If there weren't enough commands to split up, then the file might not be present. For example, if there
|
|
||||||
# is just one operation to run, and we've requested to split operations into two groups, then second group
|
|
||||||
# will have zero operations and therefore nothing to run.
|
|
||||||
echo "Split test file, $LIST-$SPLIT_FILE, does not exist. Exiting early!"
|
|
||||||
fi
|
|
|
@ -17,7 +17,7 @@ if grep -e "$MODULE" -e 'all' "$DIR/../packages/test.list" > /dev/null; then
|
||||||
time ./scripts/test-ci.sh
|
time ./scripts/test-ci.sh
|
||||||
else
|
else
|
||||||
# default action
|
# default action
|
||||||
time (NODE_ENV=test yarn workspace $MODULE $TEST)
|
time (NODE_ENV=test npx nx run $MODULE:$TEST)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "\n###################################"
|
echo -e "\n###################################"
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
packages/fxa-auth-server/bin/ejs.js
|
packages/fxa-auth-server/bin/ejs.js
|
||||||
|
packages/**/storybook-static
|
||||||
|
|
|
@ -33,7 +33,6 @@ secrets.json
|
||||||
.es5
|
.es5
|
||||||
.es5cache
|
.es5cache
|
||||||
/artifacts
|
/artifacts
|
||||||
/packages/test.list
|
|
||||||
.last-audit
|
.last-audit
|
||||||
.eslintcache
|
.eslintcache
|
||||||
storybooks-publish
|
storybooks-publish
|
||||||
|
@ -163,3 +162,6 @@ configs/gql/allowlist
|
||||||
|
|
||||||
# Next.js
|
# Next.js
|
||||||
.next
|
.next
|
||||||
|
|
||||||
|
|
||||||
|
tmp
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
**/.nyc_output
|
||||||
|
**/node_modules
|
||||||
|
**/browser_modules
|
||||||
|
**/.vscode
|
||||||
|
**/version.json
|
|
@ -21,5 +21,14 @@
|
||||||
},
|
},
|
||||||
"python.pythonPath": "usr/bin/python3",
|
"python.pythonPath": "usr/bin/python3",
|
||||||
"prettier.configPath": "_dev/.prettierrc",
|
"prettier.configPath": "_dev/.prettierrc",
|
||||||
"typescript.tsdk": "node_modules/typescript/lib"
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.DS_Store": true,
|
||||||
|
"**/Thumbs.db": true,
|
||||||
|
"**/storybook-static": true,
|
||||||
|
},
|
||||||
|
"cSpell.words": [
|
||||||
|
"Frontends"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,15 +25,7 @@ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||||
ENV YARN_CHECKSUM_BEHAVIOR=throw
|
ENV YARN_CHECKSUM_BEHAVIOR=throw
|
||||||
ENV FXA_AUTO_INSTALL=0
|
ENV FXA_AUTO_INSTALL=0
|
||||||
RUN _scripts/l10n/clone.sh
|
RUN _scripts/l10n/clone.sh
|
||||||
RUN yarn install --immutable; \
|
RUN yarn install --immutable;
|
||||||
yarn gql:allowlist; \
|
|
||||||
yarn workspaces foreach \
|
|
||||||
-pv \
|
|
||||||
--topological-dev \
|
|
||||||
--include fxa-shared \
|
|
||||||
--include fxa-auth-client \
|
|
||||||
--include fxa-react \
|
|
||||||
run build;
|
|
||||||
|
|
||||||
# Acts as an intermediate stage for adding the firefox install. Note,
|
# Acts as an intermediate stage for adding the firefox install. Note,
|
||||||
# that a yarn install must happen first to ensure the correct version
|
# that a yarn install must happen first to ensure the correct version
|
||||||
|
|
|
@ -12,6 +12,5 @@
|
||||||
**/artifacts
|
**/artifacts
|
||||||
**/configs
|
**/configs
|
||||||
**/temp
|
**/temp
|
||||||
|
!**/configs/gql/allowlist
|
||||||
!project/configs/gql/allowlist/
|
!**/packages/fxa-react/configs
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ done
|
||||||
# `npx yarn` because `npm i -g yarn` needs sudo
|
# `npx yarn` because `npm i -g yarn` needs sudo
|
||||||
npx yarn install
|
npx yarn install
|
||||||
npx yarn gql:allowlist
|
npx yarn gql:allowlist
|
||||||
SKIP_PREFLIGHT_CHECK=true npx yarn workspaces foreach --topological-dev --verbose run build
|
SKIP_PREFLIGHT_CHECK=true npx nx run-many -t build --all --verbose
|
||||||
|
|
||||||
# This will reduce packages to only production dependencies
|
# This will reduce packages to only production dependencies
|
||||||
npx yarn workspaces focus --production --all
|
npx yarn workspaces focus --production --all
|
||||||
|
|
|
@ -13,6 +13,7 @@ yarn gql:allowlist
|
||||||
pm2 start _dev/pm2/infrastructure.config.js
|
pm2 start _dev/pm2/infrastructure.config.js
|
||||||
|
|
||||||
echo "waiting for containers to start"
|
echo "waiting for containers to start"
|
||||||
|
|
||||||
_scripts/check-url.sh localhost:4100/health
|
_scripts/check-url.sh localhost:4100/health
|
||||||
_scripts/check-url.sh localhost:9299/api/config
|
_scripts/check-url.sh localhost:9299/api/config
|
||||||
_scripts/check-mysql.sh
|
_scripts/check-mysql.sh
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
echo "Checking for response from: $1"
|
||||||
|
|
||||||
|
|
||||||
RETRY=120
|
RETRY=120
|
||||||
for i in $(eval echo "{1..$RETRY}"); do
|
for i in $(eval echo "{1..$RETRY}"); do
|
||||||
if [ "$(curl -s -o /dev/null --silent -w "%{http_code}" http://$1)" == "${2:-200}" ]; then
|
if [ "$(curl -s -o /dev/null --silent -w "%{http_code}" http://$1)" == "${2:-200}" ]; then
|
||||||
echo "$1 took $SECONDS seconds"
|
echo "$1 responded in $SECONDS seconds"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
if [ "$i" -lt $RETRY ]; then
|
if [ "$i" -lt $RETRY ]; then
|
||||||
|
@ -11,5 +14,5 @@ for i in $(eval echo "{1..$RETRY}"); do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "giving up after $SECONDS seconds"
|
echo "Giving up after $SECONDS seconds. Failed to get response from: $1"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
start=`date +%s`
|
||||||
|
|
||||||
DIR=$(dirname "$0")
|
DIR=$(dirname "$0")
|
||||||
COMMAND=$1
|
COMMAND=$1
|
||||||
cd "$DIR/.."
|
cd "$DIR/.."
|
||||||
|
@ -10,23 +12,11 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
|
npx nx run-many -t start --all --exclude=fxa-dev-launcher --verbose;
|
||||||
|
|
||||||
echo "building shared fxa projects..."
|
end=`date +%s`
|
||||||
if ! nx run-many --targets=fxa-auth-client,fxa-react,fxa-shared --all build --verbose > artifacts/build-shared.log;
|
runtime=$((end-start))
|
||||||
then
|
|
||||||
echo -e "\n###########################################################\n"
|
|
||||||
echo "# fxa couldn't build shared projects. see ./artifacts/build-shared.log for details"
|
|
||||||
echo -e "\n###########################################################\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "${COMMAND} fxa services and nx projects..."
|
echo -e "\n###########################################################\n"
|
||||||
if nx run-many --verbose --exclude fxa-dev-launcher --exclude fxa --targets="$COMMAND" > artifacts/start.log;
|
echo "# Stack Started Successfully ! ${runtime}s"
|
||||||
then
|
echo -e "\n###########################################################\n"
|
||||||
pm2 ls
|
|
||||||
else
|
|
||||||
echo -e "\n###########################################################\n"
|
|
||||||
echo "# fxa couldn't start. see ./artifacts/start.log for details"
|
|
||||||
echo -e "\n###########################################################\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
|
@ -79,5 +79,5 @@
|
||||||
"command": "pm2 delete apps/payments/next/pm2.config.js"
|
"command": "pm2 delete apps/payments/next/pm2.config.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "payments"]
|
"tags": ["app", "payments"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "payments"]
|
"tags": ["scope:shared:lib:payments"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "payments"]
|
"tags": ["scope:shared:lib:payments"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "shared"]
|
"tags": ["scope:shared:lib"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "shared"]
|
"tags": ["scope:shared:lib"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "shared"]
|
"tags": ["scope:shared:lib"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "shared"]
|
"tags": ["scope:shared:lib"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,5 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": ["lib", "shared"]
|
"tags": ["scope:shared:lib"]
|
||||||
}
|
}
|
||||||
|
|
148
nx.json
148
nx.json
|
@ -5,33 +5,161 @@
|
||||||
"default": {
|
"default": {
|
||||||
"runner": "nx-cloud",
|
"runner": "nx-cloud",
|
||||||
"options": {
|
"options": {
|
||||||
"cacheableOperations": ["build", "lint", "test-unit", "test-integration", "e2e"],
|
"cacheableOperations": [
|
||||||
|
"build",
|
||||||
|
"build-l10n",
|
||||||
|
"build-storybook",
|
||||||
|
"compile",
|
||||||
|
"gql-copy",
|
||||||
|
"gql-extract",
|
||||||
|
"lint",
|
||||||
|
"prebuild",
|
||||||
|
"test-e2e",
|
||||||
|
"test-integration",
|
||||||
|
"test-unit"
|
||||||
|
],
|
||||||
"accessToken": "YzRhMzhiNjEtODE0OS00Njg1LTg2NDktMGJlZjBjNmJjMTc1fHJlYWQtb25seQ=="
|
"accessToken": "YzRhMzhiNjEtODE0OS00Njg1LTg2NDktMGJlZjBjNmJjMTc1fHJlYWQtb25seQ=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"targetDefaults": {
|
"targetDefaults": {
|
||||||
"build": {
|
"build": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["prebuild", "^build"],
|
||||||
"inputs": ["production", "^production"]
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/*.tsbuildinfo",
|
||||||
|
"{projectRoot}/*/.tmp",
|
||||||
|
"{projectRoot}/**/*.d.ts",
|
||||||
|
"{projectRoot}/app/i18n",
|
||||||
|
"{projectRoot}/build",
|
||||||
|
"{projectRoot}/dist",
|
||||||
|
"{projectRoot}/lib/senders/emails/css",
|
||||||
|
"{projectRoot}/locale",
|
||||||
|
"{projectRoot}/public",
|
||||||
|
"{projectRoot}/src/styles/*.css",
|
||||||
|
"{projectRoot}/test/**/*.ftl",
|
||||||
|
"{projectRoot}/test/**/client.json"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"build-storybook": {
|
||||||
|
"dependsOn": ["build"],
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": ["{projectRoot}/storybook-static"]
|
||||||
|
},
|
||||||
|
"compile": {
|
||||||
|
"dependsOn": ["^compile"],
|
||||||
|
"inputs": ["typescript", "^typescript"],
|
||||||
|
"outputs": ["{projectRoot}/build", "{projectRoot}/dist"]
|
||||||
|
},
|
||||||
|
"gql-copy": {
|
||||||
|
"dependsOn": [
|
||||||
|
{
|
||||||
|
"projects": ["fxa-settings", "fxa-admin-panel"],
|
||||||
|
"target": "gql-extract"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": ["typescript", "^typescript"],
|
||||||
|
"outputs": ["{projectRoot}/src/config/gql/allowlist"]
|
||||||
|
},
|
||||||
|
"gql-extract": {
|
||||||
|
"dependsOn": [],
|
||||||
|
"inputs": ["typescript"],
|
||||||
|
"outputs": ["{workspaceRoot}/configs/gql/allowlist"]
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
|
"inputs": ["lint", "{workspaceRoot}/.eslintrc.json"],
|
||||||
|
"outputs": ["{projectRoot}/.eslintcache"]
|
||||||
|
},
|
||||||
|
"prebuild": {
|
||||||
|
"dependsOn": ["gql-copy"],
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/public/locales",
|
||||||
|
"{projectRoot}/public/legal-docs",
|
||||||
|
"{projectRoot}/server/config/local.json",
|
||||||
|
"{projectRoot}/var",
|
||||||
|
"{projectRoot}/vendor/ejs.js",
|
||||||
|
"{workspaceRoot}/external/l10n",
|
||||||
|
"{workspaceRoot}/external/legal-docs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restart": {
|
||||||
|
"dependsOn": ["build", "^restart"],
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"dependsOn": ["build", "gen-keys", "^start"],
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"storybook": {
|
||||||
|
"dependsOn": ["build"],
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": ["{projectRoot}/storybook-static"]
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"dependsOn": ["test-unit", "test-integration", "test-e2e"],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/coverage",
|
||||||
|
"{projectRoot}/.nyc_output",
|
||||||
|
"{projectRoot}/test-results.xml"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test-e2e": {
|
||||||
|
"dependsOn": ["build"],
|
||||||
|
"inputs": ["production", "^production"],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/coverage",
|
||||||
|
"{projectRoot}/.nyc_output",
|
||||||
|
"{projectRoot}/test-results.xml"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test-integration": {
|
||||||
|
"dependsOn": ["build", "gen-keys"],
|
||||||
|
"inputs": ["test", "^test"],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/coverage",
|
||||||
|
"{projectRoot}/.nyc_output",
|
||||||
|
"{projectRoot}/test-results.xml",
|
||||||
|
"{projectRoot}/test/scripts/test_output"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"test-unit": {
|
"test-unit": {
|
||||||
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
|
"dependsOn": ["build", "gen-keys"],
|
||||||
|
"inputs": ["test", "^test"],
|
||||||
|
"outputs": [
|
||||||
|
"{projectRoot}/coverage",
|
||||||
|
"{projectRoot}/.nyc_output",
|
||||||
|
"{projectRoot}/test-results.xml"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"namedInputs": {
|
"namedInputs": {
|
||||||
"default": ["{projectRoot}/**/*", "sharedGlobals"],
|
"default": ["{projectRoot}/**/*.*", "sharedGlobals"],
|
||||||
|
"lint": ["{projectRoot}/**/*.@(js|jsx|ts|tsx)"],
|
||||||
"production": [
|
"production": [
|
||||||
"default",
|
"default",
|
||||||
|
"{workspaceRoot}/external/l10n/**/*.ftl",
|
||||||
|
"{workspaceRoot}/external/legal-docs/**/*.md",
|
||||||
"!{projectRoot}/.eslintrc.json",
|
"!{projectRoot}/.eslintrc.json",
|
||||||
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
|
"!{projectRoot}/.storybook/**/*",
|
||||||
"!{projectRoot}/tsconfig.spec.json",
|
"!{projectRoot}/**/test/**/*",
|
||||||
"!{projectRoot}/jest.config.[jt]s"
|
"!{projectRoot}/**/tests/**/*",
|
||||||
|
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx)",
|
||||||
|
"!{projectRoot}/**/*.(spec|test).@(js|jsx|ts|tsx)",
|
||||||
|
"!{projectRoot}/jest.config.@(js|ts)",
|
||||||
|
"!{projectRoot}/tsconfig.+(spec|storybook).json"
|
||||||
],
|
],
|
||||||
"sharedGlobals": []
|
"sharedGlobals": [{ "runtime": "node -v" }, { "runtime": "tsc -v" }],
|
||||||
|
"test": ["default", "{workspaceRoot}/jest.preset.js"],
|
||||||
|
"typescript": [
|
||||||
|
"{projectRoot}/**/*.@(ts|tsx)",
|
||||||
|
"{projectRoot}/package.json",
|
||||||
|
"{projectRoot}/tsconfig.*",
|
||||||
|
"sharedGlobals"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
"packageManager": "yarn"
|
"packageManager": "yarn"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"stop": "nps --prefix=stop",
|
"stop": "nps --prefix=stop",
|
||||||
"restart": "nps --prefix=restart",
|
"restart": "nps --prefix=restart",
|
||||||
"delete": "nps --prefix=delete",
|
"delete": "nps --prefix=delete",
|
||||||
"rebuild-packages": "yarn workspaces foreach run build",
|
"rebuild-packages": "nx run-many -t build --all",
|
||||||
"adb-reverse": "./_scripts/adb-reverse.sh",
|
"adb-reverse": "./_scripts/adb-reverse.sh",
|
||||||
"test": "_scripts/test-package.sh",
|
"test": "_scripts/test-package.sh",
|
||||||
"config-fxios": "node _scripts/config-fxios.js",
|
"config-fxios": "node _scripts/config-fxios.js",
|
||||||
|
@ -24,7 +24,9 @@
|
||||||
"l10n:prime": "_scripts/l10n/prime.sh",
|
"l10n:prime": "_scripts/l10n/prime.sh",
|
||||||
"l10n:bundle": "_scripts/l10n/bundle.sh",
|
"l10n:bundle": "_scripts/l10n/bundle.sh",
|
||||||
"legal:clone": "_scripts/clone-legal-docs.sh",
|
"legal:clone": "_scripts/clone-legal-docs.sh",
|
||||||
"gql:allowlist": "nx run-many -t extract-gql && nx run-many -t copy-gql"
|
"gql:allowlist": "nx run-many -t gql-extract && nx run-many -t gql-copy",
|
||||||
|
"check:mysql": "_scripts/check-mysql.sh",
|
||||||
|
"check:url": "_scripts/check-url.sh"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/mozilla/fxa",
|
"homepage": "https://github.com/mozilla/fxa",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
@ -44,5 +44,10 @@
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:demo"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,10 @@
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js"
|
"delete": "pm2 delete pm2.config.js"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:server"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"description": "eslint plugin for Firefox Accounts",
|
"description": "eslint plugin for Firefox Accounts",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha"
|
"test": "mocha",
|
||||||
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eslint": "6.6.0",
|
"eslint": "6.6.0",
|
||||||
|
@ -26,5 +27,10 @@
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/mozilla/fxa/issues"
|
"url": "https://github.com/mozilla/fxa/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/mozilla/fxa"
|
"homepage": "https://github.com/mozilla/fxa",
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared:plugin"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,5 +44,10 @@
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:demo"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"clean": "rimraf dist",
|
||||||
"record": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stub --debug",
|
"record": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stub --debug",
|
||||||
"test": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
"test": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
||||||
"test-local": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
"test-local": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
||||||
"test-stage": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stage",
|
"test-stage": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stage",
|
||||||
"test-production": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=production"
|
"test-production": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=production",
|
||||||
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.34.1",
|
"@playwright/test": "^1.34.1",
|
||||||
|
@ -19,5 +21,10 @@
|
||||||
"jsqr": "^1.4.0",
|
"jsqr": "^1.4.0",
|
||||||
"pdf-parse": "^1.1.1",
|
"pdf-parse": "^1.1.1",
|
||||||
"upng-js": "^2.1.0"
|
"upng-js": "^2.1.0"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:functional-test"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,13 @@ cd "$DIR/../../../"
|
||||||
|
|
||||||
mkdir -p ~/.pm2/logs
|
mkdir -p ~/.pm2/logs
|
||||||
mkdir -p artifacts/tests
|
mkdir -p artifacts/tests
|
||||||
CI=true npx nx run-many -p \
|
|
||||||
|
# Make sure we have built the latest
|
||||||
|
CI=false NODE_ENV=test npx nx run-many \
|
||||||
|
-t start \
|
||||||
|
--parallel=1 \
|
||||||
|
--verbose \
|
||||||
|
-p \
|
||||||
123done \
|
123done \
|
||||||
browserid-verifier \
|
browserid-verifier \
|
||||||
fxa-auth-server \
|
fxa-auth-server \
|
||||||
|
@ -18,16 +24,6 @@ CI=true npx nx run-many -p \
|
||||||
fxa-payments-server \
|
fxa-payments-server \
|
||||||
fxa-profile-server \
|
fxa-profile-server \
|
||||||
fxa-settings \
|
fxa-settings \
|
||||||
-t start > ~/.pm2/logs/startup.log
|
> ~/.pm2/logs/startup.log
|
||||||
|
|
||||||
# stop services that aren't needed. These are 'watching' services, and they just
|
|
||||||
# consume memory. Ideally, we wouldn't even start these, but they are baked into
|
|
||||||
# the pm2 config start up.
|
|
||||||
npx pm2 stop auth-ftl &
|
|
||||||
npx pm2 stop settings-css &
|
|
||||||
npx pm2 stop settings-ftl &
|
|
||||||
npx pm2 stop payments-css &
|
|
||||||
npx pm2 stop payments-ftl &
|
|
||||||
wait
|
|
||||||
|
|
||||||
npx pm2 ls
|
npx pm2 ls
|
||||||
|
|
|
@ -3,24 +3,25 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "FxA Admin Panel",
|
"description": "FxA Admin Panel",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build": "yarn build-ts-server && yarn build-ts-client && yarn build-css && yarn build-react",
|
||||||
|
"build-ts-client": "tsc --build",
|
||||||
|
"build-ts-server": "tsc -p server/tsconfig.json",
|
||||||
"build-css": "npx tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
|
"build-css": "npx tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
|
||||||
"build-client": "tsc --build ../fxa-react && tsc --build && NODE_ENV=production yarn build-css && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
"build-react": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||||
"build-server": "tsc -p server/tsconfig.json",
|
"clean": "rimraf dist",
|
||||||
"extract-gql": "persistgraphql src ../../configs/gql/allowlist/fxa-admin-panel.json --js --extension=ts",
|
|
||||||
"build": "yarn build-client && yarn build-server",
|
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||||
|
"gql-extract": "persistgraphql src ../../configs/gql/allowlist/fxa-admin-panel.json --js --extension=ts",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"restart": "tsc --build ../fxa-react && yarn build-css && pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"start": "tsc --build ../fxa-react && yarn build-css && pm2 start pm2.config.js",
|
"start": "pm2 start pm2.config.js",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
|
"test": "yarn test-unit",
|
||||||
"test-frontend": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-frontend.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --coverage --verbose --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
"test-frontend": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-frontend.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --coverage --verbose --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||||
"test-server": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-server.xml jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
"test-server": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-server.xml jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||||
"test": "CI=true yarn test-frontend && CI=true yarn test-server",
|
"test-unit": "CI=true yarn test-frontend && CI=true yarn test-server"
|
||||||
"test-unit": "yarn build-css && yarn build-client && yarn test",
|
|
||||||
"test-integration": "echo No integration tests present for $npm_package_name"
|
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
@ -86,5 +87,10 @@
|
||||||
"ts-jest": "^29.1.0",
|
"ts-jest": "^29.1.0",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"webpack": "^5.84.1"
|
"webpack": "^5.84.1"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:frontend"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
|
|
||||||
yarn build
|
npx nx fxa-admin-panel:build
|
||||||
NODE_ENV=test yarn test
|
NODE_ENV=test npx nx fxa-admin-panel:test
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "FxA GraphQL Admin Server",
|
"description": "FxA GraphQL Admin Server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist && yarn gql:allowlist",
|
"prebuild": "yarn clean",
|
||||||
"copy-gql": "mkdir -p src/config/gql/allowlist && cp ../../configs/gql/allowlist/*.json src/config/gql/allowlist/.",
|
"gql-copy": "mkdir -p src/config/gql/allowlist/ && cp ../../configs/gql/allowlist/*.json src/config/gql/allowlist/.",
|
||||||
|
"build": "nest build && yarn copy-config && yarn gql-copy",
|
||||||
"copy-config": "cp ./src/config/*.json ./dist/packages/fxa-admin-server/src/config",
|
"copy-config": "cp ./src/config/*.json ./dist/packages/fxa-admin-server/src/config",
|
||||||
"build": "yarn prebuild && nest build && yarn copy-config",
|
"clean": "rimraf dist",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||||
"start": "yarn build && pm2 start pm2.config.js",
|
"start": "pm2 start pm2.config.js",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"start-prod": "node dist/packages/fxa-graphql-api/src/main",
|
"start-prod": "node dist/packages/fxa-graphql-api/src/main",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
|
@ -104,5 +105,10 @@
|
||||||
},
|
},
|
||||||
"coverageDirectory": "../coverage",
|
"coverageDirectory": "../coverage",
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:server"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ const PATH = process.env.PATH.split(':')
|
||||||
|
|
||||||
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
||||||
const getDevScript = () => `${nest} start --debug=9150 --watch`;
|
const getDevScript = () => `${nest} start --debug=9150 --watch`;
|
||||||
const getProdScript = () =>
|
const getProdScript = () => 'node dist/packages/fxa-admin-server/src/main.js';
|
||||||
'rm -rf dist && yarn build && node dist/packages/fxa-admin-server/src/main.js';
|
|
||||||
const script =
|
const script =
|
||||||
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
||||||
? getProdScript()
|
? getProdScript()
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"postinstall": "(tsc --build tsconfig.browser.json && tsc --build && tsc --build tsconfig.cjs.json) || true",
|
"build": "yarn build-ts",
|
||||||
"build": "tsc --build tsconfig.browser.json && tsc --build && tsc --build tsconfig.cjs.json",
|
"build-ts": "tsc --build tsconfig.browser.json && tsc --build tsconfig.cjs.json && tsc --build",
|
||||||
"compile": "tsc --noEmit",
|
"clean": "rimraf dist",
|
||||||
"ts-check": "tsc --noEmit",
|
"compile": "yarn build-ts",
|
||||||
"test": "mocha -r esbuild-register test/*",
|
"test": "mocha -r esbuild-register test/*",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||||
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register test/*",
|
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register test/*",
|
||||||
|
@ -72,5 +72,10 @@
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"reporter": "mocha-multi",
|
"reporter": "mocha-multi",
|
||||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared:lib"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,30 +9,37 @@
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn merge-ftl && yarn emails-scss && tsc --build && tsc-alias && cp -R config public lib scripts dist/packages/fxa-auth-server",
|
"prebuild": "nx l10n-prime && nx install-ejs",
|
||||||
"clean": "git clean -fXd",
|
"build": "nx build-l10n && nx build-ts && nx build-css && nx build-finalize",
|
||||||
|
"build-l10n": "nx l10n-merge && nx l10n-merge-test",
|
||||||
|
"build-css": "nx emails-scss",
|
||||||
|
"build-ts": "tsc --build && tsc-alias",
|
||||||
|
"build-finalize": "cp -R config public lib scripts dist/packages/fxa-auth-server",
|
||||||
|
"build-storybook": "NODE_OPTIONS=--openssl-legacy-provider STORYBOOK_BUILD=true storybook build && yarn build-storybook-copy-locales && yarn build-storybook-copy-templates",
|
||||||
|
"build-storybook-copy-locales": "mkdir -p ./storybook-static/public/locales && cp -R ./public/locales ./storybook-static/public",
|
||||||
|
"build-storybook-copy-templates": "mkdir -p ./storybook-static/lib/senders/emails/templates && cp -R ./lib/senders/emails ./storybook-static/lib/senders",
|
||||||
|
"bump-template-versions": "node scripts/template-version-bump",
|
||||||
|
"clean": "rimraf dist",
|
||||||
|
"clean-up-old-ci-stripe-customers": "node -r esbuild-register ./scripts/clean-up-old-ci-stripe-customers.js --limit 1000",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"create-mock-iap": "NODE_ENV=dev FIRESTORE_EMULATOR_HOST=localhost:9090 node -r esbuild-register ./scripts/create-mock-iap-subscriptions.ts",
|
"create-mock-iap": "NODE_ENV=dev FIRESTORE_EMULATOR_HOST=localhost:9090 node -r esbuild-register ./scripts/create-mock-iap-subscriptions.ts",
|
||||||
"bump-template-versions": "node scripts/template-version-bump",
|
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"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-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",
|
"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 fxa-auth-server",
|
||||||
|
"l10n-merge": "yarn grunt merge-ftl",
|
||||||
|
"l10n-merge-test": "yarn grunt merge-ftl:test",
|
||||||
|
"l10n-watch": "yarn grunt watch-ftl",
|
||||||
"lint": "yarn glean-lint && eslint . .storybook --ext .js,.ts",
|
"lint": "yarn glean-lint && eslint . .storybook --ext .js,.ts",
|
||||||
"start": "yarn merge-ftl && yarn emails-scss && scripts/start-local.sh",
|
"install-ejs": "./scripts/install-ejs.sh",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
|
||||||
"restart": "pm2 restart pm2.config.js",
|
|
||||||
"delete": "pm2 delete pm2.config.js",
|
|
||||||
"test": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 scripts/test-local.sh",
|
|
||||||
"test-ci": "yarn merge-ftl-test && scripts/test-local.sh && yarn test-e2e",
|
|
||||||
"test-unit": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=unit scripts/test-ci.sh",
|
|
||||||
"test-integration": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=integration scripts/test-ci.sh",
|
|
||||||
"test-e2e": "NODE_ENV=dev mocha -r esbuild-register test/e2e",
|
|
||||||
"test-scripts": "NODE_ENV=dev mocha -r esbuild-register test/scripts --exit",
|
|
||||||
"test-remote": "MAILER_HOST=restmail.net MAILER_PORT=80 CORS_ORIGIN=http://baz mocha -r esbuild-register --timeout=300000 test/remote",
|
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
|
||||||
"gen-keys": "node -r esbuild-register ./scripts/gen_keys.js; node -r esbuild-register ./scripts/oauth_gen_keys.js; node -r esbuild-register ./scripts/gen_vapid_keys.js",
|
"gen-keys": "node -r esbuild-register ./scripts/gen_keys.js; node -r esbuild-register ./scripts/oauth_gen_keys.js; node -r esbuild-register ./scripts/gen_vapid_keys.js",
|
||||||
"clean-up-old-ci-stripe-customers": "node -r esbuild-register ./scripts/clean-up-old-ci-stripe-customers.js --limit 1000",
|
"emails-scss": "node -r esbuild-register ./lib/senders/emails/sass-compile-files.ts",
|
||||||
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||||
|
"start": "yarn check:mysql && pm2 start pm2.config.js && yarn check:url localhost:9000/__heartbeat__",
|
||||||
|
"restart": "pm2 restart pm2.config.js",
|
||||||
|
"test": "VERIFIER_VERSION=0 scripts/test-local.sh",
|
||||||
|
"test-unit": "VERIFIER_VERSION=0 TEST_TYPE=unit scripts/test-ci.sh",
|
||||||
|
"test-integration": "VERIFIER_VERSION=0 TEST_TYPE=integration scripts/test-ci.sh",
|
||||||
"populate-firestore-customers": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/populate-firestore-customers.ts",
|
"populate-firestore-customers": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/populate-firestore-customers.ts",
|
||||||
"populate-vat-taxes": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/populate-vat-taxes.ts",
|
"populate-vat-taxes": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/populate-vat-taxes.ts",
|
||||||
"paypal-processor": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/paypal-processor.ts",
|
"paypal-processor": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/paypal-processor.ts",
|
||||||
|
@ -40,15 +47,10 @@
|
||||||
"subscription-reminders": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/subscription-reminders.ts",
|
"subscription-reminders": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/subscription-reminders.ts",
|
||||||
"audit-orphaned-stripe-accounts": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/audit-orphaned-customers.ts",
|
"audit-orphaned-stripe-accounts": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/audit-orphaned-customers.ts",
|
||||||
"remove-unverified-accounts": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/remove-unverified-accounts.ts",
|
"remove-unverified-accounts": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/remove-unverified-accounts.ts",
|
||||||
"emails-scss": "node -r esbuild-register ./lib/senders/emails/sass-compile-files.ts",
|
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6010 --no-version-updates -s ./",
|
||||||
"storybook": "yarn l10n-prime && yarn install-ejs && yarn emails-scss && NODE_OPTIONS=--openssl-legacy-provider storybook dev -p 6010 --no-version-updates ",
|
"merge-ftl": "nx l10n-merge",
|
||||||
"build-storybook": "yarn l10n-prime && yarn install-ejs && yarn emails-scss && NODE_OPTIONS=--openssl-legacy-provider STORYBOOK_BUILD=true storybook build && yarn build-storybook-copy-locales && yarn build-storybook-copy-templates",
|
"merge-ftl-test": "nx l10n-merge",
|
||||||
"build-storybook-copy-locales": "mkdir -p ./storybook-static/public/locales && cp -R ./public/locales ./storybook-static/public",
|
"watch-ftl": "nx l10n-watch"
|
||||||
"build-storybook-copy-templates": "mkdir -p ./storybook-static/lib/senders/emails/templates && cp -R ./lib/senders/emails ./storybook-static/lib/senders",
|
|
||||||
"install-ejs": "./scripts/install-ejs.sh",
|
|
||||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl",
|
|
||||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
|
||||||
"watch-ftl": "yarn grunt watch-ftl"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -231,5 +233,10 @@
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"reporter": "mocha-multi",
|
"reporter": "mocha-multi",
|
||||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:server:auth"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,7 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
const apps = [
|
||||||
apps: [
|
|
||||||
{
|
{
|
||||||
name: 'auth',
|
name: 'auth',
|
||||||
script: 'node -r esbuild-register bin/key_server.js',
|
script: 'node -r esbuild-register bin/key_server.js',
|
||||||
|
@ -37,15 +36,6 @@ module.exports = {
|
||||||
min_uptime: '2m',
|
min_uptime: '2m',
|
||||||
time: true,
|
time: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'auth-ftl',
|
|
||||||
script: 'yarn grunt watch-ftl',
|
|
||||||
cwd: __dirname,
|
|
||||||
filter_env: ['npm_'],
|
|
||||||
max_restarts: '1',
|
|
||||||
min_uptime: '2m',
|
|
||||||
time: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'inbox',
|
name: 'inbox',
|
||||||
script: 'node -r esbuild-register test/mail_helper.js',
|
script: 'node -r esbuild-register test/mail_helper.js',
|
||||||
|
@ -61,5 +51,20 @@ module.exports = {
|
||||||
min_uptime: '2m',
|
min_uptime: '2m',
|
||||||
time: true,
|
time: true,
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
|
|
||||||
|
if (process.env.CI !== 'true') {
|
||||||
|
apps.push({
|
||||||
|
name: 'auth-ftl',
|
||||||
|
script: 'yarn grunt watch-ftl',
|
||||||
|
cwd: __dirname,
|
||||||
|
filter_env: ['npm_'],
|
||||||
|
max_restarts: '1',
|
||||||
|
min_uptime: '2m',
|
||||||
|
time: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
export NODE_ENV=dev
|
|
||||||
|
|
||||||
yarn gen-keys
|
|
||||||
../../_scripts/check-mysql.sh
|
|
||||||
pm2 start pm2.config.js
|
|
||||||
|
|
||||||
../../_scripts/check-url.sh localhost:9000/__heartbeat__
|
|
|
@ -10,20 +10,13 @@ DEFAULT_ARGS="--require esbuild-register --require tsconfig-paths/register --rec
|
||||||
if [ "$TEST_TYPE" == 'unit' ]; then GREP_TESTS="--grep #integration --invert "; fi;
|
if [ "$TEST_TYPE" == 'unit' ]; then GREP_TESTS="--grep #integration --invert "; fi;
|
||||||
if [ "$TEST_TYPE" == 'integration' ]; then GREP_TESTS="--grep #integration "; fi;
|
if [ "$TEST_TYPE" == 'integration' ]; then GREP_TESTS="--grep #integration "; fi;
|
||||||
|
|
||||||
node -r esbuild-register ./scripts/gen_keys.js
|
|
||||||
node -r esbuild-register ./scripts/gen_vapid_keys.js
|
|
||||||
node -r esbuild-register ./scripts/oauth_gen_keys.js
|
|
||||||
|
|
||||||
echo 'Updating ftl files'
|
|
||||||
# Migrate current strings
|
|
||||||
yarn run merge-ftl
|
|
||||||
yarn run merge-ftl-test
|
|
||||||
|
|
||||||
# Process sass for rendering of email templates
|
|
||||||
echo
|
|
||||||
yarn run emails-scss
|
|
||||||
|
|
||||||
TESTS=(local oauth remote scripts)
|
TESTS=(local oauth remote scripts)
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
TESTS=(local oauth remote scripts)
|
||||||
|
else
|
||||||
|
TESTS=($1)
|
||||||
|
fi
|
||||||
|
|
||||||
for t in "${TESTS[@]}"; do
|
for t in "${TESTS[@]}"; do
|
||||||
echo -e "\n\nTesting: $t"
|
echo -e "\n\nTesting: $t"
|
||||||
|
|
|
@ -3,24 +3,28 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Firefox Accounts Content Server",
|
"description": "Firefox Accounts Content Server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --build ../fxa-react && yarn l10n-prime && yarn build-css && NODE_ENV=production grunt build",
|
"prebuild": "yarn l10n-prime && yarn copy-local-config && yarn check-local-config ",
|
||||||
"build-css": "npx tailwindcss --postcss -i ./app/styles/tailwind.css -o ./app/styles/tailwind.out.css",
|
"build": "yarn build-l10n && yarn build-css && yarn build-js",
|
||||||
|
"build-css": "tailwindcss --postcss -i ./app/styles/tailwind.css -o ./app/styles/tailwind.out.css",
|
||||||
|
"build-js": "NODE_ENV=production grunt build",
|
||||||
|
"build-l10n": "yarn l10n-create-json",
|
||||||
|
"check-local-config": "node scripts/check-local-config",
|
||||||
|
"clean": "rimraf dist",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"clean": "git clean -fXd",
|
"copy-local-config": "cp server/config/local.json-dist server/config/local.json",
|
||||||
"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",
|
"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",
|
||||||
"glean-lint": "yarn glean glinter ../fxa-shared/metrics/glean/fxa-ui-pings.yaml ../fxa-shared/metrics/glean/fxa-ui-metrics.yaml",
|
|
||||||
"postinstall": "cp server/config/local.json-dist server/config/local.json",
|
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"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 fxa-content-server",
|
||||||
"lint": "yarn glean-lint && eslint app server tests --cache",
|
"lint": "yarn lint-glean && eslint app server tests --cache",
|
||||||
"start": "node scripts/check-local-config && yarn l10n-prime && NODE_OPTIONS=--openssl-legacy-provider grunt l10n-create-json && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:3030/bundle/app.bundle.js && yarn build-css",
|
"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",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "pm2 restart pm2.config.js && yarn build-css",
|
"restart": "pm2 restart pm2.config.js ",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"start-production": "NODE_ENV=production grunt build && yarn build-css && CONFIG_FILES=server/config/local.json,server/config/production.json,server/config/secrets.json grunt serverproc:dist",
|
"start-production": "NODE_ENV=production grunt build && yarn build-css && CONFIG_FILES=server/config/local.json,server/config/production.json,server/config/secrets.json grunt serverproc:dist",
|
||||||
"start-remote": "scripts/run_remote_dev.sh",
|
"start-remote": "scripts/run_remote_dev.sh",
|
||||||
"test": "node tests/intern.js --unit=true",
|
"test": "node tests/intern.js --unit=true",
|
||||||
"test-circle": "node tests/intern.js --suites=circle --fxaAuthRoot=https://fxaci.dev.lcip.org/auth --fxaEmailRoot=http://restmail.net --fxaOAuthApp=https://oauth-fxaci.dev.lcip.org --fxaUntrustedOauthApp=https://321done-fxaci.dev.lcip.org --fxaProduction=true --bailAfterFirstFailure=true",
|
|
||||||
"test-functional": "node tests/intern.js",
|
"test-functional": "node tests/intern.js",
|
||||||
"test-functional-oauth": "node tests/intern.js --grep='oauth'",
|
"test-functional-oauth": "node tests/intern.js --grep='oauth'",
|
||||||
"test-functional-settings": "node tests/intern.js --suites=settings",
|
"test-functional-settings": "node tests/intern.js --suites=settings",
|
||||||
|
@ -28,8 +32,6 @@
|
||||||
"test-pairing": "node tests/intern.js --suites=pairing",
|
"test-pairing": "node tests/intern.js --suites=pairing",
|
||||||
"test-pairing-circle": "node tests/intern.js --suites=pairing --fxaAuthRoot=https://fxaci.dev.lcip.org/auth --fxaEmailRoot=http://restmail.net --fxaOAuthApp=https://123done-fxaci.dev.lcip.org/ --fxaProduction=true --bailAfterFirstFailure=true",
|
"test-pairing-circle": "node tests/intern.js --suites=pairing --fxaAuthRoot=https://fxaci.dev.lcip.org/auth --fxaEmailRoot=http://restmail.net --fxaOAuthApp=https://123done-fxaci.dev.lcip.org/ --fxaProduction=true --bailAfterFirstFailure=true",
|
||||||
"test-server": "node tests/intern.js --suites=server",
|
"test-server": "node tests/intern.js --suites=server",
|
||||||
"test-unit": "echo No unit tests present for $npm_package_name",
|
|
||||||
"test-integration": "echo No integration tests present for $npm_package_name",
|
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -191,5 +193,10 @@
|
||||||
"xmlhttprequest": "^1.8.0",
|
"xmlhttprequest": "^1.8.0",
|
||||||
"yargs": "^17.0.1"
|
"yargs": "^17.0.1"
|
||||||
},
|
},
|
||||||
"readmeFilename": "README.md"
|
"readmeFilename": "README.md",
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:frontend"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
const apps = [];
|
||||||
apps: [
|
|
||||||
{
|
apps.push({
|
||||||
name: 'content',
|
name: 'content',
|
||||||
script: 'node --inspect=9130 server/bin/fxa-content-server.js',
|
script: 'node --inspect=9130 server/bin/fxa-content-server.js',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -24,13 +24,10 @@ module.exports = {
|
||||||
TRACING_SERVICE_NAME: 'fxa-content-server',
|
TRACING_SERVICE_NAME: 'fxa-content-server',
|
||||||
TRACING_CLIENT_NAME: 'fxa-content-client',
|
TRACING_CLIENT_NAME: 'fxa-content-client',
|
||||||
},
|
},
|
||||||
filter_env: ['npm_'],
|
});
|
||||||
watch: ['server'],
|
|
||||||
max_restarts: '1',
|
if (process.env.CI !== 'true') {
|
||||||
min_uptime: '2m',
|
apps.push({
|
||||||
time: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'content-css',
|
name: 'content-css',
|
||||||
script: 'yarn build-css',
|
script: 'yarn build-css',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -53,6 +50,9 @@ module.exports = {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
],
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,27 +15,17 @@ cd ../../
|
||||||
mkdir -p ~/.pm2/logs
|
mkdir -p ~/.pm2/logs
|
||||||
mkdir -p artifacts/tests
|
mkdir -p artifacts/tests
|
||||||
|
|
||||||
CI=true yarn workspaces foreach \
|
CI=false NODE_ENV=test npx nx run-many \
|
||||||
--verbose \
|
-t start \
|
||||||
--topological-dev \
|
--parallel=3 \
|
||||||
--include 123done \
|
-p \
|
||||||
--include browserid-verifier \
|
123done \
|
||||||
--include fxa-auth-server \
|
browserid-verifier \
|
||||||
--include fxa-content-server \
|
fxa-auth-server \
|
||||||
--include fxa-graphql-api \
|
fxa-content-server \
|
||||||
--include fxa-payments-server \
|
fxa-graphql-api \
|
||||||
--include fxa-profile-server \
|
fxa-payments-server \
|
||||||
--include fxa-settings \
|
fxa-profile-server \
|
||||||
run start > ~/.pm2/logs/startup.log
|
fxa-settings;
|
||||||
|
|
||||||
# stop services that aren't needed. These are 'watching' services, and they just
|
|
||||||
# consume memory. Ideally, we wouldn't even start these, but they are baked into
|
|
||||||
# the pm2 config start up.
|
|
||||||
npx pm2 stop auth-ftl &
|
|
||||||
npx pm2 stop settings-css &
|
|
||||||
npx pm2 stop settings-ftl &
|
|
||||||
npx pm2 stop payments-css &
|
|
||||||
npx pm2 stop payments-ftl &
|
|
||||||
wait
|
|
||||||
|
|
||||||
npx pm2 ls
|
npx pm2 ls
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"homepage": "https://github.com/mozilla/fxa/tree/main/packages/fxa-customs-server",
|
"homepage": "https://github.com/mozilla/fxa/tree/main/packages/fxa-customs-server",
|
||||||
"bugs": "https://github.com/mozilla/fxa/issues/",
|
"bugs": "https://github.com/mozilla/fxa/issues/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"clean": "rimraf dist",
|
||||||
"outdated": "npm outdated --depth 0 || exit 0",
|
"outdated": "npm outdated --depth 0 || exit 0",
|
||||||
"start": "pm2 start pm2.config.js",
|
"start": "pm2 start pm2.config.js",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
|
@ -65,5 +66,10 @@
|
||||||
"tap": "^16.3.0",
|
"tap": "^16.3.0",
|
||||||
"tap-xunit": "^2.4.1",
|
"tap-xunit": "^2.4.1",
|
||||||
"walk": "^2.3.15"
|
"walk": "^2.3.15"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:server"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --ext .mjs",
|
"lint": "eslint . --ext .mjs",
|
||||||
"start": "./bin/fxa-dev-launcher.mjs"
|
"start": "./bin/fxa-dev-launcher.mjs",
|
||||||
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
},
|
},
|
||||||
"bin": "./bin/fxa-dev-launcher.mjs",
|
"bin": "./bin/fxa-dev-launcher.mjs",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"build": "nest build",
|
"build": "nest build",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "../../_scripts/check-url.sh localhost:9000/__heartbeat__ && pm2 start pm2.config.js",
|
"start": "yarn check:url localhost:9000/__heartbeat__ && pm2 start pm2.config.js",
|
||||||
"start-prod": "node dist/packages/fxa-event-broker/src/main",
|
"start-prod": "node dist/packages/fxa-event-broker/src/main",
|
||||||
"lint": "eslint {src,test}/**/*.ts",
|
"lint": "eslint {src,test}/**/*.ts",
|
||||||
"test": "jest --runInBand",
|
"test": "jest --runInBand",
|
||||||
|
@ -117,5 +117,10 @@
|
||||||
},
|
},
|
||||||
"coverageDirectory": "../coverage",
|
"coverageDirectory": "../coverage",
|
||||||
"testEnvironment": "node"
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:broker"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
yarn test --runInBand
|
npx nx fxa-event-broker:test --runInBand
|
||||||
|
|
|
@ -93,7 +93,7 @@ Refer to Mocha's [CLI documentation](https://mochajs.org/#command-line-usage) fo
|
||||||
|
|
||||||
### Code Coverage
|
### Code Coverage
|
||||||
|
|
||||||
Code coverage is provided with `nyc`, to run coverage, call `yarn-script cover`
|
Code coverage is provided with `nyc`, to run coverage, call `yarn cover`
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"clean": "rimraf dist",
|
||||||
"cover": "nyc _mocha",
|
"cover": "nyc _mocha",
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
@ -50,5 +51,10 @@
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"reporter": "mocha-multi",
|
"reporter": "mocha-multi",
|
||||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared:service"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "FxA GraphQL API",
|
"description": "FxA GraphQL API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist && yarn gql:allowlist",
|
"prebuild": "yarn clean",
|
||||||
"copy-gql": "mkdir -p src/config/gql/allowlist/ && cp ../../configs/gql/allowlist/*.json src/config/gql/allowlist/.",
|
"gql-copy": "mkdir -p src/config/gql/allowlist/ && cp ../../configs/gql/allowlist/*.json src/config/gql/allowlist/.",
|
||||||
"build": "nest build",
|
"build": "yarn compile && nest build",
|
||||||
|
"clean": "rimraf dist",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"start": "pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:8290/__heartbeat__",
|
"start": "pm2 start pm2.config.js && yarn check:url localhost:8290/__heartbeat__",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
|
@ -20,8 +21,9 @@
|
||||||
"test-watch": "jest --watch",
|
"test-watch": "jest --watch",
|
||||||
"test-cov": "jest --coverage",
|
"test-cov": "jest --coverage",
|
||||||
"test-debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand --logHeapUsage",
|
"test-debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand --logHeapUsage",
|
||||||
"test-e2e": "npm run build && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-e2e.xml jest --runInBand --logHeapUsage --config ./test/jest-e2e.config.js --ci --reporters=default --reporters=jest-junit",
|
"test-e2e": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-e2e.xml jest --runInBand --logHeapUsage --config ./test/jest-e2e.config.js --ci --reporters=default --reporters=jest-junit",
|
||||||
"email-bounce": "node -r esbuild-register ./scripts/email-bounce.ts"
|
"email-bounce": "node -r esbuild-register ./scripts/email-bounce.ts",
|
||||||
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -8,8 +8,8 @@ const PATH = process.env.PATH.split(':')
|
||||||
|
|
||||||
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
||||||
const getNestScript = () => `${nest} start`;
|
const getNestScript = () => `${nest} start`;
|
||||||
const getProdScript = () =>
|
const getProdScript = () => 'node dist/packages/fxa-graphql-api/src/main.js';
|
||||||
'rm -rf dist && yarn build && node dist/packages/fxa-graphql-api/src/main.js';
|
|
||||||
const script =
|
const script =
|
||||||
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
||||||
? getProdScript()
|
? getProdScript()
|
||||||
|
|
|
@ -112,26 +112,26 @@ describe('#unit - LegalService', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('invalid files', () => {
|
describe('invalid files', () => {
|
||||||
async function test(fileName: string) {
|
async function testGetDoc(fileName: string) {
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
await service.getDoc('en', fileName);
|
await service.getDoc('en', fileName);
|
||||||
}).rejects.toThrow('Invalid file name');
|
}).rejects.toThrow('Invalid file name');
|
||||||
}
|
}
|
||||||
|
|
||||||
it('rejects empty file name', async () => {
|
it('rejects empty file name', async () => {
|
||||||
await test('');
|
await testGetDoc('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects relative path like file name', async () => {
|
it('rejects relative path like file name', async () => {
|
||||||
await test('../foo.txt');
|
await testGetDoc('../foo.txt');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects absolute path like file name', async () => {
|
it('rejects absolute path like file name', async () => {
|
||||||
await test('/foo/bar.txt');
|
await testGetDoc('/foo/bar.txt');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rejects long file name', async () => {
|
it('rejects long file name', async () => {
|
||||||
await test('a'.repeat(1000));
|
await testGetDoc('a'.repeat(1000));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,7 +25,6 @@ import Config, { AppConfig } from '../config';
|
||||||
import { AccountResolver } from './account.resolver';
|
import { AccountResolver } from './account.resolver';
|
||||||
import { SessionResolver } from './session.resolver';
|
import { SessionResolver } from './session.resolver';
|
||||||
import { LegalResolver } from './legal.resolver';
|
import { LegalResolver } from './legal.resolver';
|
||||||
import { CartResolver } from './cart.resolver';
|
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
|
|
||||||
const config = Config.getProperties();
|
const config = Config.getProperties();
|
||||||
|
|
|
@ -4,20 +4,7 @@
|
||||||
|
|
||||||
import { ApolloError } from 'apollo-server';
|
import { ApolloError } from 'apollo-server';
|
||||||
|
|
||||||
export class ThrottledError extends ApolloError {
|
export class ThrottledError extends ApolloError {}
|
||||||
constructor(
|
|
||||||
message: string,
|
|
||||||
code: string,
|
|
||||||
extensions: {
|
|
||||||
errno: number;
|
|
||||||
info: string;
|
|
||||||
retryAfter: number;
|
|
||||||
retryAfterLocalized: string;
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
super(message, code, extensions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PROFILE_INFO_URL =
|
export const PROFILE_INFO_URL =
|
||||||
'https://github.com/mozilla/fxa/blob/main/packages/fxa-profile-server/docs/API.md#errors';
|
'https://github.com/mozilla/fxa/blob/main/packages/fxa-profile-server/docs/API.md#errors';
|
||||||
|
|
|
@ -3,31 +3,35 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Firefox Accounts Payments Service",
|
"description": "Firefox Accounts Payments Service",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prebuild": "yarn l10n-prime",
|
||||||
|
"build": "yarn build-l10n && yarn build-css && yarn build-ts && yarn build-react",
|
||||||
"build-css": "npx tailwindcss --postcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css",
|
"build-css": "npx tailwindcss --postcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css",
|
||||||
|
"build-ts": "tsc",
|
||||||
|
"build-l10n": "nx l10n-merge && nx l10n-bundle && nx l10n-merge-test",
|
||||||
|
"build-react": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||||
|
"build-storybook": "NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/images storybook-static/ && cp -r public/locales ./storybook-static/locales",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"postinstall": "yarn l10n:prime fxa-payments-server",
|
"clean": "rimraf dist",
|
||||||
"clean": "git clean -fXd",
|
"l10n-merge": "yarn grunt merge-ftl",
|
||||||
|
"l10n-merge-test": "yarn grunt merge-ftl:test",
|
||||||
"l10n-prime": "yarn l10n:prime fxa-payments-server",
|
"l10n-prime": "yarn l10n:prime fxa-payments-server",
|
||||||
"l10n-bundle": "yarn l10n:bundle fxa-payments-server branding,react,payments",
|
"l10n-bundle": "yarn l10n:bundle fxa-payments-server branding,react,payments",
|
||||||
|
"l10n-watch": "yarn grunt watch-ftl",
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||||
"start": "tsc --build ../fxa-react && yarn build-css && yarn merge-ftl && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:3031/__lbheartbeat__",
|
"start": "pm2 start pm2.config.js && yarn check:url localhost:3031/__lbheartbeat__",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "tsc --build ../fxa-react && yarn build-css && pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"build": "yarn merge-ftl && tsc --build ../fxa-react && NODE_ENV=production yarn build-css && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"test": "yarn test-frontend && yarn test-server",
|
"test": "yarn test-frontend && yarn test-server",
|
||||||
"test-frontend": "yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false",
|
"test-frontend": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false",
|
||||||
"test-frontend-watch": "yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test",
|
"test-frontend-watch": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test",
|
||||||
"test-server": "yarn merge-ftl-test && yarn build && jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit",
|
"test-server": "jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit",
|
||||||
"test-unit": "yarn build && yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
"test-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||||
"test-integration": "yarn build && yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false --ci --reporters=default --reporters=jest-junit",
|
"test-integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false --ci --reporters=default --reporters=jest-junit",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||||
"storybook": "NODE_OPTIONS=--openssl-legacy-provider storybook dev -p 6006",
|
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
|
||||||
"build-storybook": "yarn merge-ftl && NODE_ENV=production yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/images storybook-static/ && cp -r public/locales ./storybook-static/locales",
|
"watch-ftl": "yarn l10n-watch"
|
||||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl && yarn l10n-bundle",
|
|
||||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
|
||||||
"watch-ftl": "grunt watch-ftl"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -192,5 +196,10 @@
|
||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:frontend"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,8 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
const apps = [];
|
||||||
apps: [
|
apps.push({
|
||||||
{
|
|
||||||
name: 'payments',
|
name: 'payments',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
script: 'node server/bin/fxa-payments-server.js',
|
script: 'node server/bin/fxa-payments-server.js',
|
||||||
|
@ -29,8 +28,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
filter_env: ['npm_'],
|
filter_env: ['npm_'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
apps.push({
|
||||||
name: 'payments-react',
|
name: 'payments-react',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
script: 'yarn rescripts start',
|
script: 'yarn rescripts start',
|
||||||
|
@ -47,8 +46,10 @@ module.exports = {
|
||||||
},
|
},
|
||||||
filter_env: ['npm_', 'BERRY_BIN_FOLDER'],
|
filter_env: ['npm_', 'BERRY_BIN_FOLDER'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
|
||||||
|
if (process.env.CI !== 'true') {
|
||||||
|
apps.push({
|
||||||
name: 'payments-css',
|
name: 'payments-css',
|
||||||
script: 'yarn build-css',
|
script: 'yarn build-css',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -72,8 +73,8 @@ module.exports = {
|
||||||
],
|
],
|
||||||
ignore_watch: ['src/styles/tailwind.out.*'],
|
ignore_watch: ['src/styles/tailwind.out.*'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
apps.push({
|
||||||
name: 'payments-ftl',
|
name: 'payments-ftl',
|
||||||
script: 'yarn grunt watch-ftl',
|
script: 'yarn grunt watch-ftl',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -81,6 +82,9 @@ module.exports = {
|
||||||
max_restarts: '1',
|
max_restarts: '1',
|
||||||
min_uptime: '2m',
|
min_uptime: '2m',
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
],
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
|
|
||||||
yarn workspace fxa-payments-server build
|
npx nx fxa-payments-server:build
|
||||||
NODE_ENV=test yarn workspace fxa-payments-server test
|
NODE_ENV=test npx nx fxa-payments-server:test
|
||||||
|
|
|
@ -6,16 +6,18 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||||
|
"clean": "rimraf dist",
|
||||||
|
"prebuild": "mkdir -p var/public",
|
||||||
"outdated": "npm outdated --depth 0 || exit 0",
|
"outdated": "npm outdated --depth 0 || exit 0",
|
||||||
"start": "yarn make-dirs && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:1111/__heartbeat__",
|
"build": "echo 'Build not required'",
|
||||||
|
"start": "pm2 start pm2.config.js && yarn check:url localhost:1111/__heartbeat__",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"test": "scripts/test-local.sh",
|
"test": "scripts/test-local.sh",
|
||||||
"test-unit": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert",
|
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert",
|
||||||
"test-integration": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration'",
|
"test-integration": "mkdir -p var/public && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration'",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
"make-dirs": "mkdir -p var/public"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hapi/boom": "~10.0.0",
|
"@hapi/boom": "~10.0.0",
|
||||||
|
@ -70,5 +72,10 @@
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"reporter": "mocha-multi",
|
"reporter": "mocha-multi",
|
||||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:server"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,4 @@ mkdir -p var/public
|
||||||
# Copy version info
|
# Copy version info
|
||||||
cp "$DIR/../../version.json" "$DIR/../config"
|
cp "$DIR/../../version.json" "$DIR/../config"
|
||||||
|
|
||||||
NODE_ENV=test yarn test
|
NODE_ENV=test npx nx fxa-profile-server:test
|
||||||
|
|
|
@ -12,25 +12,28 @@
|
||||||
"./lib/": "./lib/"
|
"./lib/": "./lib/"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prebuild": "nx l10n-prime",
|
||||||
|
"build": "nx build-l10n && nx build-css && nx build-ts",
|
||||||
"build-css": "npx tailwindcss -i ./styles/tailwind.css -o ./styles/tailwind.out.css",
|
"build-css": "npx tailwindcss -i ./styles/tailwind.css -o ./styles/tailwind.out.css",
|
||||||
"build-storybook": "yarn merge-ftl && NODE_ENV=production yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/locales ./storybook-static/locales",
|
"build-ts": "tsc --build",
|
||||||
"build": "tsc --build && yarn merge-ftl",
|
"build-storybook": "NODE_ENV=production yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/locales ./storybook-static/locales",
|
||||||
"compile": "tsc --noEmit",
|
"build-l10n": "nx l10n-merge && nx l10n-merge-test",
|
||||||
"clean": "git clean -fXd",
|
"compile": "nx build-ts",
|
||||||
|
"clean": "rimraf dist",
|
||||||
"l10n-prime": "yarn l10n:prime fxa-react",
|
"l10n-prime": "yarn l10n:prime fxa-react",
|
||||||
|
"l10n-merge": "yarn grunt merge-ftl",
|
||||||
|
"l10n-merge-test": "yarn grunt merge-ftl:test",
|
||||||
|
"l10n-watch": "yarn grunt watch-ftl",
|
||||||
"lint": "eslint . .storybook",
|
"lint": "eslint . .storybook",
|
||||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"start": "yarn merge-ftl && pm2 start pm2.config.js",
|
"start": "pm2 start pm2.config.js",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"storybook": "yarn merge-ftl && yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook dev -p 6007 --no-version-updates",
|
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6007 --no-version-updates",
|
||||||
"test": "yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --env=jest-environment-jsdom -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit ",
|
"test": "yarn test-unit && yarn test-integration",
|
||||||
"test-unit": "yarn test",
|
"test-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --env=jest-environment-jsdom -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||||
"test-integration": "echo No integration tests present for $npm_package_name",
|
"watch-ftl": "yarn l10n-watch"
|
||||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl",
|
|
||||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
|
||||||
"watch-ftl": "grunt watch-ftl"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluent/bundle": "^0.18.0",
|
"@fluent/bundle": "^0.18.0",
|
||||||
|
@ -104,5 +107,10 @@
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/mozilla/fxa/issues"
|
"url": "https://github.com/mozilla/fxa/issues"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared:lib"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,10 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
let apps = [];
|
||||||
apps: [
|
|
||||||
|
if (process.env.CI !== 'true') {
|
||||||
|
apps = [
|
||||||
{
|
{
|
||||||
name: 'react-tsc',
|
name: 'react-tsc',
|
||||||
script: 'yarn tsc --build --watch',
|
script: 'yarn tsc --build --watch',
|
||||||
|
@ -38,5 +40,9 @@ module.exports = {
|
||||||
ignore_watch: ['styles/tailwind.out.css'],
|
ignore_watch: ['styles/tailwind.out.css'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
},
|
||||||
],
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/bin/bash -ex
|
#!/bin/bash -ex
|
||||||
|
|
||||||
yarn workspaces focus fxa-react
|
CI=yes NODE_ENV=test npx nx fxa-react:test
|
||||||
CI=yes NODE_ENV=test yarn test
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
storybook-static
|
|
@ -130,4 +130,5 @@ const Breakpoints = ({ config }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (config) => Breakpoints(config);
|
const breakpoints = (config) => Breakpoints(config);
|
||||||
|
export default breakpoints;
|
||||||
|
|
|
@ -130,4 +130,5 @@ const Colors = ({ config }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (config) => Colors(config);
|
const colors = (config) => Colors(config);
|
||||||
|
export default colors;
|
||||||
|
|
|
@ -82,4 +82,5 @@ export const Introduction = () => (
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default () => Introduction();
|
export const introduction = () => Introduction();
|
||||||
|
export default introduction;
|
||||||
|
|
|
@ -2,8 +2,6 @@ import React from 'react';
|
||||||
import Page from '../Page';
|
import Page from '../Page';
|
||||||
import Copiable from '../Copiable';
|
import Copiable from '../Copiable';
|
||||||
import Snippet from '../Snippet';
|
import Snippet from '../Snippet';
|
||||||
import { withLocalization } from 'fxa-react/lib/storybooks';
|
|
||||||
import AppLocalizationProvider from 'fxa-react/lib/AppLocalizationProvider';
|
|
||||||
|
|
||||||
const nonIntMap = {
|
const nonIntMap = {
|
||||||
px: {
|
px: {
|
||||||
|
@ -211,4 +209,5 @@ const Spacing = ({ config }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (config) => Spacing(config);
|
const spacing = (config) => Spacing(config);
|
||||||
|
export default spacing;
|
||||||
|
|
|
@ -126,4 +126,5 @@ export const Typography = ({ config }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (config) => Typography(config);
|
const typography = (config) => Typography(config);
|
||||||
|
export default typography;
|
||||||
|
|
|
@ -4,30 +4,35 @@
|
||||||
"homepage": "https://accounts.firefox.com/settings",
|
"homepage": "https://accounts.firefox.com/settings",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build-css": "npx tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
|
"prebuild": "nx l10n-prime && nx legal-prime",
|
||||||
"build-storybook": "yarn merge-ftl && NODE_ENV=production STORYBOOK_BUILD=1 yarn build-css && yarn legal-clone && LOG_LEVEL=TRACE NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/locales ./storybook-static/locales",
|
"build": "nx build-l10n && nx build-ts && nx build-css && nx build-react",
|
||||||
"extract-gql": "persistgraphql src ../../configs/gql/allowlist/fxa-settings.json --js --extension=ts ",
|
"build-ts": "tsc --build",
|
||||||
"build": "tsc --build ../fxa-react && NODE_ENV=production yarn build-css && yarn legal-clone && yarn merge-ftl && SKIP_PREFLIGHT_CHECK=true INLINE_RUNTIME_CHUNK=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
"build-css": "NODE_ENV=production tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
|
||||||
|
"build-storybook": "NODE_ENV=production STORYBOOK_BUILD=1 yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook build && cp -r public/locales ./storybook-static/locales",
|
||||||
|
"build-l10n": "nx l10n-merge && nx l10n-bundle && nx l10n-merge-test",
|
||||||
|
"build-react": "SKIP_PREFLIGHT_CHECK=true INLINE_RUNTIME_CHUNK=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||||
|
"clean": "rimraf dist",
|
||||||
"compile": "tsc --noEmit",
|
"compile": "tsc --noEmit",
|
||||||
"clean": "git clean -fXd",
|
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"l10n-prime": "yarn l10n:prime fxa-settings",
|
"gql-extract": "persistgraphql src ../../configs/gql/allowlist/fxa-settings.json --js --extension=ts ",
|
||||||
"l10n-bundle": "yarn l10n:bundle fxa-settings branding,react,settings",
|
"l10n-bundle": "yarn l10n:bundle fxa-settings branding,react,settings",
|
||||||
"legal-clone": "yarn legal:clone fxa-settings",
|
"l10n-prime": "yarn l10n:prime fxa-settings",
|
||||||
|
"l10n-merge": "yarn grunt merge-ftl",
|
||||||
|
"l10n-merge-test": "yarn grunt merge-ftl:test",
|
||||||
|
"legal-prime": "yarn legal:clone fxa-settings",
|
||||||
"lint": "eslint . .storybook",
|
"lint": "eslint . .storybook",
|
||||||
"restart": "yarn build-css && pm2 restart pm2.config.js",
|
"start": "pm2 start pm2.config.js && yarn check:url localhost:3000/settings/static/js/bundle.js",
|
||||||
"start": "yarn merge-ftl && yarn build-css && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:3000/settings/static/js/bundle.js",
|
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
|
"restart": "pm2 restart pm2.config.js",
|
||||||
"delete": "pm2 delete pm2.config.js",
|
"delete": "pm2 delete pm2.config.js",
|
||||||
"storybook": "yarn legal-clone && STORYBOOK_BUILD=1 yarn build-css && NODE_OPTIONS=--openssl-legacy-provider storybook dev -p 6008 --no-version-updates",
|
"storybook": "STORYBOOK_BUILD=1 yarn build-css && NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6008 --no-version-updates",
|
||||||
"test": "yarn legal-clone && yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false",
|
"test": "SKIP_PREFLIGHT_CHECK=true rescripts test",
|
||||||
"test-watch": "yarn legal-clone && yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true rescripts test",
|
"test-watch": "SKIP_PREFLIGHT_CHECK=true rescripts test",
|
||||||
"test-coverage": "yarn legal-clone && yarn test --coverage --watchAll=false",
|
"test-coverage": "yarn test --coverage --watchAll=false",
|
||||||
"test-unit": "echo No unit tests present for $npm_package_name",
|
"test-unit": "echo No unit tests present for $npm_package_name",
|
||||||
"test-integration": "yarn legal-clone && yarn merge-ftl-test && tsc --build ../fxa-react && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false --ci --runInBand --reporters=default --reporters=jest-junit",
|
"test-integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false --ci --runInBand --reporters=default --reporters=jest-junit",
|
||||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl && yarn l10n-bundle",
|
"watch-ftl": "grunt watch-ftl",
|
||||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||||
"watch-ftl": "grunt watch-ftl"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"resetMocks": false,
|
"resetMocks": false,
|
||||||
|
@ -156,5 +161,10 @@
|
||||||
"storybook-addon-rtl": "^0.5.0",
|
"storybook-addon-rtl": "^0.5.0",
|
||||||
"style-loader": "^1.3.0",
|
"style-loader": "^1.3.0",
|
||||||
"webpack": "^5.84.1"
|
"webpack": "^5.84.1"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:frontend"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
const apps = [];
|
||||||
apps: [
|
|
||||||
{
|
apps.push({
|
||||||
name: 'settings-react',
|
name: 'settings-react',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
script: 'yarn rescripts start',
|
script: 'yarn rescripts start',
|
||||||
|
@ -27,8 +27,10 @@ module.exports = {
|
||||||
},
|
},
|
||||||
filter_env: ['npm_', 'BERRY_BIN_FOLDER'],
|
filter_env: ['npm_', 'BERRY_BIN_FOLDER'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
|
||||||
|
if (process.env.CI !== 'true') {
|
||||||
|
apps.push({
|
||||||
name: 'settings-css',
|
name: 'settings-css',
|
||||||
script: 'yarn build-css',
|
script: 'yarn build-css',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -53,8 +55,9 @@ module.exports = {
|
||||||
],
|
],
|
||||||
ignore_watch: ['src/styles/tailwind.out.*'],
|
ignore_watch: ['src/styles/tailwind.out.*'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
|
||||||
|
apps.push({
|
||||||
name: 'settings-ftl',
|
name: 'settings-ftl',
|
||||||
script: 'yarn grunt watch-ftl',
|
script: 'yarn grunt watch-ftl',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -62,14 +65,9 @@ module.exports = {
|
||||||
max_restarts: '1',
|
max_restarts: '1',
|
||||||
min_uptime: '2m',
|
min_uptime: '2m',
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
{
|
}
|
||||||
filter_env: ['npm_'],
|
|
||||||
autorestart: false,
|
module.exports = {
|
||||||
name: 'settings-gql-allowlist',
|
apps,
|
||||||
script: 'yarn gql:allowlist',
|
|
||||||
cwd: __dirname,
|
|
||||||
watch: ['src/**/*.ts'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { typeByTestIdFn } from '../../lib/test-utils';
|
import { typeByTestIdFn } from '../../lib/test-utils';
|
||||||
import { screen, render } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||||
import { Subject } from './mocks';
|
import { Subject } from './mocks';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default {
|
||||||
} as Meta;
|
} as Meta;
|
||||||
|
|
||||||
export const Default = () => {
|
export const Default = () => {
|
||||||
const [tooltipVisible, setTooltipVisible] = useState(false);
|
const [, setTooltipVisible] = useState(false);
|
||||||
return (
|
return (
|
||||||
<div className="p-10 max-w-xs">
|
<div className="p-10 max-w-xs">
|
||||||
<GetDataTrio value="Copy that" {...{ setTooltipVisible }} />
|
<GetDataTrio value="Copy that" {...{ setTooltipVisible }} />
|
||||||
|
@ -26,7 +26,7 @@ export const Default = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SingleCopyButton = () => {
|
export const SingleCopyButton = () => {
|
||||||
const [tooltipVisible, setTooltipVisible] = useState(false);
|
const [, setTooltipVisible] = useState(false);
|
||||||
return (
|
return (
|
||||||
<div className="p-10 max-w-xs">
|
<div className="p-10 max-w-xs">
|
||||||
<GetDataCopySingleton value="Copy that" {...{ setTooltipVisible }} />
|
<GetDataCopySingleton value="Copy that" {...{ setTooltipVisible }} />
|
||||||
|
@ -35,7 +35,7 @@ export const SingleCopyButton = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SingleCopyButtonInline = () => {
|
export const SingleCopyButtonInline = () => {
|
||||||
const [tooltipVisible, setTooltipVisible] = useState(false);
|
const [, setTooltipVisible] = useState(false);
|
||||||
return (
|
return (
|
||||||
<div className="p-10 max-w-xs">
|
<div className="p-10 max-w-xs">
|
||||||
<GetDataCopySingletonInline
|
<GetDataCopySingletonInline
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { LinkExpiredResetPassword } from '../LinkExpiredResetPassword';
|
||||||
import { LinkExpiredSignin } from '../LinkExpiredSignin';
|
import { LinkExpiredSignin } from '../LinkExpiredSignin';
|
||||||
import { ResendStatus } from 'fxa-settings/src/lib/types';
|
import { ResendStatus } from 'fxa-settings/src/lib/types';
|
||||||
import { MOCK_ACCOUNT } from 'fxa-settings/src/models/mocks';
|
import { MOCK_ACCOUNT } from 'fxa-settings/src/models/mocks';
|
||||||
import { IntegrationType } from '../../models';
|
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Components/LinkExpired',
|
title: 'Components/LinkExpired',
|
||||||
|
|
|
@ -14,7 +14,6 @@ import {
|
||||||
} from '../../models/mocks';
|
} from '../../models/mocks';
|
||||||
import { Account } from '../../models';
|
import { Account } from '../../models';
|
||||||
import { FIREFOX_NOREPLY_EMAIL } from 'fxa-settings/src/constants';
|
import { FIREFOX_NOREPLY_EMAIL } from 'fxa-settings/src/constants';
|
||||||
import { createMockWebIntegration } from '../../lib/integrations/mocks';
|
|
||||||
|
|
||||||
const viewName = 'example-view-name';
|
const viewName = 'example-view-name';
|
||||||
const email = MOCK_ACCOUNT.primaryEmail.email;
|
const email = MOCK_ACCOUNT.primaryEmail.email;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// import React from 'react';
|
|
||||||
// import { screen } from '@testing-library/react';
|
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider'; // import { PageWithLoggedInStatusState } from '.';
|
|
||||||
// import { MockComponent } from './mocks';
|
|
||||||
import {
|
import {
|
||||||
/* Account, AppContext,*/ useInitialSettingsState,
|
/* Account, AppContext,*/ useInitialSettingsState,
|
||||||
} from '../../models';
|
} from '../../models';
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { screen, render } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||||
import { getFtlBundle, testAllL10n } from 'fxa-react/lib/test-utils';
|
import { getFtlBundle, testAllL10n } from 'fxa-react/lib/test-utils';
|
||||||
import { FluentBundle } from '@fluent/bundle';
|
import { FluentBundle } from '@fluent/bundle';
|
||||||
|
|
|
@ -60,7 +60,7 @@ const accountWithThrottledErrorOnSubmit = {
|
||||||
} as unknown as Account;
|
} as unknown as Account;
|
||||||
|
|
||||||
const StoryWithContext = (account: Account) => {
|
const StoryWithContext = (account: Account) => {
|
||||||
const [formattedRecoveryKey, setFormattedRecoveryKey] = useState<string>('');
|
const [, setFormattedRecoveryKey] = useState<string>('');
|
||||||
const ftlMsgResolver = useFtlMsgResolver();
|
const ftlMsgResolver = useFtlMsgResolver();
|
||||||
|
|
||||||
const localizedBackButtonTitle = ftlMsgResolver.getMsg(
|
const localizedBackButtonTitle = ftlMsgResolver.getMsg(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import React, { ReactNode, useState } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
import { useClickOutsideEffect } from 'fxa-react/lib/hooks';
|
import { useClickOutsideEffect } from 'fxa-react/lib/hooks';
|
||||||
import { useEscKeydownEffect, useChangeFocusEffect } from '../../../lib/hooks';
|
import { useEscKeydownEffect, useChangeFocusEffect } from '../../../lib/hooks';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
|
@ -225,7 +225,8 @@ export const PageDeleteAccount = (_: RouteComponentProps) => {
|
||||||
>
|
>
|
||||||
<p className="mb-4">
|
<p className="mb-4">
|
||||||
If you subscribe to Pocket Premium, please make sure that you{' '}
|
If you subscribe to Pocket Premium, please make sure that you{' '}
|
||||||
<a>cancel your subscription</a> before deleting your account.
|
<a href="#todo-change-to-button">cancel your subscription</a>{' '}
|
||||||
|
before deleting your account.
|
||||||
</p>
|
</p>
|
||||||
</Localized>
|
</Localized>
|
||||||
<Localized id="delete-account-acknowledge">
|
<Localized id="delete-account-acknowledge">
|
||||||
|
|
|
@ -67,7 +67,7 @@ describe('models/integrations/oauth-relier', function () {
|
||||||
it('empty scope', async () => {
|
it('empty scope', async () => {
|
||||||
await expect(async () => {
|
await expect(async () => {
|
||||||
const integration = getIntegration('');
|
const integration = getIntegration('');
|
||||||
const _permissions = await integration.getPermissions();
|
await integration.getPermissions();
|
||||||
}).rejects.toThrow();
|
}).rejects.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ import {
|
||||||
MinLength,
|
MinLength,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
|
|
||||||
const PKCE_CODE_CHALLENGE_LENGTH = 43;
|
|
||||||
|
|
||||||
interface OAuthIntegrationFeatures extends IntegrationFeatures {
|
interface OAuthIntegrationFeatures extends IntegrationFeatures {
|
||||||
webChannelSupport: boolean;
|
webChannelSupport: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import { Constants } from '../../lib/constants';
|
||||||
import { BaseIntegrationData } from './web-integration';
|
import { BaseIntegrationData } from './web-integration';
|
||||||
import {
|
import {
|
||||||
IsBase64,
|
IsBase64,
|
||||||
IsISO31661Alpha3,
|
|
||||||
IsIn,
|
IsIn,
|
||||||
IsOptional,
|
IsOptional,
|
||||||
IsString,
|
IsString,
|
||||||
|
|
|
@ -2,14 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import {
|
import { IsEmail, IsHexadecimal, IsOptional, Length } from 'class-validator';
|
||||||
IsEmail,
|
|
||||||
IsHexadecimal,
|
|
||||||
IsNotEmpty,
|
|
||||||
IsOptional,
|
|
||||||
IsString,
|
|
||||||
Length,
|
|
||||||
} from 'class-validator';
|
|
||||||
import { ModelDataProvider, bind } from '../../lib/model-data';
|
import { ModelDataProvider, bind } from '../../lib/model-data';
|
||||||
|
|
||||||
export * from './verification-info';
|
export * from './verification-info';
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { screen, render } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||||
import { usePageViewEvent } from '../../lib/metrics';
|
import { usePageViewEvent } from '../../lib/metrics';
|
||||||
import CannotCreateAccount, { viewName } from '.';
|
import CannotCreateAccount, { viewName } from '.';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Clear from '.';
|
import Clear from '.';
|
||||||
import { screen, render } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||||
describe('Clear', () => {
|
describe('Clear', () => {
|
||||||
it('clears localStorage, sessionStorage, and sets cookie', () => {
|
it('clears localStorage, sessionStorage, and sets cookie', () => {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Legal, { viewName } from '.';
|
import Legal, { viewName } from '.';
|
||||||
import { screen, render } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||||
import { usePageViewEvent } from '../../lib/metrics';
|
import { usePageViewEvent } from '../../lib/metrics';
|
||||||
import { FluentBundle } from '@fluent/bundle';
|
import { FluentBundle } from '@fluent/bundle';
|
||||||
|
|
|
@ -6,12 +6,7 @@ import { RouteComponentProps, useNavigate } from '@reach/router';
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { Control, useForm, useWatch } from 'react-hook-form';
|
import { Control, useForm, useWatch } from 'react-hook-form';
|
||||||
import { REACT_ENTRYPOINT } from '../../constants';
|
import { REACT_ENTRYPOINT } from '../../constants';
|
||||||
import {
|
import { getLocalizedErrorMessage } from '../../lib/auth-errors/auth-errors';
|
||||||
AuthUiErrorNos,
|
|
||||||
AuthUiErrors,
|
|
||||||
composeAuthUiErrorTranslationId,
|
|
||||||
getLocalizedErrorMessage,
|
|
||||||
} from '../../lib/auth-errors/auth-errors';
|
|
||||||
import { usePageViewEvent, useMetrics } from '../../lib/metrics';
|
import { usePageViewEvent, useMetrics } from '../../lib/metrics';
|
||||||
import { MozServices } from '../../lib/types';
|
import { MozServices } from '../../lib/types';
|
||||||
import {
|
import {
|
||||||
|
@ -29,7 +24,6 @@ import { InputText } from '../../components/InputText';
|
||||||
import LinkRememberPassword from '../../components/LinkRememberPassword';
|
import LinkRememberPassword from '../../components/LinkRememberPassword';
|
||||||
import WarningMessage from '../../components/WarningMessage';
|
import WarningMessage from '../../components/WarningMessage';
|
||||||
import { isEmailValid } from 'fxa-shared/email/helpers';
|
import { isEmailValid } from 'fxa-shared/email/helpers';
|
||||||
import sentryMetrics from 'fxa-shared/lib/sentry';
|
|
||||||
import { setOriginalTabMarker } from '../../lib/storage-utils';
|
import { setOriginalTabMarker } from '../../lib/storage-utils';
|
||||||
import { ResetPasswordFormData, ResetPasswordProps } from './interfaces';
|
import { ResetPasswordFormData, ResetPasswordProps } from './interfaces';
|
||||||
import { ConfirmResetPasswordLocationState } from './ConfirmResetPassword/interfaces';
|
import { ConfirmResetPasswordLocationState } from './ConfirmResetPassword/interfaces';
|
||||||
|
|
|
@ -203,11 +203,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "yarn build || true",
|
"build": "yarn build-ts && yarn copy-assets && yarn copy-sql",
|
||||||
"build": "tsc --build && tsc --build tsconfig.cjs.json && echo '{ \"type\": \"module\" }' > ./dist/esm/packages/fxa-shared/db/package.json && yarn copy-assets && yarn copy-sql",
|
"build-ts": "tsc --build && tsc --build tsconfig.cjs.json",
|
||||||
"compile": "tsc --noEmit && yarn copy-assets && yarn copy-sql",
|
"clean": "rm -rf dist",
|
||||||
|
"compile": "yarn build-ts",
|
||||||
"copy-assets": "cp -r ./db/luaScripts ./dist/esm/packages/fxa-shared/db/luaScripts; cp -r ./db/luaScripts ./dist/cjs/packages/fxa-shared/db/luaScripts",
|
"copy-assets": "cp -r ./db/luaScripts ./dist/esm/packages/fxa-shared/db/luaScripts; cp -r ./db/luaScripts ./dist/cjs/packages/fxa-shared/db/luaScripts",
|
||||||
"copy-sql": "find test -name \\*.sql -exec cp \\{\\} dist/esm/packages/fxa-shared/\\{\\} \\; ; find test -name \\*.sql -exec cp \\{\\} dist/cjs/packages/fxa-shared/\\{\\} \\;",
|
"copy-sql": "echo '{ \"type\": \"module\" }' > ./dist/esm/packages/fxa-shared/db/package.json && find test -name \\*.sql -exec cp \\{\\} dist/esm/packages/fxa-shared/\\{\\} \\; ; find test -name \\*.sql -exec cp \\{\\} dist/cjs/packages/fxa-shared/\\{\\} \\;",
|
||||||
"start": "pm2 start pm2.config.js",
|
"start": "pm2 start pm2.config.js",
|
||||||
"stop": "pm2 stop pm2.config.js",
|
"stop": "pm2 stop pm2.config.js",
|
||||||
"restart": "pm2 restart pm2.config.js",
|
"restart": "pm2 restart pm2.config.js",
|
||||||
|
@ -365,5 +366,10 @@
|
||||||
"mocha": {
|
"mocha": {
|
||||||
"reporter": "mocha-multi",
|
"reporter": "mocha-multi",
|
||||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||||
|
},
|
||||||
|
"nx": {
|
||||||
|
"tags": [
|
||||||
|
"scope:shared:lib"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,10 @@ const PATH = process.env.PATH.split(':')
|
||||||
.filter((p) => !p.includes(process.env.TMPDIR))
|
.filter((p) => !p.includes(process.env.TMPDIR))
|
||||||
.join(':');
|
.join(':');
|
||||||
|
|
||||||
module.exports = {
|
const apps = [];
|
||||||
apps: [
|
|
||||||
{
|
if (process.env.CI !== 'true') {
|
||||||
|
apps.push({
|
||||||
name: 'shared-tsc',
|
name: 'shared-tsc',
|
||||||
script: 'yarn tsc --build --watch',
|
script: 'yarn tsc --build --watch',
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
@ -18,6 +19,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
filter_env: ['npm_'],
|
filter_env: ['npm_'],
|
||||||
time: true,
|
time: true,
|
||||||
},
|
});
|
||||||
],
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps,
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче