diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd8470eff..1c0886405 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,29 +34,6 @@ jobs: - name: Run tests run: npm test - build-node12: - name: Test Suite (Node 12) - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 12 - uses: actions/setup-node@v3 - with: - node-version: 12 - - - name: Install deps - run: npm ci - - - name: Build dist - run: npm run build - - # rdme doesn't work on Node 12 but we just want to run this single test to make sure that - # our "we don't support node 12" error is shown. - - name: Run tests - run: npx jest __tests__/bin.test.ts - action: name: GitHub Action Dry Run runs-on: ubuntu-latest diff --git a/__tests__/bin.test.ts b/__tests__/bin.test.ts index 1d79683f2..175861f80 100644 --- a/__tests__/bin.test.ts +++ b/__tests__/bin.test.ts @@ -1,32 +1,14 @@ import { exec } from 'child_process'; -import pkg from '../package.json'; -import isSupportedNodeVersion from '../src/lib/isSupportedNodeVersion'; - describe('bin', () => { - if (isSupportedNodeVersion(process.version)) { - it('should show our help screen', async () => { - expect.assertions(1); - - await new Promise(resolve => { - exec(`node ${__dirname}/../bin/rdme`, (error, stdout) => { - expect(stdout).toContain('a utility for interacting with ReadMe'); - resolve(true); - }); - }); - }); - } else { - it('should fail with a message', async () => { - expect.assertions(1); + it('should show our help screen', async () => { + expect.assertions(1); - await new Promise(resolve => { - exec(`node ${__dirname}/../bin/rdme`, (error, stdout, stderr) => { - expect(stderr).toContain( - `We're sorry, this release of rdme does not support Node.js ${process.version}. We support the following versions: ${pkg.engines.node}` - ); - resolve(true); - }); + await new Promise(resolve => { + exec(`node ${__dirname}/../bin/rdme`, (error, stdout) => { + expect(stdout).toContain('a utility for interacting with ReadMe'); + resolve(true); }); }); - } + }); }); diff --git a/__tests__/lib/isSupportedNodeVersion.test.ts b/__tests__/lib/isSupportedNodeVersion.test.ts deleted file mode 100644 index 80f0e79a4..000000000 --- a/__tests__/lib/isSupportedNodeVersion.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import isSupportedNodeVersion from '../../src/lib/isSupportedNodeVersion'; - -describe('#isSupportedNodeVersion()', () => { - it('should return true for a supported version of node', () => { - expect(isSupportedNodeVersion('14.5.1')).toBe(true); - expect(isSupportedNodeVersion('16.0.0')).toBe(true); - expect(isSupportedNodeVersion('18.0.0')).toBe(true); - }); - - it('should return false for an unsupported version of node', () => { - expect(isSupportedNodeVersion('10.0.0')).toBe(false); - expect(isSupportedNodeVersion('12.0.0')).toBe(false); - }); -}); diff --git a/package-lock.json b/package-lock.json index d35fec468..1a8d9f316 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7249,21 +7249,98 @@ } }, "node_modules/jest-extended": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jest-extended/-/jest-extended-3.0.0.tgz", - "integrity": "sha512-lhL+MCISeki6hGpRR7m8ViVR9pYlJHLj178OdvnYaOiXuXVaEkMiI8JfyZKEN/so8YzzbIfED1FGDSWWmxRNjg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jest-extended/-/jest-extended-3.1.0.tgz", + "integrity": "sha512-BbuAVUb2dchgwm7euayVt/7hYlkKaknQItKyzie7Li8fmXCglgf21XJeRIdOITZ/cMOTTj5Oh5IjQOxQOe/hfQ==", "dev": true, "dependencies": { - "jest-diff": "^28.0.0", - "jest-get-type": "^28.0.0" + "jest-diff": "^29.0.0", + "jest-get-type": "^29.0.0" }, "engines": { - "node": "^14.15.0 || ^16.13.0 || >=18.0.0" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" }, "peerDependencies": { "jest": ">=27.2.5" } }, + "node_modules/jest-extended/node_modules/@jest/schemas": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", + "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.24.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-extended/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-extended/node_modules/diff-sequences": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz", + "integrity": "sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-extended/node_modules/jest-diff": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.0.1.tgz", + "integrity": "sha512-l8PYeq2VhcdxG9tl5cU78ClAlg/N7RtVSp0v3MlXURR0Y99i6eFnegmasOandyTmO6uEdo20+FByAjBFEO9nuw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.0.0", + "jest-get-type": "^29.0.0", + "pretty-format": "^29.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-extended/node_modules/jest-get-type": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.0.0.tgz", + "integrity": "sha512-83X19z/HuLKYXYHskZlBAShO7UfLFXu/vWajw9ZNJASN32li8yHMaVGAQqxFW1RCFOkB7cubaL6FaJVQqqJLSw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-extended/node_modules/pretty-format": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.0.1.tgz", + "integrity": "sha512-iTHy3QZMzuL484mSTYbQIM1AHhEQsH8mXWS2/vd2yFBYnG3EBqGiMONo28PlPgrW7P/8s/1ISv+y7WH306l8cw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.0.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-extended/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, "node_modules/jest-get-type": { "version": "28.0.2", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", @@ -18832,13 +18909,71 @@ } }, "jest-extended": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/jest-extended/-/jest-extended-3.0.0.tgz", - "integrity": "sha512-lhL+MCISeki6hGpRR7m8ViVR9pYlJHLj178OdvnYaOiXuXVaEkMiI8JfyZKEN/so8YzzbIfED1FGDSWWmxRNjg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jest-extended/-/jest-extended-3.1.0.tgz", + "integrity": "sha512-BbuAVUb2dchgwm7euayVt/7hYlkKaknQItKyzie7Li8fmXCglgf21XJeRIdOITZ/cMOTTj5Oh5IjQOxQOe/hfQ==", "dev": true, "requires": { - "jest-diff": "^28.0.0", - "jest-get-type": "^28.0.0" + "jest-diff": "^29.0.0", + "jest-get-type": "^29.0.0" + }, + "dependencies": { + "@jest/schemas": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.0.0.tgz", + "integrity": "sha512-3Ab5HgYIIAnS0HjqJHQYZS+zXc4tUmTmBH3z83ajI6afXp8X3ZtdLX+nXx+I7LNkJD7uN9LAVhgnjDgZa2z0kA==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.24.1" + } + }, + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "diff-sequences": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.0.0.tgz", + "integrity": "sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA==", + "dev": true + }, + "jest-diff": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.0.1.tgz", + "integrity": "sha512-l8PYeq2VhcdxG9tl5cU78ClAlg/N7RtVSp0v3MlXURR0Y99i6eFnegmasOandyTmO6uEdo20+FByAjBFEO9nuw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.0.0", + "jest-get-type": "^29.0.0", + "pretty-format": "^29.0.1" + } + }, + "jest-get-type": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.0.0.tgz", + "integrity": "sha512-83X19z/HuLKYXYHskZlBAShO7UfLFXu/vWajw9ZNJASN32li8yHMaVGAQqxFW1RCFOkB7cubaL6FaJVQqqJLSw==", + "dev": true + }, + "pretty-format": { + "version": "29.0.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.0.1.tgz", + "integrity": "sha512-iTHy3QZMzuL484mSTYbQIM1AHhEQsH8mXWS2/vd2yFBYnG3EBqGiMONo28PlPgrW7P/8s/1ISv+y7WH306l8cw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.0.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + } + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + } } }, "jest-get-type": { diff --git a/src/cli.ts b/src/cli.ts index e42f3fc33..d34870c07 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -6,24 +6,11 @@ import updateNotifier from 'update-notifier'; import pkg from '../package.json'; import isGHA from './lib/isGitHub'; -import isSupportedNodeVersion from './lib/isSupportedNodeVersion'; import rdme from '.'; updateNotifier({ pkg }).notify(); -/** - * We use optional chaining throughout the library, which doesn't work on Node 12, so to curb - * support questions about why rdme is throwing an "Unexpected token '.'" error we should hard - * stop if we're being run with any Node version that we don't explicitly support. - */ -if (!isSupportedNodeVersion(process.version)) { - const message = `We're sorry, this release of rdme does not support Node.js ${process.version}. We support the following versions: ${pkg.engines.node}`; - // eslint-disable-next-line no-console - console.error(chalk.red(`\n${message}\n`)); - process.exit(1); -} - rdme(process.argv.slice(2)) .then((msg: string) => { // eslint-disable-next-line no-console diff --git a/src/lib/isSupportedNodeVersion.ts b/src/lib/isSupportedNodeVersion.ts deleted file mode 100644 index 17b339876..000000000 --- a/src/lib/isSupportedNodeVersion.ts +++ /dev/null @@ -1,11 +0,0 @@ -import semver from 'semver'; - -import pkg from '../../package.json'; - -/** - * Determine if the current version of Node is one that we explicitly support. - * - */ -export default function isSupportedNodeVersion(version: string) { - return semver.satisfies(semver.coerce(version), pkg.engines.node); -}