Skip to content

Commit

Permalink
Add version-guard to silent failure on old node
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jul 18, 2022
1 parent 8d83230 commit 7dc2ab0
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/old-test.yml
Expand Up @@ -42,5 +42,5 @@ jobs:
run: npm install

- name: Test that the command line program exits cleanly.
run: ./bin/cmd.js
run: ./bin/cmd.cjs
shell: bash
3 changes: 3 additions & 0 deletions bin/cmd.cjs
@@ -0,0 +1,3 @@
#!/usr/bin/env node

require('version-guard')('../cli.js', 12, 22)
16 changes: 0 additions & 16 deletions bin/cmd.js

This file was deleted.

4 changes: 4 additions & 0 deletions cli.js
@@ -0,0 +1,4 @@
import { cli } from 'standard-engine'
import options from './options.js'

cli(options)
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -8,7 +8,7 @@
"url": "https://feross.org"
},
"bin": {
"standard": "bin/cmd.js"
"standard": "bin/cmd.cjs"
},
"type": "module",
"bugs": {
Expand All @@ -22,7 +22,8 @@
"eslint-plugin-n": "^15.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.28.0",
"standard-engine": "^15.0.0"
"standard-engine": "^15.0.0",
"version-guard": "^1.1.0"
},
"devDependencies": {
"cross-spawn": "^7.0.3",
Expand Down Expand Up @@ -70,7 +71,7 @@
},
"scripts": {
"test": "npm run test-internal && npm run test-external",
"test-internal": "./bin/cmd.js --verbose && tape test/*.js",
"test-internal": "./bin/cmd.cjs --verbose && tape test/*.js",
"test-external": "tape test/external/*.js",
"update-authors": "./tools/update-authors.sh && hallmark --fix AUTHORS.md"
},
Expand Down
2 changes: 1 addition & 1 deletion test/api.js
Expand Up @@ -3,7 +3,7 @@ import standard from '../index.js'

test('api: lintFiles', async (t) => {
t.plan(2)
const [result] = await standard.lintFiles(['bin/cmd.js'])
const [result] = await standard.lintFiles(['bin/cmd.cjs'])
t.equal(typeof result, 'object', 'result is an object')
t.equal(result.errorCount, 0)
})
Expand Down
2 changes: 1 addition & 1 deletion test/cmd.js
Expand Up @@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url'
import test from 'tape'
import crossSpawn from 'cross-spawn'

const CMD_PATH = fileURLToPath(new URL('../bin/cmd.js', import.meta.url))
const CMD_PATH = fileURLToPath(new URL('../bin/cmd.cjs', import.meta.url))

test('command line usage: --help', t => {
t.plan(1)
Expand Down
2 changes: 1 addition & 1 deletion test/external/clone.js
Expand Up @@ -20,7 +20,7 @@ const testPkgs = JSON.parse(json)

const GIT = 'git'
const NPM = 'npm'
const STANDARD = fileURLToPath(new URL('../../bin/cmd.js', import.meta.url))
const STANDARD = fileURLToPath(new URL('../../bin/cmd.cjs', import.meta.url))
const TMP = new URL('../../tmp/', import.meta.url)
const PARALLEL_LIMIT = Math.ceil(cpus().length / 2)

Expand Down

0 comments on commit 7dc2ab0

Please sign in to comment.