es-check 6.1.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +7 -1
  2. package/index.js +29 -13
  3. package/package.json +23 -31
package/README.md CHANGED
@@ -20,7 +20,13 @@ Ensuring that JavaScript files can pass ES Check is important in a [modular and
20
20
 
21
21
  ---
22
22
 
23
- **Version 6:** released with [dropped support for es4](https://github.com/yowainwright/es-check/pull/98/files#r680564074) and a **major version bump of the [acorn](https://github.com/acornjs/acorn) parser**. Thanks so much for your insightful PR, [Noah](https://github.com/noahnu)! For any issues with the newer acorn version or for es4 support, use [version 5.2.4](https://www.npmjs.com/package/es-check/v/5.2.4) (`npm i es-check@5.2.4`). 🎉
23
+ ## Version 7 🎉
24
+
25
+ Thanks to the efforts of [Anders Kaseorg](https://github.com/andersk), ES Check has switched to [Commander](https://www.npmjs.com/package/commander)! There appears to be no breaking issues but this update is being published as a major release for your ease-of-use. Please reach out with observations or pull requests features/fixes!
26
+
27
+ This update was made for security purposes—dependencies not being maintained.
28
+
29
+ Thanks to Anders for this deeper fix, to [Pavel Starosek](https://github.com/StudioMaX) for the initial issue and support, and to [Alexander Pepper](https://github.com/apepper) for digging into this issue more!
24
30
 
25
31
  ---
26
32
 
package/index.js CHANGED
@@ -2,14 +2,15 @@
2
2
 
3
3
  'use strict'
4
4
 
5
- const { program } = require('@caporal/core')
5
+ const { program } = require('commander')
6
6
  const acorn = require('acorn')
7
- const glob = require('glob')
7
+ const glob = require('fast-glob')
8
8
  const fs = require('fs')
9
9
  const path = require('path')
10
+ const supportsColor = require('supports-color')
11
+ const winston = require('winston')
10
12
 
11
13
  const pkg = require('./package.json')
12
- const argsArray = process.argv.slice(2)
13
14
 
14
15
  /**
15
16
  * es-check 🏆
@@ -35,10 +36,25 @@ program
35
36
  '--allow-hash-bang',
36
37
  'if the code starts with #! treat it as a comment'
37
38
  )
38
- .option('--not', 'folder or file names to skip', {
39
- validator: program.ARRAY
40
- })
41
- .action(({ logger, args, options }) => {
39
+ .option('--not <files>', 'folder or file names to skip')
40
+ .option('--no-color', 'disable use of colors in output')
41
+ .option('-v, --verbose', 'verbose mode: will also output debug messages')
42
+ .option('--quiet', 'quiet mode: only displays warn and error messages')
43
+ .option(
44
+ '--silent',
45
+ 'silent mode: does not output anything, giving no indication of success or failure other than the exit code'
46
+ )
47
+ .action((ecmaVersionArg, filesArg, options) => {
48
+ const logger = winston.createLogger()
49
+ logger.add(new winston.transports.Console({
50
+ silent: options.silent,
51
+ level: options.verbose ? 'silly' : options.quiet ? 'warn' : 'info',
52
+ format: winston.format.combine(
53
+ ...supportsColor.stdout ? [winston.format.colorize()] : [],
54
+ winston.format.simple()
55
+ )
56
+ }))
57
+
42
58
  const configFilePath = path.resolve(process.cwd(), '.escheckrc')
43
59
 
44
60
  /**
@@ -50,18 +66,18 @@ program
50
66
  const config = fs.existsSync(configFilePath)
51
67
  ? JSON.parse(fs.readFileSync(configFilePath))
52
68
  : {}
53
- const expectedEcmaVersion = args.ecmaVersion
54
- ? args.ecmaVersion
69
+ const expectedEcmaVersion = ecmaVersionArg
70
+ ? ecmaVersionArg
55
71
  : config.ecmaVersion
56
72
  const files =
57
- args.files && args.files.length ? args.files : [].concat(config.files)
73
+ filesArg && filesArg.length ? filesArg : [].concat(config.files)
58
74
  const esmodule = options.module ? options.module : config.module
59
75
  const allowHashBang = options.allowHashBang
60
76
  ? options.allowHashBang
61
77
  : config.allowHashBang
62
78
  const pathsToIgnore =
63
- options.not && options.not.length
64
- ? options.not
79
+ options.not
80
+ ? options.not.split(',')
65
81
  : [].concat(config.not || [])
66
82
 
67
83
  if (!expectedEcmaVersion) {
@@ -230,4 +246,4 @@ program
230
246
  logger.info(`ES-Check: there were no ES version matching errors! 🎉`)
231
247
  })
232
248
 
233
- program.run(argsArray)
249
+ program.parse()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-check",
3
- "version": "6.1.1",
3
+ "version": "7.0.0",
4
4
  "description": "Checks the ECMAScript version of .js glob against a specified version of ECMAScript with a shell command",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -10,19 +10,16 @@
10
10
  "bin": {
11
11
  "es-check": "index.js"
12
12
  },
13
- "resolutions": {
14
- "ansi-regex": "5.0.1"
15
- },
16
13
  "scripts": {
17
14
  "chore:delete-branch": "if git show-ref --quiet refs/heads/chore-changelog; then git branch -D chore-changelog; fi",
18
15
  "chore:branch": "git checkout -b chore-changelog",
19
16
  "chore:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
20
17
  "chore:pr": "git add . && git commit -m '[chore] updates changelog' --no-verify && git push origin chore-changelog -f",
21
- "chore": "npm run chore:delete-branch && npm run chore:branch && npm run chore:changelog && npm run chore:pr",
18
+ "chore": "pnpm run chore:delete-branch && pnpm run chore:branch && pnpm run chore:changelog && pnpm run chore:pr",
22
19
  "lint": "eslint index.js --fix",
23
20
  "lint:ci": "eslint index.js",
24
- "prepush": "npm run lint && npm test",
25
- "postpublish": "git tag $npm_package_version && git push origin --tags && npm run chore",
21
+ "prepush": "pnpm run lint && pnpm test",
22
+ "postpublish": "git tag $npm_package_version && git push origin --tags && pnpm run chore",
26
23
  "report:coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
27
24
  "test": "nyc mocha test.js --timeout 10s --coverage"
28
25
  },
@@ -36,31 +33,26 @@
36
33
  },
37
34
  "homepage": "https://github.com/yowainwright/es-check#readme",
38
35
  "devDependencies": {
39
- "@commitlint/cli": "^14.1.0",
40
- "@commitlint/config-conventional": "^14.1.0",
41
- "@commitlint/prompt": "^13.1.0",
36
+ "@commitlint/cli": "^17.0.3",
37
+ "@commitlint/config-conventional": "^17.0.3",
38
+ "@commitlint/prompt": "^17.0.3",
42
39
  "assert": "^2.0.0",
43
- "codecov": "^3.0.0",
44
- "commitizen": "^4.2.2",
45
- "conventional-changelog-cli": "^2.0.11",
46
- "eslint": "^7.29.0",
40
+ "codecov": "^3.8.3",
41
+ "commitizen": "^4.2.4",
42
+ "conventional-changelog-cli": "^2.2.2",
43
+ "eslint": "^8.7.0",
47
44
  "eslint-config-prettier": "^8.3.0",
48
- "eslint-config-prettier-standard": "^4.0.1",
49
- "eslint-config-standard": "^16.0.3",
50
- "eslint-plugin-import": "^2.23.4",
51
- "eslint-plugin-node": "^11.1.0",
52
- "eslint-plugin-prettier": "^4.0.0",
53
- "eslint-plugin-promise": "^5.1.0",
54
- "husky": "^7.0.1",
55
- "mocha": "^9.0.1",
45
+ "husky": "^8.0.1",
46
+ "mocha": "^10.0.0",
56
47
  "nyc": "^15.1.0",
57
- "prettier": "^2.3.2",
58
- "prettier-config-standard": "^4.0.0"
48
+ "prettier": "^2.5.1"
59
49
  },
60
50
  "dependencies": {
61
- "acorn": "^8.4.1",
62
- "@caporal/core": "^2.0.2",
63
- "glob": "^7.1.7"
51
+ "acorn": "^8.7.0",
52
+ "commander": "^9.4.0",
53
+ "fast-glob": "^3.2.11",
54
+ "supports-color": "^8.1.1",
55
+ "winston": "^3.2.1"
64
56
  },
65
57
  "engines": {
66
58
  "node": ">= 4"
@@ -98,10 +90,10 @@
98
90
  "husky": {
99
91
  "hooks": {
100
92
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
101
- "post-checkout": "if [[ $HUSKY_GIT_PARAMS =~ 1$ ]]; then yarn; fi",
102
- "post-merge": "yarn",
103
- "post-rewrite": "yarn",
104
- "pre-commit": "yarn test && yarn lint"
93
+ "post-checkout": "if [[ $HUSKY_GIT_PARAMS =~ 1$ ]]; then pnpm i -r; fi",
94
+ "post-merge": "pnpm i -r",
95
+ "post-rewrite": "pnpm i -r",
96
+ "pre-commit": "pnpm test && pnpm lint"
105
97
  }
106
98
  }
107
99
  }