From d23d55e2f27b5d98488ae847b6ac42de62224efe Mon Sep 17 00:00:00 2001 From: Joe Lust Date: Thu, 20 Oct 2022 21:24:35 -0400 Subject: [PATCH] [IST-487] [MABL-8300] Dependency Updates, Optimize for Node.js 16 Actions (#18) --- .github/workflows/push-workflow.yaml | 15 +- README.md | 4 +- action.yml | 2 +- package-lock.json | 210 +++++++-------------------- package.json | 18 +-- src/index.ts | 19 ++- tsconfig.json | 4 +- 7 files changed, 90 insertions(+), 182 deletions(-) diff --git a/.github/workflows/push-workflow.yaml b/.github/workflows/push-workflow.yaml index 6994c30..e85de8f 100644 --- a/.github/workflows/push-workflow.yaml +++ b/.github/workflows/push-workflow.yaml @@ -8,12 +8,19 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-20.04, macos-latest, windows-latest ] + os: + - ubuntu-18.04 + - ubuntu-20.04 + - ubuntu-latest + - macos-latest + - windows-2019 + - windows-latest steps: - - uses: actions/checkout@main - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: '12.x' + # Use the minimum supported mabl-cli Node.js LTS version here + node-version: '14.x' - name: Install dependencies run: npm ci diff --git a/README.md b/README.md index 4a71fca..eb3fcbe 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ jobs: steps: - uses: actions/setup-node@v2 with: - node-version: '12.x' + node-version: '16.x' - uses: mablhq/setup-mabl-cli@v1 with: @@ -85,7 +85,7 @@ jobs: steps: - uses: actions/setup-node@v2 with: - node-version: '12.x' + node-version: '16.x' - uses: mablhq/setup-mabl-cli@v1 with: diff --git a/action.yml b/action.yml index a7042f7..2a78c85 100644 --- a/action.yml +++ b/action.yml @@ -14,5 +14,5 @@ inputs: description: (optional) The id of the workspace to configure as default for the CLI required: false runs: - using: "node12" + using: "node16" main: "lib/index.js" diff --git a/package-lock.json b/package-lock.json index 79ff797..4cae5c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,203 +1,91 @@ { "name": "setup-mabl-cli", - "version": "1.2.0", - "lockfileVersion": 2, + "version": "1.4.0", + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "version": "1.0.1", - "dependencies": { - "@actions/core": "^1.2.6", - "@actions/exec": "^1.0.4", - "@actions/tool-cache": "^1.6.1", - "@types/es6-promise": "^3.3.0" - }, - "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^12.20.4", - "@types/q": "^1.5.4", - "typescript": "^4.1.4" - } - }, - "node_modules/@actions/core": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", - "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" - }, - "node_modules/@actions/exec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", - "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", - "dependencies": { - "@actions/io": "^1.0.1" - } - }, - "node_modules/@actions/http-client": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz", - "integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==", - "dependencies": { - "tunnel": "0.0.6" - } - }, - "node_modules/@actions/io": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", - "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==" - }, - "node_modules/@actions/tool-cache": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.6.1.tgz", - "integrity": "sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==", - "dependencies": { - "@actions/core": "^1.2.6", - "@actions/exec": "^1.0.0", - "@actions/http-client": "^1.0.8", - "@actions/io": "^1.0.1", - "semver": "^6.1.0", - "uuid": "^3.3.2" - } - }, - "node_modules/@types/es6-promise": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@types/es6-promise/-/es6-promise-3.3.0.tgz", - "integrity": "sha512-ixCIAEkLUKv9movnHKCzx2rzAJgEnSALDXPrOSSwOjWwXFs0ssSZKan+O2e3FExPPCbX+DfA9NcKsbvLuyUlNA==", - "deprecated": "This is a stub types definition for es6-promise (https://github.com/jakearchibald/ES6-Promise). es6-promise provides its own type definitions, so you don't need @types/es6-promise installed!", - "dependencies": { - "es6-promise": "*" - } - }, - "node_modules/@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", - "dev": true - }, - "node_modules/@types/node": { - "version": "12.20.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.4.tgz", - "integrity": "sha512-xRCgeE0Q4pT5UZ189TJ3SpYuX/QGl6QIAOAIeDSbAVAd2gX1NxSZup4jNVK7cxIeP8KDSbJgcckun495isP1jQ==", - "dev": true - }, - "node_modules/@types/q": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", - "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", - "dev": true - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" - }, - "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/typescript": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz", - "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "bin": { - "uuid": "bin/uuid" - } - } - }, "dependencies": { "@actions/core": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", - "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", + "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", + "requires": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } }, "@actions/exec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", - "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", + "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", "requires": { "@actions/io": "^1.0.1" } }, "@actions/http-client": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz", - "integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", "requires": { - "tunnel": "0.0.6" + "tunnel": "^0.0.6" } }, "@actions/io": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz", - "integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", + "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" }, "@actions/tool-cache": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.6.1.tgz", - "integrity": "sha512-F+vwEDwfqcHMKuSkj79pihOnsAMv23EkG76nMpc82UsnXwyQdyEsktGxrB0SNtm7pRqTXEIOoAPTgrSQclXYTg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.1.tgz", + "integrity": "sha512-iPU+mNwrbA8jodY8eyo/0S/QqCKDajiR8OxWTnSk/SnYg0sj8Hp4QcUEVC1YFpHWXtrfbQrE13Jz4k4HXJQKcA==", "requires": { "@actions/core": "^1.2.6", "@actions/exec": "^1.0.0", - "@actions/http-client": "^1.0.8", - "@actions/io": "^1.0.1", + "@actions/http-client": "^2.0.1", + "@actions/io": "^1.1.1", "semver": "^6.1.0", "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + } } }, "@types/es6-promise": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@types/es6-promise/-/es6-promise-3.3.0.tgz", "integrity": "sha512-ixCIAEkLUKv9movnHKCzx2rzAJgEnSALDXPrOSSwOjWwXFs0ssSZKan+O2e3FExPPCbX+DfA9NcKsbvLuyUlNA==", + "dev": true, "requires": { "es6-promise": "*" } }, "@types/mocha": { - "version": "5.2.7", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", - "integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.0.tgz", + "integrity": "sha512-rADY+HtTOA52l9VZWtgQfn4p+UDVM2eDVkMZT1I6syp0YKxW2F9v+0pbRZLsvskhQv/vMb6ZfCay81GHbz5SHg==", "dev": true }, "@types/node": { - "version": "12.20.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.4.tgz", - "integrity": "sha512-xRCgeE0Q4pT5UZ189TJ3SpYuX/QGl6QIAOAIeDSbAVAd2gX1NxSZup4jNVK7cxIeP8KDSbJgcckun495isP1jQ==", + "version": "16.11.68", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.68.tgz", + "integrity": "sha512-JkRpuVz3xCNCWaeQ5EHLR/6woMbHZz/jZ7Kmc63AkU+1HxnoUugzSWMck7dsR4DvNYX8jp9wTi9K7WvnxOIQZQ==", "dev": true }, "@types/q": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", - "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.5.tgz", + "integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==", "dev": true }, "es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true }, "semver": { "version": "6.3.0", @@ -210,15 +98,15 @@ "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, "typescript": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz", - "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "dev": true }, "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } } diff --git a/package.json b/package.json index f500152..c80cc0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setup-mabl-cli", - "version": "1.3.0", + "version": "1.4.0", "description": "mabl GitHub action to setup mabl CLI", "main": "lib/index.js", "scripts": { @@ -10,15 +10,15 @@ }, "author": "mablhq", "dependencies": { - "@actions/core": "^1.2.6", - "@actions/exec": "^1.0.4", - "@actions/tool-cache": "^1.6.1", - "@types/es6-promise": "^3.3.0" + "@actions/core": "1.10.0", + "@actions/exec": "1.1.1", + "@actions/tool-cache": "2.0.1" }, "devDependencies": { - "@types/mocha": "^5.2.7", - "@types/node": "^12.20.4", - "@types/q": "^1.5.4", - "typescript": "^4.1.4" + "@types/es6-promise": "3.3.0", + "@types/mocha": "10.0.0", + "@types/node": "16.11.68", + "@types/q": "1.5.5", + "typescript": "4.8.4" } } diff --git a/src/index.ts b/src/index.ts index d202b26..386bfb2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,8 @@ import * as toolCache from '@actions/tool-cache'; type Option = T | undefined; +const REQUIRED_NODEJS_MAJOR_VERSION = 14; + async function run(): Promise { const version: Option = core.getInput('version', {required: false}); // Allow new or old syntax - some docs said 'workspace', others said 'workspace_id' @@ -79,13 +81,24 @@ async function configureWorkspace( async function findNode(): Promise> { const allNodeVersions = await toolCache.findAllVersions('node'); - if (!(allNodeVersions && allNodeVersions[0])) { + const nodeTargetVersion = allNodeVersions + .filter((version: string) => version.startsWith(`${REQUIRED_NODEJS_MAJOR_VERSION}.`))?.[0]; + + // If Node is installed, but the required version isn't, mark as a failure + if(allNodeVersions && allNodeVersions.length > 0 && !nodeTargetVersion) { + core.warning( + `Could not find required Node.js version ${REQUIRED_NODEJS_MAJOR_VERSION}.x installed. This install will fallback to an unsupported version which may not function correctly.`, + ); + } + + const nodeVersion = nodeTargetVersion ?? allNodeVersions[0]; + + if (!(allNodeVersions && nodeVersion)) { core.setFailed( - 'No node version installed. Please add a "actions/setup-node" step to your workflow or install a node version some other way.', + 'No Node.js version installed. Please add a "actions/setup-node" step to your workflow or install a Node.js version some other way.', ); return; } - const nodeVersion = allNodeVersions[0]; core.info(`Found node version ${nodeVersion}. Installing mabl CLI`); return toolCache.find('node', nodeVersion); diff --git a/tsconfig.json b/tsconfig.json index a616112..35ebd79 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { /* Basic Options */ - "target": "es2016" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - "lib": ["es2015"], // "lib": [], /* Specify library files to be included in the compilation. */ + "lib": ["es2021"], // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */