diff --git a/.circleci/config.yml b/.circleci/config.yml index 82d5141..98f4569 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: 'node:14' + - image: 'node:18.10.0' dependencies: pre: - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc' @@ -15,7 +15,7 @@ jobs: key: 'v1-dependencies-{{ checksum "package.json" }}' deploy: docker: - - image: 'node:14' + - image: 'node:18.10.0' steps: - checkout - restore_cache: @@ -25,7 +25,7 @@ jobs: - run: npx semantic-release lint: docker: - - image: 'node:14' + - image: 'node:18.10.0' steps: - checkout - restore_cache: @@ -35,7 +35,7 @@ jobs: - run: npm run lint test: docker: - - image: 'node:14' + - image: 'node:18.10.0' steps: - checkout - restore_cache: diff --git a/.eslintrc b/.eslintrc index a712adc..81014e8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,6 @@ { "root": true, - "parser": "espree", + "parser": "@babel/eslint-parser", "extends": [ "plugin:node/recommended", "plugin:promise/recommended", @@ -13,6 +13,10 @@ "jasmine": true }, "parserOptions": { + "requireConfigFile": false, + "babelOptions": { + "plugins": ["@babel/plugin-syntax-import-assertions"] + }, "sourceType": "module", "ecmaVersion": 12, "ecmaFeatures": { diff --git a/.nvmrc b/.nvmrc index 31102b2..5036cb7 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -14.18.1 +18.10.0 diff --git a/README.md b/README.md index e493cd2..034505d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The CLI is the quickest and easiest way to develop on Open Commerce. It allows y --- Before you can use the Open Commerce CLI, ensure you have all the base requirements for your operating system: - We recommend installing [nvm](https://github.com/nvm-sh/nvm) -- [14.18.1 ≤ Node version < 16](https://nodejs.org/ja/blog/release/v14.18.1/) +- [16 ≤ Node version < 18.10.0](https://nodejs.org/ja/blog/release/v18.10.0/) - [Yarn](https://yarnpkg.com/cli/install) - [Git](https://git-scm.com/) - [Docker](https://www.docker.com/get-started/) diff --git a/commands/develop-storefront.js b/commands/develop-storefront.js index 6152501..dbc65e7 100644 --- a/commands/develop-storefront.js +++ b/commands/develop-storefront.js @@ -11,7 +11,7 @@ import checkBeforeDevelop from "../utils/checkBeforeDevelop.js"; export default async function developStorefront(options) { if (!await checkBeforeDevelop("storefront")) return; Logger.info("Starting Open Commerce Admin Application Server in dev mode", { options }); - const storefront = spawn("yarn", ["run", "start:dev"]); + const storefront = spawn("yarn", ["run", "start:dev:latest"]); storefront.stdout.on("data", (data) => { // eslint-disable-next-line no-console console.log(data.toString().trim()); // Echo output of command to console diff --git a/package-lock.json b/package-lock.json index babbeb3..1999502 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,8 @@ "reaction": "index.js" }, "devDependencies": { + "@babel/eslint-parser": "^7.18.9", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@commitlint/cli": "^16.0.2", "@commitlint/config-conventional": "^16.0.0", "babel-eslint": "^10.1.0", @@ -53,7 +55,7 @@ "semantic-release": "^18.0.1" }, "engines": { - "node": ">=14.18.1" + "node": ">=18.10.0" } }, "node_modules/@ampproject/remapping": { @@ -124,6 +126,42 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/eslint-parser": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz", + "integrity": "sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==", + "dev": true, + "dependencies": { + "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.11.0", + "eslint": "^7.5.0 || ^8.0.0" + } + }, + "node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@babel/eslint-parser/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/generator": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", @@ -236,9 +274,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz", - "integrity": "sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "engines": { "node": ">=6.9.0" } @@ -415,6 +453,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.19.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", @@ -1618,6 +1671,37 @@ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz", "integrity": "sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg==" }, + "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { + "version": "5.1.1-v1", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", + "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", + "dev": true, + "dependencies": { + "eslint-scope": "5.1.1" + } + }, + "node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -14898,6 +14982,31 @@ } } }, + "@babel/eslint-parser": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz", + "integrity": "sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==", + "dev": true, + "requires": { + "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "@babel/generator": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", @@ -14984,9 +15093,9 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.17.12.tgz", - "integrity": "sha512-JDkf04mqtN3y4iAbO1hv9U2ARpPyPL1zqyWs/2WG1pgSq9llHFjStX5jdxb84himgJm+8Ng+x0oiWF/nw/XQKA==" + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==" }, "@babel/helper-simple-access": { "version": "7.18.2", @@ -15114,6 +15223,15 @@ "@babel/helper-plugin-utils": "^7.12.13" } }, + "@babel/plugin-syntax-import-assertions": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.19.0" + } + }, "@babel/plugin-syntax-import-meta": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", @@ -16034,6 +16152,33 @@ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.3.tgz", "integrity": "sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg==" }, + "@nicolo-ribaudo/eslint-scope-5-internals": { + "version": "5.1.1-v1", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", + "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", + "dev": true, + "requires": { + "eslint-scope": "5.1.1" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -25812,4 +25957,4 @@ "dev": true } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 536124e..5408805 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "reaction": "index.js" }, "engines": { - "node": ">=14.18.1" + "node": ">=18.10.0" }, "type": "module", "scripts": { @@ -53,6 +53,8 @@ "@commitlint/cli": "^16.0.2", "@commitlint/config-conventional": "^16.0.0", "babel-eslint": "^10.1.0", + "@babel/eslint-parser": "^7.18.9", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "eslint": "^8.7.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-jest": "^27.0.1", diff --git a/templates/api-project/custom-packages/simple-example/index.js b/templates/api-project/custom-packages/simple-example/index.js index 1be9620..be1f1ec 100644 --- a/templates/api-project/custom-packages/simple-example/index.js +++ b/templates/api-project/custom-packages/simple-example/index.js @@ -1,7 +1,7 @@ // This plugin example is only to show you how plugins can be added. For a more complete plugin template // use the `create-plugin` command import Logger from "@reactioncommerce/logger"; -import packageData from "./package.json"; +import packageData from "./package.json" assert { type: "json" }; const { version } = packageData; diff --git a/templates/api-project/custom-packages/simple-example/package.json b/templates/api-project/custom-packages/simple-example/package.json index acb4fff..625e08e 100644 --- a/templates/api-project/custom-packages/simple-example/package.json +++ b/templates/api-project/custom-packages/simple-example/package.json @@ -8,7 +8,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "engines": { - "node": ">=14.18.1" + "node": ">=18.10.0" }, "author": "", "license": "MIT", diff --git a/templates/api-project/index.js b/templates/api-project/index.js index 39bca58..0356e2d 100644 --- a/templates/api-project/index.js +++ b/templates/api-project/index.js @@ -1,7 +1,7 @@ import { importPluginsJSONFile, ReactionAPICore } from "@reactioncommerce/api-core"; import dotenv from "dotenv"; import Logger from "@reactioncommerce/logger"; -import packageJson from "./package.json"; +import packageJson from "./package.json" assert { type: "json" }; const api = new ReactionAPICore({ serveStaticPaths: ["public"], diff --git a/test_plan.md b/test_plan.md index dfa996d..224a5c4 100644 --- a/test_plan.md +++ b/test_plan.md @@ -1,6 +1,6 @@ # CLI manual test plan -## Using Node 14.18.1 +## Using Node 18.10.0 1. Clone this repo to your local machine 2. Install package as global (`npm install -g`) diff --git a/tests/create-api-project.js b/tests/create-api-project.js index 5a26359..991ea2f 100644 --- a/tests/create-api-project.js +++ b/tests/create-api-project.js @@ -14,10 +14,10 @@ beforeEach(async () => { }); describe("the node used for tests", () => { - it("should be 14 or 16", async () => { + it("should be 16 to 18", async () => { const response = await execute("--version", []); // eslint-disable-next-line jest/valid-expect - expect(response.trim().split(".")[0]).to.oneOf(["v15", "v14"]); + expect(response.trim().split(".")[0]).to.oneOf(["v16", "v17", "v18"]); }); }); @@ -27,7 +27,7 @@ describe("The create-project-api command", () => { const responseLines = response.trim().split(EOL); // eslint-disable-next-line jest/valid-expect expect(responseLines[1]).to.equal("reaction-cli: Project creation complete. Change to your directory and run `npm install`"); - }).timeout(15000); + }).timeout(25000); }); afterEach(async () => { diff --git a/utils/checkDependencies.js b/utils/checkDependencies.js index 3b49988..16d6c77 100644 --- a/utils/checkDependencies.js +++ b/utils/checkDependencies.js @@ -2,7 +2,7 @@ import { spawn } from "child_process"; import { sync as cmdExists } from "command-exists"; import Logger from "./logger.js"; -const supportedNodeVersions = ["v14", "v15"]; +const supportedNodeVersions = ["v16", "v17", "v18"]; /** * @summary validate that we are using a supported version of node @@ -18,8 +18,8 @@ async function checkNodeVersion() { Logger.error(`Your node version must be one of: [ ${supportedNodeVersions.join(", ")} ]`); resolve(nodeOk); } - if (majorVersion === "v14" && minorVersion < "18") { - Logger.error("Your node version must be greater or equal to 14.18.1 and less than 16"); + if (majorVersion === "v18" && minorVersion > "10") { + Logger.error("Your node version must be greater than 16 and lesser or equal to 18.10.0"); resolve(nodeOk); } nodeOk = true;