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

Upgrade Node to 18 #6740

Merged
merged 39 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9737776
feat: node18 install babel plugin importAssert
sujithvn Jan 4, 2023
6b99174
feat: node18 plugins changes
sujithvn Jan 4, 2023
7946bb0
feat: node18 config files update
sujithvn Jan 4, 2023
26ddd1e
feat: node18 for sampledata
sujithvn Jan 4, 2023
bb13d59
fix: circleCI config changes
sujithvn Jan 4, 2023
2833778
fix: changed ubuntu from latest 22 to focal 20
sujithvn Jan 10, 2023
04969c9
fix: node18 in github workflow
sujithvn Jan 10, 2023
750a248
fix: node 18.12.1 to 18.10.0 ubuntu mongo compat
sujithvn Jan 10, 2023
f3cfbd0
fix: eslint config fix
sujithvn Jan 10, 2023
087dff4
fix: eslint babel config chg
sujithvn Jan 11, 2023
2cd7569
fix: test with forceExit
sujithvn Jan 19, 2023
aed09e6
fix: set no_output_timeout 30m
sujithvn Jan 19, 2023
7f18163
test: test with node 16.10.0
sujithvn Jan 20, 2023
8ae4b1d
test: test with node16
sujithvn Jan 20, 2023
e81f557
fix: jest confog change for test
sujithvn Jan 20, 2023
a78ac3b
fix: switch back to node 18
sujithvn Jan 20, 2023
8b2cc79
fix: jest upgrade v25 to v29
sujithvn Feb 21, 2023
9e55788
fix: pnpm.lock with jest changes
sujithvn Feb 21, 2023
afe5bc9
fix: upgrade memory to 8K for integration mutation
sujithvn Feb 21, 2023
a2dac3e
fix: remove --runInBand jest flag
brent-hoover Feb 22, 2023
0a798ad
fix: remove another --runInBand jest flag
Feb 22, 2023
cc2773d
fix: add max_old_space_size back
brent-hoover Feb 22, 2023
50157e2
fix: upgrade circle resource_class to large
brent-hoover Feb 22, 2023
edd0b03
fix: run correct tests
brent-hoover Feb 22, 2023
30997ca
fix: temporarily comment out query tests
brent-hoover Feb 22, 2023
def3966
fix: put all flags back except runInBand
brent-hoover Feb 22, 2023
126bbc5
fix: add maxWorkers
brent-hoover Feb 22, 2023
60c67ef
fix: put runInBand back
brent-hoover Feb 22, 2023
eea2676
fix: run all tests again
brent-hoover Feb 22, 2023
c2eaf96
fix: make test run consistent
brent-hoover Feb 22, 2023
4c67a47
fix: remove --forceExit
sujithvn Mar 2, 2023
1cbfcd2
fix: require to import with assert for .json
sujithvn Mar 2, 2023
fee4dbe
fix: import correction and changeset
sujithvn Mar 3, 2023
d0bb6cf
fix: linter error fix
sujithvn Mar 3, 2023
abfaed1
fix: require import reverted
sujithvn Mar 16, 2023
02d0a0e
Merge branch 'release-5' into upgrade-node-to-18
sujithvn Apr 20, 2023
165774e
fix: pnpm-lock after install
sujithvn Apr 20, 2023
410c373
Merge branch 'release-5' into upgrade-node-to-18
sujithvn May 23, 2023
b309747
fix: remove jest config
sujithvn May 23, 2023
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
44 changes: 44 additions & 0 deletions .changeset/strange-terms-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
"@reactioncommerce/api-core": major
"@reactioncommerce/api-plugin-accounts": major
"@reactioncommerce/api-plugin-address-validation": major
"@reactioncommerce/api-plugin-address-validation-test": major
"@reactioncommerce/api-plugin-authentication": major
"@reactioncommerce/api-plugin-authorization-simple": major
"@reactioncommerce/api-plugin-carts": major
"@reactioncommerce/api-plugin-catalogs": major
"@reactioncommerce/api-plugin-discounts": major
"@reactioncommerce/api-plugin-discounts-codes": major
"@reactioncommerce/api-plugin-email": major
"@reactioncommerce/api-plugin-email-smtp": major
"@reactioncommerce/api-plugin-email-templates": major
"@reactioncommerce/api-plugin-files": major
"@reactioncommerce/api-plugin-i18n": major
"@reactioncommerce/api-plugin-inventory": major
"@reactioncommerce/api-plugin-inventory-simple": major
"@reactioncommerce/api-plugin-job-queue": major
"@reactioncommerce/api-plugin-navigation": major
"@reactioncommerce/api-plugin-notifications": major
"@reactioncommerce/api-plugin-orders": major
"@reactioncommerce/api-plugin-payments": major
"@reactioncommerce/api-plugin-payments-example": major
"@reactioncommerce/api-plugin-payments-stripe-sca": major
"@reactioncommerce/api-plugin-pricing-simple": major
"@reactioncommerce/api-plugin-products": major
"@reactioncommerce/api-plugin-sample-data": major
"@reactioncommerce/api-plugin-settings": major
"@reactioncommerce/api-plugin-shipments": major
"@reactioncommerce/api-plugin-shipments-flat-rate": major
"@reactioncommerce/api-plugin-shops": major
"@reactioncommerce/api-plugin-simple-schema": major
"@reactioncommerce/api-plugin-sitemap-generator": major
"@reactioncommerce/api-plugin-surcharges": major
"@reactioncommerce/api-plugin-system-information": major
"@reactioncommerce/api-plugin-tags": major
"@reactioncommerce/api-plugin-taxes": major
"@reactioncommerce/api-plugin-taxes-flat-rate": major
"@reactioncommerce/api-plugin-translations": major
"@reactioncommerce/api-utils": major
---

