-
Notifications
You must be signed in to change notification settings - Fork 142
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
Support Node 16 #965
Support Node 16 #965
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raiyaj we have some other incoming changes like React 18. That one in particular is breaking / not backwards compatible. My main interest is to verify that this is backwards compatible with node 14 so we don't have to do a major version bump?
35ca1cd
to
6684628
Compare
1474291
to
614549f
Compare
@@ -30,7 +30,7 @@ jobs: | |||
pwa-kit: | |||
strategy: | |||
matrix: | |||
node: [14] | |||
node: [14, 16] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also trigger a Node 16 build on Windows by adding 16 to the windows job matrix, please?
pwa-kit/.github/workflows/test.yml
Lines 119 to 124 in 8b235fa
pwa-kit-windows: | |
strategy: | |
# TODO: We don't *need* a matrix with single values, | |
# but is it worth keeping for supporting multiple versions in the future? | |
matrix: | |
node: [14] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Waiting to see if the tests pass 🤞🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, @raiyaj since Node 16 is the active Node version, Do you mind also updating the generated builds to use Node 16?
pwa-kit/.github/workflows/test.yml
Line 160 in ea563c5
node-version: 14 |
pwa-kit/.github/workflows/test.yml
Line 250 in ea563c5
node-version: 14 |
const candidates = [ | ||
resolve(projectDir, 'node_modules', pkg), | ||
resolve(__dirname, '..', '..', 'node_modules', pkg), | ||
resolve(__dirname, '..', '..', '..', 'node_modules', pkg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good finding @raiyaj!
It looks like we don't need the last one since we saw that generates the wrong path with the duplicated node_modules
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Adam! I was thinking of removing it initially, but I added some logging here (in the Setup Ubuntu Machine step), and saw that when a project is generated in CI, __dirname
is /home/runner/work/pwa-kit/pwa-kit/packages/pwa-kit-dev/dist/configs/webpack
, whereas locally it's /Users/rjessa/generated-test-project/node_modules/pwa-kit-dev/configs/webpack
, so we need to try both options.
I copied the candidates
idea from here, where we do something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method's name findInProjectThenSDK
implies two places but we now look at three places.
It can be confusing for anyone else looking at the logic or facing a similar problem in the future.
@raiyaj Do you mind leaving a comment in the code explaining why we need to do this to support NPM 7 and Node 16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last #965 (comment) to document the change in the Webpack config to provide a bit of context for engineers looking at that in the future.
Thanks @raiyaj, Looks good to me!
Congrats on solving all the issues 🎉
@raiyaj I saw a problem with the change we did to the If we follow the current approach, we need a new env variable to designate the unique/main build and update the conditional to include that env variable and guarantee we run the steps only once.
|
- name: Create MRT credentials file |
pwa-kit/.github/workflows/test.yml
Line 76 in 38dbed1
- name: Push Bundle to MRT (Development) |
pwa-kit/.github/workflows/test.yml
Line 83 in 38dbed1
- name: Push Bundle to MRT (Production) |
pwa-kit/.github/workflows/test.yml
Line 90 in 38dbed1
- name: Push Bundle to MRT (Commerce SDK React) |
pwa-kit/.github/workflows/test.yml
Line 101 in 38dbed1
- name: Publish to NPM |
#### generated
job
pwa-kit/.github/workflows/test.yml
Line 216 in 38dbed1
- name: Create MRT credentials file pwa-kit/.github/workflows/test.yml
Line 223 in 38dbed1
- name: Push Bundle to MRT
Edit: As @raiyaj saw, we don't need to change the generated builds for now.
* develop: Support Node 16 (#965) [W-12450361] Introduce short-circuit method for bypassing auth in Commerce Provider by passing in a fetchedToken (#1010) remove jest-silent-reporter (#1009) Clean up Page Designer Code (#1004) [Shopper Experience] `ImageWithText` component (#991) Feature: Page Designer Carousel Component (#977) [Feature] Page Designer Layout Components WIP (#993) remove updatePw from not implemented list (#996) Back-port Shopper Experience Base Components into Retail Template (#992) # Conflicts: # packages/commerce-sdk-react/package-lock.json # packages/commerce-sdk-react/package.json # packages/pwa-kit-dev/package-lock.json # packages/pwa-kit-dev/src/configs/webpack/config.js # packages/template-retail-react-app/package-lock.json
Add support for node 16 by deleting
PerformanceTimer
class, and make node 16 the default version for new projects.GUS: W-12399737
Description
Over on MRT, we're working on enabling platform-level support for node 16 apps. It currently doesn't work if the app depends on
pwa-kit-runtime
because of an issue withPerformanceTimer
, our custom wrapper around the builtin nodeperf_hooks
API. It turns out that we don't usePerformanceTimer
for anything useful (it gathers metrics that we emit to CloudWatch, but Lambda automatically emits the same metrics to CloudWatch). Since the class is marked as@private
, this deletes it (which is not a breaking change) and adds explicit support for node 16.Types of Changes
Changes
PerformanceTimer
and all its usagespackage.json
s, and make16.x
the default node version for new projectscreate-mobify-app-dev.js
to account for breaking changes in npm 7retail-react-app
tests, which were mostly failing due to race conditions that were uncovered with the switch to node 16, because the test execution environment became fasterws
dependency #865[email protected]
), but somehow didn't make it into the next normal release, so runningnpm run tail-logs
in a newly-generated project returns an error.How to Test-Drive This PR
npm ci
at the root of this reponvm use <node-version>
, then generate a new project:cd
to the project, then runnpm start
. The app should load in the browser without errors.~/.mobify
, then deploy your bundle to MRT:npm run push -- -s <project-slug> -t <target-slug>
16.x
npm run tail-logs -- -p scaffold-pwa -e production
and ensure logs appear after a few seconds.Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization