es-check 6.2.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 +28 -12
  3. package/package.json +10 -11
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
- **Known issue:** cli argument vs. option order. There is a small issue with cli's option ordering. If an argument is passed **after** a boolean option, the boolean option will default to `falsy` as if the argument was not added. This will create weirdness in checks. A fix for this issue is in the works! 👌
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
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.2.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,9 +10,6 @@
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",
@@ -36,24 +33,26 @@
36
33
  },
37
34
  "homepage": "https://github.com/yowainwright/es-check#readme",
38
35
  "devDependencies": {
39
- "@commitlint/cli": "^16.1.0",
40
- "@commitlint/config-conventional": "^16.0.0",
41
- "@commitlint/prompt": "^16.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
40
  "codecov": "^3.8.3",
44
41
  "commitizen": "^4.2.4",
45
42
  "conventional-changelog-cli": "^2.2.2",
46
43
  "eslint": "^8.7.0",
47
44
  "eslint-config-prettier": "^8.3.0",
48
- "husky": "^7.0.4",
49
- "mocha": "^9.2.0",
45
+ "husky": "^8.0.1",
46
+ "mocha": "^10.0.0",
50
47
  "nyc": "^15.1.0",
51
48
  "prettier": "^2.5.1"
52
49
  },
53
50
  "dependencies": {
54
- "@caporal/core": "^2.0.2",
55
51
  "acorn": "^8.7.0",
56
- "fast-glob": "^3.2.11"
52
+ "commander": "^9.4.0",
53
+ "fast-glob": "^3.2.11",
54
+ "supports-color": "^8.1.1",
55
+ "winston": "^3.2.1"
57
56
  },
58
57
  "engines": {
59
58
  "node": ">= 4"