Node18 upgrade includes assert json
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defaults: &defaults
DOCKER_NAMESPACE: "reactioncommerce"
DOCKER_NAME: "reaction"
docker:
- image: cimg/node:14.20.0
- image: cimg/node:18.10.0

install_pnpm: &install_pnpm
- run:
Expand Down Expand Up @@ -91,12 +91,14 @@ jobs:
- <<: *pnpm_install
- run:
name: Test Unit
no_output_timeout: 30m
command: pnpm test
resource_class: large

test-integration-query:
<<: *defaults
docker:
- image: cimg/node:14.20.0
- image: cimg/node:18.10.0
# Integration tests need MongoDB server running and accessible on port 27017
- image: mongo:4.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
Expand All @@ -119,11 +121,12 @@ jobs:
sudo apt update && sudo apt-get install -y mongodb
mongo --eval "rs.initiate()"
pnpm run test:integration:query
resource_class: large

test-integration-mutation:
<<: *defaults
docker:
- image: cimg/node:14.20.0
- image: cimg/node:18.10.0
# Integration tests need MongoDB server running and accessible on port 27017
- image: mongo:4.0
command: mongod --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger
Expand All @@ -146,6 +149,7 @@ jobs:
sudo apt update && sudo apt-get install -y mongodb
mongo --eval "rs.initiate()"
pnpm run test:integration:mutation
resource_class: large

release:
<<: *defaults
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
babelOptions: {
plugins: ["@babel/plugin-syntax-import-assertions"]
},
ecmaFeatures: {
impliedStrict: true
},
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)

runs-on: ubuntu-latest
runs-on: ubuntu-focal

steps:
- uses: actions/checkout@v2
Expand All @@ -27,10 +27,10 @@ jobs:
key: reaction-v6-node-modules-${{ hashFiles('package.json') }}-${{ hashFiles('pnpm-lock.yaml') }}
path: "**/node_modules"

- name: Use Node.js 14.x
- name: Use Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 18

- name: Install pnpm
run: npm i -g pnpm@latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tagging-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: github.event.pull_request.merged == true && github.base_ref == 'trunk' && github.head_ref == 'changeset-release/trunk'
permissions:
contents: write # to create release (changesets/action)
runs-on: ubuntu-latest
runs-on: ubuntu-focal

steps:
- uses: actions/checkout@v2
Expand All @@ -22,10 +22,10 @@ jobs:
run: |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
- name: Use Node.js 14.x
- name: Use Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 18

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.20.0
18.10.0
4 changes: 2 additions & 2 deletions apps/reaction/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dockerfile for production builds
# syntax=docker/dockerfile:1.4

FROM node:14.20.0-alpine as deps
FROM node:18.10.0-alpine as deps

# hadolint ignore=DL3018
RUN apk --no-cache add bash less curl make g++ glib
Expand All @@ -17,7 +17,7 @@ RUN pnpm --filter=reaction --prod deploy deps --ignore-scripts
# hadolint ignore=DL3003,SC2015
RUN cd deps/node_modules/sharp && npm run install

FROM node:14.20.0-alpine
FROM node:18.10.0-alpine

