enterprise icon indicating copy to clipboard operation
enterprise copied to clipboard

6634 - Update all dependencies and use Node 16 for IDS 4.x

Open ericangeles opened this issue 2 years ago • 2 comments

Explain the details for making this change. What existing problem does the pull request solve?

Related github/jira issue (required):

Steps necessary to review your pull request (required):

Included in this Pull Request:

  • [ ] An e2e or functional test for the bug or feature.
  • [ ] A note to the change log.

ericangeles avatar Aug 11 '22 19:08 ericangeles

A couple things initially

  1. i get this running npm i (fresh node_modules)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @axe-core/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/puppeteer
npm WARN   dev puppeteer@"^16.1.0" from the root project
npm WARN   2 more (@wordpress/jest-puppeteer-axe, jest-puppeteer)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer puppeteer@">=1.10.0 <= 13" from @axe-core/[email protected]
npm WARN node_modules/@wordpress/jest-puppeteer-axe/node_modules/@axe-core/puppeteer
npm WARN   @axe-core/puppeteer@"^4.0.0" from @wordpress/[email protected]
npm WARN   node_modules/@wordpress/jest-puppeteer-axe
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/puppeteer
npm WARN   peer puppeteer@">=1.10.0 <= 13" from @axe-core/[email protected]
npm WARN   node_modules/@wordpress/jest-puppeteer-axe/node_modules/@axe-core/puppeteer
npm WARN     @axe-core/puppeteer@"^4.0.0" from @wordpress/[email protected]
npm WARN     node_modules/@wordpress/jest-puppeteer-axe

To fix this that on WC i did this: https://github.com/infor-design/enterprise-wc/pull/846 (had to stay on Puppetter 15 for now)

  1. If upgrading d3 need to test every chart (may be breaking api changes to adjust) but
  2. i couldnt do npm run start to test nor npm run build
ile:///Users/tmcconechy/Dev/enterprise/scripts/build.js:89
const SRC_DIR = path.join(__dirname, '..', 'src');
                          ^

ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/Users/tmcconechy/Dev/enterprise/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

tmcconechy avatar Aug 11 '22 19:08 tmcconechy

Looping @EdwardCoyle and @deep7102 in on this PR.

danielortiz1982 avatar Aug 23 '22 13:08 danielortiz1982

One note: You might as well just go to 18.12.1 as it is now the LTS. It wasnt hard too go from 16 to 18 for me in WC project. Make sure to recheck the dependencies as maybe new ones are updated since you started

tmcconechy avatar Nov 09 '22 14:11 tmcconechy

@tmcconechy was thinking that too since I encountered a couple issues with node 16. Thanks!

ericangeles avatar Nov 09 '22 15:11 ericangeles

@ericangeles fixed some things in this running list https://github.com/infor-design/enterprise/pull/6731#pullrequestreview-1196124616

Stoped at npm run build:full something is wrong with minifying the build, will resume next week.

tmcconechy avatar Dec 02 '22 21:12 tmcconechy

@tmcconechy I can go through the tests you listed.

ericangeles avatar Dec 06 '22 14:12 ericangeles

@ericangeles do you have any idea why the tests dont run? I tried to figure that out but i got stuck. I can look at the charts some more because now i know what needs to be changed....

  • i'll test those charts - you can test them but if one errors i might know why
  • you check into making npm run test work? I have a feeling we might need to do something like change to jest or skip the protractor tests

tmcconechy avatar Dec 06 '22 14:12 tmcconechy

@tmcconechy, yep am currently working on that too.

ericangeles avatar Dec 06 '22 14:12 ericangeles

@tmcconechy think we need to update the karma.conf.js to es module to work.

ericangeles avatar Dec 06 '22 15:12 ericangeles

@ericangeles yes try that - we can also try to use cjs for it or if needed use jest to run the tests instead of karma. Or finally just drop the protractor tests. But we have 3 test configs to fix. Give it i try and i will pick up tomorrow.

tmcconechy avatar Dec 06 '22 16:12 tmcconechy

@EdwardCoyle & @deep7102 Can you please follow this PR and provide support where needed. Thanks!

danielortiz1982 avatar Dec 19 '22 15:12 danielortiz1982

A handful things I've found:

  • After switching to Node 18.12.1, running rm -rf node_modules && npm i, Everything installs but there are still some questionable versions of packages installed:
ecoyle@USROMECOYLE01 ~/dev/enterprise (6634-update-to-lts-node) $ rm -rf node_modules && npm i
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected].
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This module is not used anymore, and has been replaced by @npmcli/package-json
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: THIS PACKAGE IS NOT MAINTAINED ANYMORE DUE TO THE LACK OF ACTIVITY OF PROTRACTOR
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: WARNING: This project has been renamed to 'handlebars-wax'. Install that instead.
npm WARN deprecated [email protected]: We have news to share - Protractor is deprecated and will reach end-of-life by Summer 2023. To learn more and find out about other options please refer to this post on the Angular blog. Thank you for using and contributing to Protractor. https://goo.gle/state-of-e2e-in-angular
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 2446 packages, and audited 2447 packages in 46s

