Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 14 #1050

Merged
merged 34 commits into from
Apr 30, 2021
Merged

Node 14 #1050

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
54efa2f
Set node 14 as the expected node version for development of the proje…
Stephen-ONeil Apr 28, 2021
702d2ab
Re-run npm install for each package.json, newer npm has minor package…
Stephen-ONeil Apr 28, 2021
92ae2c3
npm audits all around, may as well
Stephen-ONeil Apr 28, 2021
d695a84
Covert /server to ecma modules, bunch of linting in the process. Drop…
Stephen-ONeil Apr 28, 2021
e77c257
Update common_node_scripts, fixing some CommonJS to esModule transfor…
Stephen-ONeil Apr 28, 2021
e1ff348
Rename prettier.config.js to prettier.config.cjs, to help with hintin…
Stephen-ONeil Apr 28, 2021
9275cae
Drop references to server transpiled builds from CircleCI config
Stephen-ONeil Apr 28, 2021
a0fddec
Update email_backend to natively use esModules. Tweak email_backend a…
Stephen-ONeil Apr 28, 2021
a4f1d96
Revert npm audit's nivo upgrades. More undocument API changes in ther…
Stephen-ONeil Apr 28, 2021
c92597a
Update dockerfiles to node 14. Use new images (v1.4) in CI
Stephen-ONeil Apr 29, 2021
7cc6a17
Oops, npm install in /server to sync package.json and package-lock.json
Stephen-ONeil Apr 29, 2021
2a17da8
Fix docker image tags
Stephen-ONeil Apr 29, 2021
651e631
Try medium+ resource class for client build job
Stephen-ONeil Apr 29, 2021
1f5a267
Fix client build_all.sh's ability to set node's --max-old-space-size …
Stephen-ONeil Apr 29, 2021
919c9a4
Try higher max-old-space-size for CI builds
Stephen-ONeil Apr 29, 2021
4ee0991
Ah, re-add server/.babelrc to files persisted after CI build job
Stephen-ONeil Apr 29, 2021
148b6e9
Fix bad find-and-replace in merge_coverage_reports.js
Stephen-ONeil Apr 29, 2021
fab7a63
Fix email_backend extract_data.sh for node 14/esModules
Stephen-ONeil Apr 29, 2021
53ff3ca
Remove old babel-node from server prod_deploy_data.sh
Stephen-ONeil Apr 29, 2021
24dd399
Bring back transpiled builds for /server and /email_backend cloud fun…
Stephen-ONeil Apr 30, 2021
3b8d108
chmod email_backend and server build.sh scripts, minor tangential twe…
Stephen-ONeil Apr 30, 2021
11dbd0a
Call babel via npx in email_backend and server build.sh, to use bin f…
Stephen-ONeil Apr 30, 2021
1dde1c4
Ugh, ok, fine. Add prod_build scripts to server and email_backend pac…
Stephen-ONeil Apr 30, 2021
9923417
Go back to using transpiled_build for checksumming in CI deploy_serve…
Stephen-ONeil Apr 30, 2021
439b8d1
Duh, late-working brain, the deploy server job uses a slim google clo…
Stephen-ONeil Apr 30, 2021
7f6f2fd
Cleanup server and email_backend babel configs and packages slightly,…
Stephen-ONeil Apr 30, 2021
63c56be
Hack alert, toss a package.json in to the GCF transpiled_build dirs t…
Stephen-ONeil Apr 30, 2021
d75a504
Fix server/src/index.js, want a named export app, not a default expor…
Stephen-ONeil Apr 30, 2021
c9c098f
Move server and email_backend build scripts out of package.json and b…
Stephen-ONeil Apr 30, 2021
80bc171
Add "import/extensions": ["error", "always"] to root eslint config, l…
Stephen-ONeil Apr 30, 2021
2c4b038
For preservation, an attempt to port client build code to esModules. …
Stephen-ONeil Apr 30, 2021
bcf98f1
Revert "For preservation, an attempt to port client build code to esM…
Stephen-ONeil Apr 30, 2021
76c6226
Small tweaks to eslint configs in node script sub directories of /client
Stephen-ONeil Apr 30, 2021
eb9dfd9
Bring back CI build job caching for transpiled /server code
Stephen-ONeil Apr 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# Note: the image used for this job is built from a docker file found in ../dockerfiles/build
test_email_backend:
docker:
- image: eaadtbs/ib-ci-build:v1.2
- image: eaadtbs/ib-ci-build:1.4
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
# Note: the image used for this job is built from a docker file found in ../dockerfiles/build
cleanup_dev_links:
docker:
- image: eaadtbs/ib-ci-test:v1.1
- image: eaadtbs/ib-ci-test:1.4
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# Note: the image used for this job is built from a docker file found in ../dockerfiles/build
build:
docker:
- image: eaadtbs/ib-ci-build:1.3
- image: eaadtbs/ib-ci-build:1.4
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
- prod-build-{{ .Branch }}-{{ .Revision }}
- run:
command: |
[ -f "client/$BUILD_DIR/InfoBase/app/app-a11y-en.min.js" ] || (cd client && ./deploy_scripts/build_all.sh -m 4096 -c "none")
[ -f "client/$BUILD_DIR/InfoBase/app/app-a11y-en.min.js" ] || (cd client && ./deploy_scripts/build_all.sh -m 1536 -c "none")
- save_cache:
paths:
- client/build
Expand All @@ -169,12 +169,13 @@ jobs:
- server/node_modules
- scripts/common_node_scripts/node_modules
key: server-dependencies-{{ checksum "server/package-lock.json" }}

