Skip to content

Commit

Permalink
WSTEAMA-618: ESM Dependency Script (#11099)
Browse files Browse the repository at this point in the history
* get type from dep

* script and readme

* FIX: sort out bad merge

* csv

* fix async bug

* FIX: one thing slipped through bad merge

* readme instruction

* Update scripts/README.md

Co-authored-by: Karina Thomas <[email protected]>

* Update scripts/README.md

Co-authored-by: Karina Thomas <[email protected]>

* Update scripts/README.md

Co-authored-by: Karina Thomas <[email protected]>

* Update scripts/esmDependencyCheck.js

Co-authored-by: Karina Thomas <[email protected]>

* use github token in zshrc instead

* typo

* deals with patch version strings

* linting

* simplified date format

* clean up console logs

* ENH: add sorting and notes

* Revert ENH: add sorting and notes

* Revert Revert ENH: add sorting and notes

* ENH: update to node18 // discard node-fetch

---------

Co-authored-by: LilyL0u <[email protected]>
Co-authored-by: LilyL0u <[email protected]>
Co-authored-by: Karina Thomas <[email protected]>
  • Loading branch information
4 people authored Oct 24, 2023
1 parent 2298175 commit 49f0e56
Show file tree
Hide file tree
Showing 4 changed files with 436 additions and 0 deletions.
157 changes: 157 additions & 0 deletions esmDependencyTable.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
Dependency,Type,Most Recent Version,Most Recent Version Date,Our Version,Our Version Date,Our Version Freshness in Days
@types/jest,module,29.5.6,2023-10-18,29.5.5,2023-09-15,38
@types/js-cookie,module,3.0.5,2023-10-18,3.0.5,2023-10-18,6
@types/jsdom,module,21.1.4,2023-10-18,20.0.1,2022-11-07,350
@types/loadable__component,module,5.13.6,2023-10-18,5.13.5,2023-08-30,54
@types/ramda,module,0.29.7,2023-10-18,0.28.15,2022-07-09,471
@types/react,module,18.2.31,2023-10-20,18.2.28,2023-10-10,13
@types/react-dom,module,18.2.14,2023-10-18,18.2.13,2023-10-10,13
@types/react-helmet,module,6.1.8,2023-10-18,6.1.7,2023-09-27,26
@types/react-lazyload,module,3.2.2,2023-10-18,3.2.2,2023-10-18,5
@types/react-router-dom,module,5.3.3,2023-03-06,5.3.3,2022-01-18,643
@types/url-parse,module,1.4.10,2023-10-18,1.4.10,2023-10-18,5
chalk,module,5.3.0,2023-06-29,5.3.0,2023-06-29,116
glob,module,10.3.10,2023-09-27,8.0.3,2022-05-13,528
helmet,module,7.0.0,2023-05-06,4.6.0,2021-05-02,904
helmet-csp,module,3.4.0,2022-06-18,3.4.0,2021-05-02,904
node-fetch,module,4.0.0-beta.4,2023-08-23,2.6.12,2023-06-29,116
ora,module,7.0.1,2023-08-01,5.4.1,2021-06-08,867
prettier,module,3.0.3,2023-10-21,2.8.8,2023-04-23,184
strip-ansi,module,7.1.0,2023-05-28,6.0.1,2021-09-23,760
timemachine,index.d.ts,0.3.2,2022-06-27,0.3.2,2020-10-15,1104
@babel/plugin-syntax-dynamic-import,error,7.8.3,2022-06-12,7.8.3,2020-01-13,1379
@babel/core,commonjs,8.0.0-alpha.4,2023-10-12,7.23.2,2023-10-12,12
@babel/eslint-parser,commonjs,8.0.0-alpha.4,2023-10-12,7.22.15,2023-09-04,49
@babel/plugin-proposal-export-default-from,commonjs,8.0.0-alpha.4,2023-10-12,7.22.17,2023-09-08,45
@babel/plugin-proposal-object-rest-spread,commonjs,7.21.4-esm.4,2023-09-01,7.20.7,2022-12-22,305
@babel/plugin-proposal-throw-expressions,commonjs,8.0.0-alpha.4,2023-10-12,7.22.5,2023-06-08,137
@babel/plugin-transform-runtime,commonjs,8.0.0-alpha.4,2023-10-12,7.23.2,2023-10-11,12
@babel/polyfill,commonjs,7.12.1,2022-06-12,7.12.1,2020-10-15,1103
@babel/preset-env,commonjs,8.0.0-alpha.4,2023-10-12,7.23.2,2023-10-11,12
@babel/preset-react,commonjs,8.0.0-alpha.4,2023-10-12,7.22.15,2023-09-04,49
@babel/preset-typescript,commonjs,8.0.0-alpha.4,2023-10-12,7.23.2,2023-10-11,12
@babel/runtime,commonjs,8.0.0-alpha.4,2023-10-12,7.23.2,2023-10-11,12
@bbc/web-vitals,commonjs,2.0.1,2023-10-17,1.2.0,2022-09-08,410
@cypress/webpack-preprocessor,commonjs,6.0.0,2023-08-29,5.17.1,2023-05-01,175
@emotion/babel-plugin,commonjs,11.11.0,2023-07-22,11.11.0,2023-05-06,170
@emotion/babel-preset-css-prop,commonjs,11.11.0,2023-05-06,11.11.0,2023-05-06,170
@emotion/cache,commonjs,11.11.0,2023-05-06,11.11.0,2023-05-06,170
@emotion/jest,commonjs,11.11.0,2023-05-06,11.11.0,2023-05-06,170
@emotion/react,commonjs,11.11.1,2023-06-07,11.11.1,2023-06-07,138
@emotion/server,commonjs,11.11.0,2023-05-06,11.11.0,2023-05-06,170
@emotion/styled,commonjs,11.11.0,2023-05-06,11.11.0,2023-05-06,170
@loadable/babel-plugin,commonjs,5.16.1,2023-07-20,5.16.1,2023-07-20,95
@loadable/component,commonjs,5.15.3,2023-01-28,5.15.3,2023-01-28,269
@loadable/server,commonjs,5.16.1,2023-07-20,5.15.3,2023-01-28,269
@loadable/webpack-plugin,commonjs,5.15.2,2022-04-06,5.15.2,2021-12-12,680
@optimizely/react-sdk,commonjs,3.0.0-beta,2023-09-26,2.9.2,2023-03-15,222
@storybook/addon-a11y,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/addon-backgrounds,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/addon-controls,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/addon-docs,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/addon-knobs,commonjs,7.0.2,2023-04-27,6.4.0,2021-11-27,695
@storybook/addon-toolbars,commonjs,7.6.0-alpha.2,2023-10-23,6.5.17-alpha.0,2023-03-23,215
@storybook/addon-viewport,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/builder-webpack5,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/manager-webpack5,commonjs,7.0.0-alpha.10,2023-05-02,6.5.16,2023-01-26,270
@storybook/react,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@storybook/theming,commonjs,7.6.0-alpha.2,2023-10-23,6.5.16,2023-01-26,270
@testing-library/dom,commonjs,10.0.0-alpha.2,2023-10-03,9.3.3,2023-09-17,36
@testing-library/jest-dom,commonjs,6.1.4,2023-10-12,6.1.4,2023-10-12,12
@testing-library/react,commonjs,14.0.0,2023-05-24,14.0.0,2023-02-16,249
@testing-library/react-hooks,commonjs,8.0.1,2022-10-18,8.0.1,2022-06-18,492
@testing-library/user-event,commonjs,14.5.1,2023-09-15,14.4.3,2022-08-09,440
@types/testing-library__react,commonjs,10.2.0,2022-04-07,10.2.0,2020-06-24,1216
@typescript-eslint/eslint-plugin,commonjs,7.0.0-alpha.0,2023-10-23,5.59.6,2023-05-15,161
@typescript-eslint/parser,commonjs,7.0.0-alpha.0,2023-10-23,5.59.6,2023-05-15,161
amphtml-validator,commonjs,1.0.35,2022-06-13,1.0.35,2021-05-20,886
aws-embedded-metrics,commonjs,4.1.0,2023-01-25,2.0.6,2022-07-26,454
babel-jest,commonjs,29.7.0,2023-09-12,29.7.0,2023-09-12,42
babel-loader,commonjs,9.1.3,2023-07-07,9.1.3,2023-07-07,108
babel-plugin-dynamic-import-node,commonjs,2.3.3,2023-10-07,2.3.3,2020-04-21,1280
babel-plugin-transform-react-remove-prop-types,commonjs,0.4.24,2022-06-13,0.4.24,2019-02-01,1725
chromatic,commonjs,8.0.0--canary.839.6592471320.0,2023-10-23,6.17.4,2023-05-03,173
cli-table,commonjs,0.3.11,2023-04-12,0.3.11,2021-12-06,686
compression,commonjs,1.7.4,2023-07-12,1.7.4,2019-03-18,1680
compression-webpack-plugin,commonjs,10.0.0,2023-04-11,9.2.0,2021-12-16,676
copy-webpack-plugin,commonjs,11.0.0,2023-04-11,9.1.0,2021-11-11,711
core-js,commonjs,3.33.1,2023-10-20,3.30.2,2023-05-06,170
crypto,commonjs,1.0.1,2022-06-14,1.0.1,2017-08-10,2265
cypress,commonjs,13.3.2,2023-10-18,9.6.0,2022-04-25,546
cypress-axe,commonjs,1.5.0,2023-09-01,0.14.0,2022-01-04,657
cypress-multi-reporters,commonjs,2.0.1,2023-03-13,1.6.3,2023-03-13,224
cypress-terminal-report,commonjs,5.3.7,2023-09-28,4.0.3,2022-07-05,475
depcheck,commonjs,1.4.7,2023-10-17,1.4.7,2023-10-17,6
dotenv,commonjs,16.3.1,2023-06-17,16.0.3,2022-09-29,389
eslint,commonjs,8.52.0,2023-10-21,7.32.0,2021-07-30,815
eslint-config-airbnb,commonjs,19.0.4,2023-10-07,18.2.1,2020-11-06,1081
eslint-config-prettier,commonjs,9.0.0,2023-08-05,8.8.0,2023-03-20,217
eslint-import-resolver-alias,commonjs,1.1.2,2022-06-17,1.1.2,2018-12-08,1780
eslint-plugin-cypress,commonjs,2.15.1,2023-09-18,2.13.3,2023-04-28,178
eslint-plugin-import,commonjs,2.29.0,2023-10-23,2.27.5,2023-01-16,280
eslint-plugin-json,commonjs,3.1.0,2023-07-09,3.1.0,2021-08-06,809
eslint-plugin-jsx-a11y,commonjs,6.7.1,2023-01-12,6.7.1,2023-01-12,285
eslint-plugin-prettier,commonjs,5.0.1,2023-10-11,4.2.1,2022-06-30,481
eslint-plugin-react,commonjs,7.33.2,2023-09-24,7.32.2,2023-01-29,268
eslint-plugin-react-hooks,commonjs,5.0.0-next-fecc288b7-20221025,2023-10-23,4.6.0,2022-06-14,496
express,commonjs,5.0.0-beta.1,2023-10-21,4.18.2,2022-10-08,380
express-static-gzip,commonjs,2.1.7,2022-06-17,2.1.7,2022-05-17,525
fetch-mock,commonjs,9.11.0,2023-06-12,9.11.0,2020-11-21,1066
history,commonjs,5.3.0,2022-06-18,4.10.1,2019-09-13,1502
husky,commonjs,8.0.3,2023-06-09,8.0.3,2023-01-03,293
inspectpack,commonjs,4.7.1,2023-09-28,4.7.1,2021-03-24,943
intersection-observer,commonjs,0.12.2,2022-08-14,0.12.2,2022-06-14,496
isarray,commonjs,2.0.5,2023-07-12,2.0.5,2019-07-08,1568
isomorphic-fetch,commonjs,3.0.0,2022-06-19,3.0.0,2020-09-23,1126
jalaali-js,commonjs,1.2.6,2022-06-19,1.2.6,2022-05-18,524
jest,commonjs,29.7.0,2023-09-12,29.6.4,2023-08-24,60
jest-environment-jsdom,commonjs,29.7.0,2023-09-12,29.6.4,2023-08-24,60
jest-fetch-mock,commonjs,3.0.3,2022-06-19,3.0.3,2020-03-10,1323
jest-junit,commonjs,16.0.0,2023-04-15,13.2.0,2022-04-20,551
jest-serializer-html,commonjs,7.1.0,2023-10-18,7.1.0,2021-07-13,832
jest-silent-reporter,commonjs,0.5.0,2022-05-06,0.5.0,2021-03-10,958
js-cookie,commonjs,3.0.5,2023-08-20,3.0.5,2023-04-24,182
jsdom,commonjs,22.1.0,2023-05-27,19.0.0,2021-12-02,690
lru-cache,commonjs,10.0.1,2023-08-10,7.7.1,2022-03-18,585
minimist,commonjs,1.2.8,2023-06-09,1.2.8,2023-02-09,256
mkdirp,commonjs,3.0.1,2023-05-16,1.0.4,2020-04-03,1298
mocha,commonjs,10.2.0,2023-09-22,9.2.2,2022-03-11,591
mocha-junit-reporter,commonjs,2.2.1,2023-07-12,2.2.1,2023-07-12,103
moment,commonjs,2.29.4,2023-08-27,2.29.4,2022-07-06,474
moment-timezone,commonjs,0.5.43,2023-05-11,0.5.43,2023-03-31,206
morgan,commonjs,1.10.0,2023-02-21,1.10.0,2020-03-20,1312
npm-run-all,commonjs,4.1.5,2023-07-21,4.1.5,2018-11-24,1794
path-to-regexp,commonjs,6.2.1,2023-08-20,6.2.1,2022-05-06,535
polyfill-crypto.getrandomvalues,commonjs,1.0.0,2022-06-24,1.0.0,2016-03-05,2789
prop-types,commonjs,15.8.1,2023-08-24,15.8.1,2022-01-05,657
ramda,commonjs,0.29.1,2023-10-05,0.28.0,2022-01-16,646
react,commonjs,18.3.0-next-fecc288b7-20221025,2023-10-23,18.2.0,2022-06-14,496
react-dom,commonjs,18.3.0-next-fecc288b7-20221025,2023-10-23,18.2.0,2022-06-14,496
react-helmet,commonjs,6.1.0,2022-09-25,6.1.0,2020-06-08,1233
react-lazyload,commonjs,3.2.0,2022-06-26,3.2.0,2021-02-11,984
react-router-config,commonjs,5.1.1,2022-06-26,5.1.1,2019-09-28,1487
react-router-dom,commonjs,6.17.0,2023-10-20,5.3.4,2022-10-02,386
react-test-renderer,commonjs,18.3.0-next-fecc288b7-20221025,2023-10-23,18.2.0,2022-06-14,496
retry,commonjs,0.13.1,2022-06-26,0.13.1,2021-06-21,854
start-server-nestjs-webpack-plugin,commonjs,2.2.5,2022-05-18,2.2.5,2020-11-11,1076
storybook-addon-designs,commonjs,7.0.0-beta.2,2023-09-10,6.3.1,2022-06-13,497
stream-browserify,commonjs,3.0.0,2022-11-08,3.0.0,2020-04-16,1285
stylelint,commonjs,15.11.0,2023-10-17,13.13.1,2021-05-01,905
stylelint-config-recommended,commonjs,13.0.0,2023-07-04,7.0.0,2022-02-08,622
supertest,commonjs,6.3.3,2022-12-07,6.3.3,2022-12-07,320
terser-webpack-plugin,commonjs,5.3.9,2023-05-18,5.3.9,2023-05-18,159
ts-jest,commonjs,29.1.1,2023-06-30,29.1.1,2023-06-30,115
ts-loader,commonjs,9.5.0,2023-10-07,9.4.4,2023-06-28,117
typescript,commonjs,5.3.0-dev.20231023,2023-10-23,4.9.5,2023-01-30,266
url-parse,commonjs,1.5.10,2022-06-28,1.5.10,2022-02-22,608
uuid,commonjs,9.0.1,2023-09-12,8.3.2,2020-12-08,1049
wait-on,commonjs,7.0.1,2022-12-16,6.0.1,2022-02-11,620
webpack,commonjs,5.89.0,2023-10-21,5.82.1,2023-05-10,166
webpack-bundle-analyzer,commonjs,4.9.1,2023-08-30,4.8.0,2023-02-13,252
webpack-cli,commonjs,5.1.4,2023-06-07,4.10.0,2022-06-13,498
webpack-dev-server,commonjs,4.15.1,2023-06-09,4.15.0,2023-05-07,169
webpack-merge,commonjs,5.10.0,2023-10-16,5.8.0,2021-06-07,868
webpack-node-externals,commonjs,3.0.0,2022-06-29,3.0.0,2021-04-21,915
winston,commonjs,3.11.0,2023-10-07,3.8.2,2022-09-07,411
xmldoc,commonjs,1.3.0,2023-03-20,1.3.0,2023-03-20,217
yaml-js,commonjs,0.3.1,2023-07-12,0.3.1,2021-09-19,764
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"cypress:adhoc": "yarn cypress:interactive -- --project ./AdHocCypress/. --config-file cypress-simorgh.json",
"setupDevEnv": "cp envConfig/local.env .env && rm -rf envConfig/secret.env && ./scripts/checkSecretEnvVariables.sh",
"dependencyFreshness": "node ./scripts/dependencyFreshness",
"esmDependencyCheck": "node ./scripts/esmDependencyCheck.js",
"dev": "yarn setupDevEnv && rm -rf build && NODE_OPTIONS=--no-experimental-fetch run-p webpack:dev:client webpack:dev:server",
"lighthouse": "./scripts/lighthouseRun.sh",
"postshrinkwrap": "test -z $CI && ./scripts/packagelockHttps.sh; git update-index --assume-unchanged .env",
Expand Down
17 changes: 17 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Scripts

## Instructions for esmDependencyCheck

This script was written with the intent to have a way to quickly check if any of our dependencies are ESM (instead of CommonJS), and with that knowledge make the decision if and when to upgrade or replace them based on the fact that changing to ESM can be difficult. It may become less difficult in the future as the ecosystem matures.

Run the script using the following command: `yarn run esmDependencyCheck`

In order to use this script locally, you need to use a GIT_TOKEN. It is easier to add GIT_TOKEN as an environment variable, because the .env file gets overwritten every time you do a yarn dev. The environment variable GITHUB_TOKEN is available in Github Actions & CodeBuild, which will allow the script to run, and we will call our variable the same name to match.

Add GITHUB_TOKEN to your bash profile (in the same way we do the BFF_PATH), e.g add the line 'export GITHUB_TOKEN="ghp_blablablamadeuptokenblablablablabla"'. For information on how to get your personal access git token to use for this, see 'https://docs.github.com/en/[email protected]/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens'

You could also just use GITHUB_TOKEN on the command line when you run the command e.g. GITHUB_TOKEN=XXX yarn run esmDependencyCheck.



Other script instructions can be added above or below
Loading

0 comments on commit 49f0e56

Please sign in to comment.