290 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (7 moderate, 9 high, 1 critical)
  • npm run build:release has a minor error where it can't find the /build folder -- seems to happen on the zip step:
> npm-build-zip

[Error: ENOENT: no such file or directory, scandir './build'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: './build'
}
  • I see that both test suites are called out in the comments above as not working... just wanted to provide stack traces in case those are useful:

Func tests (npm run functional:local)

  Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/ecoyle/dev/enterprise/test/karma.conf.js from /Users/ecoyle/dev/enterprise/node_modules/karma/lib/config.js not supported.
karma.conf.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename karma.conf.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/ecoyle/dev/enterprise/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at Object.parseConfig (/Users/ecoyle/dev/enterprise/node_modules/karma/lib/config.js:434:22)
    at exports.run (/Users/ecoyle/dev/enterprise/node_modules/karma/lib/cli.js:288:26)
    at Object.<anonymous> (/Users/ecoyle/dev/enterprise/node_modules/karma/bin/karma:3:23)

E2E tests (npm run e2e:local:debug)

ecoyle@USROMECOYLE01 ~/dev/enterprise (6634-update-to-lts-node) $ npm run e2e:local:debug

> [email protected] e2e:local:debug
> npm run webdriver:update && npx protractor test/protractor.local.debug.conf.js

> [email protected] webdriver:update
> npx webdriver-manager update --versions.chrome=107.0.5304.87 --standalone false --quiet --gecko=false

[15:11:44] I/file_manager - creating folder /Users/ecoyle/dev/enterprise/node_modules/webdriver-manager/selenium
[15:11:44] I/config_source - curl -o/Users/ecoyle/dev/enterprise/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Request instance at:
    at Request.onRequestError (/Users/ecoyle/dev/enterprise/node_modules/request/request.js:877:8)
    at ClientRequest.emit (node:events:525:35)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}

Node.js v18.12.1

Will check the components listed next

EdwardCoyle avatar Dec 19 '22 20:12 EdwardCoyle

Thanks for flagging @EdwardCoyle 🚀

danielortiz1982 avatar Dec 19 '22 20:12 danielortiz1982

Saw few stuff as: tests did not run npm run test documentation did not run npm run documentation

some deprecated warnings while npm install as below:

dverma@USMVDVERMA enterprise % rm -rf node_modules && npm i
npm WARN deprecated [email protected]: This module relies on Node.js's internals and will break at some point. Do not use it, and update to [email protected].
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This module is not used anymore, and has been replaced by @npmcli/package-json
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: WARNING: This project has been renamed to 'handlebars-wax'. Install that instead.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 2245 packages, and audited 2246 packages in 33s

288 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (7 moderate, 9 high, 1 critical)

deep7102 avatar Dec 22 '22 16:12 deep7102

Some of the updates/fixes,

  • running documentation script npm run documentation
  • npm run build:release (updated the zip dependency and made it worked) ✅
  • puppeteer script test ✅
  • e2e test script - in progress ❓

FYI @danielortiz1982 @EdwardCoyle @deep7102

ericangeles avatar Dec 29 '22 15:12 ericangeles

Here is my updated list

  • [x] fix failing tests in npm run e2e:puppeteer (Tim in progress)
  • [ ] add functional tests to jest test runner (Tim in progress)
  • [ ] move snap shots to a seperate file
  • [ ] https://github.com/infor-design/enterprise/actions/runs/3800131764/jobs/6463313000#step:8:38
  • [ ] checks in general - see about running them as mac instead
  • [ ] test each command in scripts in package.json (remove some)
  • [x] test dev release and custom build
  • [ ] Sync both package locks (Resync all dependencies in app/package.json and package.json)
  • [x] npm run build:release error (eds suggest)
  • [x] make an issue of some deprecation warnings and fix some on npm i -> some are release-it which we need

tmcconechy avatar Dec 29 '22 15:12 tmcconechy

Created an issue regarding deprecation warnings and vulnerability issues https://github.com/infor-design/enterprise/issues/7064

ericangeles avatar Jan 04 '23 08:01 ericangeles

List of all commands...

npm run build
npm run build:colors
npm run build:copy
npm run build:css
npm run build:demoapp
npm run build:full
npm run build:icons
npm run build:js
npm run build:release
npm run build:verify
npm run clean
npm run clean:app
npm run clean:dist
npm run clean:docs
npm run documentation
npm run eslint
npm run eslint:error-only
npm run eslint:log
npm run install-demo
npm run lint
npm run mdlint
npm run mdlint:docs
npm run mdlint:src
npm run minify
npm run quickstart
npm run quickstart:livereload
npm run release:alpha
npm run release:beta
npm run release:dev
npm run release:final
npm run release:rc
npm run start
npm run stop
npm run stylelint
npm run stylelint:demo
npm run stylelint:src
npm run test
npm run update-snapshots
npm run watch
npm run watch:js
npm run watch:scss
npm run webdriver:clean
npm run webdriver:update
npm run zip

tmcconechy avatar Jan 12 '23 16:01 tmcconechy