- restore_cache:
keys:
- server-transpiled-build-{{ .Branch }}-{{ .Revision }}
- run:
command: |
[ -f "server/transpiled_build/app.js" ] || (cd server && npm run build)
[ -f "server/transpiled_build/app.js" ] || (cd server && ./deploy_scripts/build.sh)
- save_cache:
paths:
- server/transpiled_build
Expand All @@ -190,16 +191,16 @@ jobs:
- ./test-data
- ./package.json
- ./.prettierignore
- ./prettier.config.js
- ./prettier.config.cjs

- ./client/build
- ./client/browser-tests
- ./client/deploy_scripts
- ./client/node_modules
- ./client/package.json

- ./server/transpiled_build
- ./server/src
- ./server/transpiled_build
- ./server/deploy_scripts
- ./server/.gcloudignore
- ./server/jest_configs
Expand All @@ -212,7 +213,7 @@ jobs:
# Note: the image used for this job is built from a docker file found in ../dockerfiles/test
test_server:
docker:
- image: eaadtbs/ib-ci-test:v1.1
- image: eaadtbs/ib-ci-test:1.4
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
Expand All @@ -230,7 +231,7 @@ jobs:
name: start_api_server
command: (cd server && npm run start)
background: true
- run: (cd server && npm run snapshot_tests) # the end to end snapshot tests, run against un-transpiled src for more useful coverage stats
- run: (cd server && npm run snapshot_tests)

# halt here if not on the true repo, expected that means this is running in an env without the GCloud env vars required for the following steps
- run: if [[ "$CIRCLE_PROJECT_REPONAME" != "infobase" ]]; then circleci step halt; fi
Expand All @@ -244,7 +245,7 @@ jobs:
# Note: the image used for this job is built from a docker file found in ../dockerfiles/test
test_end_to_end: # slower but more in-depth than the test job. Wait until these have passed before deploying the client
docker:
- image: eaadtbs/ib-ci-test:1.2
- image: eaadtbs/ib-ci-test:1.4
<<: *dockerhub_auth
working_directory: "~/InfoBase"
steps:
Expand All @@ -261,7 +262,7 @@ jobs:
background: true
- run:
name: start_api_server
command: (cd server && npm run start:transpiled) # run server end to end tests against the transpiled src, to be closer to production
command: (cd server && npm run start)
background: true
- run: (cd server && export TEST_AGAINST_TRANSPILIED='true' && npm run snapshot_tests)