# hadolint ignore=DL3018
RUN apk --no-cache add bash less tini vim curl
Expand Down
3 changes: 2 additions & 1 deletion apps/reaction/babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ module.exports = function (api) { // eslint-disable-line no-undef
"@babel/preset-env",
{
targets: {
node: "12"
node: "18"
}
}
]
],
plugins: [
"babel-plugin-transform-import-meta",
"@babel/plugin-syntax-import-assertions",
"module:@reactioncommerce/babel-remove-es-create-require",
"rewire-exports",
"transform-es2015-modules-commonjs"
Expand Down
7 changes: 6 additions & 1 deletion apps/reaction/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ const jestConfig = {
// testResultsProcessor: null,

// This option allows use of a custom test runner
// testRunner: "jasmine2",
testRunner: "jasmine2",

snapshotFormat: {
escapeString: true,
printBasicPrototype: true
},

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
Expand Down
10 changes: 5 additions & 5 deletions apps/reaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./src/index.js",
"type": "module",
"engines": {
"node": ">=14.18.1"
"node": ">=18.10.0"
},
"homepage": "https://github.com/reactioncommerce/reaction",
"url": "https://github.com/reactioncommerce/reaction",
Expand Down Expand Up @@ -90,12 +90,12 @@
"inspect:docker": "NODE_ENV=development nodemon --preserve-symlinks --experimental-modules --experimental-json-modules --inspect=0.0.0.0:9229 ./src/index.js",
"inspect-brk:docker": "NODE_ENV=development nodemon --preserve-symlinks --experimental-modules --experimental-json-modules --inspect-brk=0.0.0.0:9229 ./src/index.js",
"check-node-version": "node ./src/checkNodeVersion.cjs",
"test:integration": "node --max_old_space_size=10000 node_modules/jest/bin/jest --runInBand --forceExit --testPathIgnorePatterns '<rootDir>/src/'",
"test:integration:watch": "node --max_old_space_size=10000 node_modules/jest/bin/jest --runInBand --watch --testPathIgnorePatterns '<rootDir>/src/'",
"test:integration": "node node_modules/jest/bin/jest --forceExit --testPathIgnorePatterns '<rootDir>/src/'",
"test:integration:watch": "node node_modules/jest/bin/jest --runInBand --watch --testPathIgnorePatterns '<rootDir>/src/'",
"test:integration:file": "jest --runInBand",
"test:integration:file:watch": "jest --runInBand --watch",
"test:integration:query": "node --max_old_space_size=4000 --expose-gc ../../node_modules/jest/bin/jest.js --logHeapUsage --runInBand --forceExit --testPathIgnorePatterns '<rootDir>/src/' '<rootDir>/tests/integration/api/mutations/'",
"test:integration:mutation": "node --max_old_space_size=4000 --expose-gc ../../node_modules/jest/bin/jest.js --logHeapUsage --runInBand --forceExit --testPathIgnorePatterns '<rootDir>/src/' '<rootDir>/tests/integration/api/queries/'",
"test:integration:query": "node --max-old-space-size=6144 --expose-gc ../../node_modules/jest/bin/jest.js --forceExit --runInBand --logHeapUsage --testPathIgnorePatterns '<rootDir>/src/' '<rootDir>/tests/integration/api/mutations/'",
"test:integration:mutation": "node --max_old_space_size=6144 --expose-gc ../../node_modules/jest/bin/jest.js --forceExit --runInBand --logHeapUsage --testPathIgnorePatterns '<rootDir>/src/' '<rootDir>/tests/integration/api/queries/'",
"lint": "eslint .",
"lint:gql": "graphql-schema-linter ./src/**/*.graphql",
"version": "echo $npm_package_version",
Expand Down
1 change: 0 additions & 1 deletion apps/reaction/src/checkNodeVersion.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// This must not be an ES module because we want
// this check to work on older Node versions that
// do not support ES modules.

const semver = require("semver");
const packageJson = require("../package.json");

Expand Down
2 changes: 1 addition & 1 deletion apps/reaction/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { importPluginsJSONFile, ReactionAPICore } from "@reactioncommerce/api-core";
import Logger from "@reactioncommerce/logger";
import packageJson from "../package.json";
import packageJson from "../package.json" assert { type: "json" };

const api = new ReactionAPICore({
serveStaticPaths: ["public"],
Expand Down
5 changes: 1 addition & 4 deletions apps/reaction/tests/util/setupJestTests.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable no-undef */
import { createRequire } from "module";

const require = createRequire(import.meta.url);
const jestProcessEnv = require("./jestProcessEnv.json");
import jestProcessEnv from "./jestProcessEnv.json" assert { type: "json" };

process.env = Object.assign(process.env, {
...jestProcessEnv
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Reaction is a modern reactive, real-time event driven ecommerce platform.",
"main": "index.js",
"engines": {
"node": ">=14.18.1",
"node": ">=18.10.0",
"npm": ">=7"
},
"engineStrict": true,
Expand Down Expand Up @@ -44,6 +44,7 @@
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.10",
"@babel/eslint-parser": "^7.18.9",
"@babel/plugin-syntax-import-assertions": "^7.20.0",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-env": "^7.19.0",
"@commitlint/config-conventional": "^17.0.3",
Expand All @@ -65,7 +66,8 @@
"husky": "^5.0.8",
"is-ci": "^2.0.0",
"is-docker": "^2.1.1",
"jest": "^25.5.4",
"jest": "^29.4.3",
"jest-jasmine2": "^29.4.3",
"nodemon": "~1.19.2"
},
"graphql-schema-linter": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-core/src/importPluginsJSONFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default async function importPluginsJSONFile(pluginsFile, transformPlugin
absolutePluginsFile = path.join(path.dirname(callerFileName), pluginsFile);
}

let { default: pluginRefs } = await import(absolutePluginsFile);
let { default: pluginRefs } = await import(`${absolutePluginsFile}`, { assert: { type: "json" } });

if (typeof transformPlugins === "function") {
// allow plugins to be added and removed
Expand Down
48 changes: 24 additions & 24 deletions packages/api-plugin-accounts/src/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import ar from "./ar.json";
import bg from "./bg.json";
import cs from "./cs.json";
import de from "./de.json";
import el from "./el.json";
import en from "./en.json";
import es from "./es.json";
import fr from "./fr.json";
import he from "./he.json";
import hr from "./hr.json";
import hu from "./hu.json";
import it from "./it.json";
import my from "./my.json";
import nb from "./nb.json";
import nl from "./nl.json";
import pl from "./pl.json";
import pt from "./pt.json";
import ro from "./ro.json";
import ru from "./ru.json";
import sl from "./sl.json";
import sv from "./sv.json";
import tr from "./tr.json";
import vi from "./vi.json";
import zh from "./zh.json";
import ar from "./ar.json" assert { type: "json" };
import bg from "./bg.json" assert { type: "json" };
import cs from "./cs.json" assert { type: "json" };
import de from "./de.json" assert { type: "json" };
import el from "./el.json" assert { type: "json" };
import en from "./en.json" assert { type: "json" };
import es from "./es.json" assert { type: "json" };
import fr from "./fr.json" assert { type: "json" };
import he from "./he.json" assert { type: "json" };
import hr from "./hr.json" assert { type: "json" };
import hu from "./hu.json" assert { type: "json" };
import it from "./it.json" assert { type: "json" };
import my from "./my.json" assert { type: "json" };
import nb from "./nb.json" assert { type: "json" };
import nl from "./nl.json" assert { type: "json" };
import pl from "./pl.json" assert { type: "json" };
import pt from "./pt.json" assert { type: "json" };
import ro from "./ro.json" assert { type: "json" };
import ru from "./ru.json" assert { type: "json" };
import sl from "./sl.json" assert { type: "json" };
import sv from "./sv.json" assert { type: "json" };
import tr from "./tr.json" assert { type: "json" };
import vi from "./vi.json" assert { type: "json" };
import zh from "./zh.json" assert { type: "json" };

//
// we want all the files in individual
Expand Down
4 changes: 2 additions & 2 deletions packages/api-plugin-accounts/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import i18n from "./i18n/index.js";
import mutations from "./mutations/index.js";
import policies from "./policies.json";
import policies from "./policies.json" assert { type: "json" };
import queries from "./queries/index.js";
import resolvers from "./resolvers/index.js";
import schemas from "./schemas/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/api-plugin-address-validation-test/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import addressValidation from "./addressValidation.js";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/api-plugin-address-validation/src/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import en from "./en.json";
import es from "./es.json";
import en from "./en.json" assert { type: "json" };
import es from "./es.json" assert { type: "json" };

//
// we want all the files in individual
Expand Down
4 changes: 2 additions & 2 deletions packages/api-plugin-address-validation/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import i18n from "./i18n/index.js";
import mutations from "./mutations/index.js";
import policies from "./policies.json";
import policies from "./policies.json" assert { type: "json" };
import queries from "./queries/index.js";
import { registerPluginHandlerForAddress } from "./registration.js";
import resolvers from "./resolvers/index.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/api-plugin-authentication/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import tokenMiddleware from "./util/tokenMiddleware.js";
import getAccounts from "./util/accountServer.js";
import wsAuthenticate from "./util/wsAuthenticate.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/api-plugin-authorization-simple/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import { getHasPermissionFunctionForUser } from "./util/hasPermission.js";
import permissionsByUserId from "./util/permissionsByUserId.js";
import preStartup from "./preStartup.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/api-plugin-carts/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pkg from "../package.json";
import pkg from "../package.json" assert { type: "json" };
import mutations from "./mutations/index.js";
import policies from "./policies.json";
import policies from "./policies.json" assert { type: "json" };
import queries from "./queries/index.js";
import resolvers from "./resolvers/index.js";
import schemas from "./schemas/index.js";
Expand Down
Loading