Expand All @@ -281,7 +282,7 @@ jobs:
deploy_data:
working_directory: "~/InfoBase"
docker:
- image: eaadtbs/ib-ci-test:v1.1
- image: eaadtbs/ib-ci-test:1.4
<<: *dockerhub_auth
steps:
- attach_workspace:
Expand Down
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
}
]
}
]
],
"import/no-commonjs": 2,
"import/extensions": ["error", "always"]
},
"settings": {
"import/resolver":{
Expand Down
2 changes: 1 addition & 1 deletion client/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"settings": {
"react": {
"version": "16"
"version": "17"
},
"import/resolver": {
"node": {
Expand Down
4 changes: 2 additions & 2 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Client-side code and content for the GC InfoBase. / Code et contenu pour le côt
## Getting Started

### Pre-requisite:
- node@12.14.1 (`npm install -g n && n 12.14.1`)
- npm@6.4.1 (`npm install -g npm@6.4.1`)
- node@14.x (latest long term support) (`npm install -g n && n lts`)
- npm@6.x (`npm install -g npm@6`)
- Git

### First time setup
Expand Down
3 changes: 3 additions & 0 deletions client/browser-tests/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"rules": {
"import/no-commonjs": 0
},
"globals": {
"process": true,
"fixture": true,
Expand Down
3 changes: 3 additions & 0 deletions client/build_code/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"rules": {
"import/no-commonjs": 0
},
"globals": {
"process": true,
"__dirname": true
Expand Down
2 changes: 1 addition & 1 deletion client/build_code/webpack_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const get_rules = ({ language, target_ie11, is_prod_build }) => {
use: [
{ loader: "json-loader" },
{
loader: "./node_loaders/yaml-lang-loader.js",
loader: "./build_code/loaders/yaml-lang-loader.js",
options: { lang: language },
},
],
Expand Down
107 changes: 46 additions & 61 deletions client/deploy_scripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
set -e # will exit if any command has non-zero exit value

concurrency="full"
max_old_space_size=1024

max_old_space_size=2048
while getopts "c:m:" opt; do
case ${opt} in
c) concurrency=$OPTARG;;
Expand All @@ -16,89 +15,75 @@ if [[ ! $concurrency =~ ^(full|half|none)$ ]]; then
exit 1
fi

# the prod no-watch scripts in client/package.json will use MAX_OLD_SPACE_SIZE if it exists
export MAX_OLD_SPACE_SIZE=$max_old_space_size

[ -e $BUILD_DIR/InfoBase ] && rm -r $BUILD_DIR/InfoBase # clean up build dir

npm run IB_base

# When exiting, either from finishing, being killed, or throwing an error, kill the spinner and dump the captured build process output to terminal
function print_captured_output {
kill -9 $spinner_pid

[ -f $scratch/ib_prod_en_build_out ] && cat $scratch/ib_prod_en_build_out
[ -f $scratch/ib_prod_en_build_err ] && cat $scratch/ib_prod_en_build_err

[ -f $scratch/ib_prod_fr_build_out ] && cat $scratch/ib_prod_fr_build_out
[ -f $scratch/ib_prod_fr_build_err ] && cat $scratch/ib_prod_fr_build_err

[ -f $scratch/a11y_prod_en_build_out ] && cat $scratch/a11y_prod_en_build_out
[ -f $scratch/a11y_prod_en_build_err ] && cat $scratch/a11y_prod_en_build_err

[ -f $scratch/a11y_prod_fr_build_out ] && cat $scratch/a11y_prod_fr_build_out
[ -f $scratch/a11y_prod_fr_build_err ] && cat $scratch/a11y_prod_fr_build_err
}

if [ $concurrency == "none" ]; then
# Just running all builds one at a time, no backgrounding or output redirection
npm run IB_prod_no_watch_en

npm run IB_prod_no_watch_fr

npm run a11y_prod_no_watch_en

scratch=$(mktemp -d -t captured_build_output.XXXXXXXXXX)
if [ $concurrency == "full" ]; then
npm run a11y_prod_no_watch_fr
else
# Run standard and a11y builds in parallel as background processes, store thieir stdout and stderr in temp files and hold on to their pids,
# clean up and dump output on exit
trap print_captured_output EXIT

echo ""
echo "Running prod builds in background, full concurrency..."
echo "Running prod builds in background, $concurrency concurrency..."
spinner_pid=$(sh ../scripts/spinner.sh)

npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err &
ib_prod_en_pid=$!
# When exiting, either from finishing, being killed, or throwing an error, kill the spinner and dump the captured build process output to terminal
scratch=$(mktemp -d -t captured_build_output.XXXXXXXXXX)
function print_captured_output {
kill -9 $spinner_pid

npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err &
ib_prod_fr_pid=$!
[ -f $scratch/ib_prod_en_build_out ] && cat $scratch/ib_prod_en_build_out3
[ -f $scratch/ib_prod_en_build_err ] && cat $scratch/ib_prod_en_build_err

npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err &
a11y_prod_en_pid=$!
[ -f $scratch/ib_prod_fr_build_out ] && cat $scratch/ib_prod_fr_build_out
[ -f $scratch/ib_prod_fr_build_err ] && cat $scratch/ib_prod_fr_build_err

npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err &
a11y_prod_fr_pid=$!

wait $ib_prod_en_pid
wait $ib_prod_fr_pid
wait $a11y_prod_en_pid
wait $a11y_prod_fr_pid
elif [ $concurrency == "half" ]; then
# Same as "full" concurrency, but only run two builds at a time
[ -f $scratch/a11y_prod_en_build_out ] && cat $scratch/a11y_prod_en_build_out
[ -f $scratch/a11y_prod_en_build_err ] && cat $scratch/a11y_prod_en_build_err

[ -f $scratch/a11y_prod_fr_build_out ] && cat $scratch/a11y_prod_fr_build_out
[ -f $scratch/a11y_prod_fr_build_err ] && cat $scratch/a11y_prod_fr_build_err
}
trap print_captured_output EXIT

echo ""
echo "Running prod builds in background, half concurrency..."
spinner_pid=$(sh ../scripts/spinner.sh)

npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err &
npm run IB_prod_no_watch_en > $scratch/ib_prod_en_build_out 2> $scratch/ib_prod_en_build_err &
ib_prod_en_pid=$!

npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err &
npm run IB_prod_no_watch_fr > $scratch/ib_prod_fr_build_out 2> $scratch/ib_prod_fr_build_err &
ib_prod_fr_pid=$!

wait $ib_prod_en_pid
wait $ib_prod_fr_pid

npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err &
if [ $concurrency == "half" ]; then
wait $ib_prod_en_pid
wait $ib_prod_fr_pid
fi

npm run a11y_prod_no_watch_en > $scratch/a11y_prod_en_build_out 2> $scratch/a11y_prod_en_build_err &
a11y_prod_en_pid=$!

npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err &
npm run a11y_prod_no_watch_fr > $scratch/a11y_prod_fr_build_out 2> $scratch/a11y_prod_fr_build_err &
a11y_prod_fr_pid=$!

wait $a11y_prod_en_pid
wait $a11y_prod_fr_pid
elif [ $concurrency == "none" ]; then
# Just running all builds one at a time, no backgrounding or output redirection

npm run IB_prod_no_watch_en -- --max_old_space_size=$max_old_space_size

npm run IB_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size

npm run a11y_prod_no_watch_en -- --max_old_space_size=$max_old_space_size

npm run a11y_prod_no_watch_fr -- --max_old_space_size=$max_old_space_size
if [ $concurrency == "half" ]; then
wait $a11y_prod_en_pid
wait $a11y_prod_fr_pid
else
wait $ib_prod_en_pid
wait $ib_prod_fr_pid
wait $a11y_prod_en_pid
wait $a11y_prod_fr_pid
fi
fi

exit
9 changes: 0 additions & 9 deletions client/node_loaders/ib-text-loader.js

This file was deleted.

Loading