npq 2.5.2 → 3.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 (34) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/.husky/commit-msg +4 -0
  3. package/.husky/post-merge +4 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.husky/pre-push +4 -0
  6. package/__tests__/__fixtures__/test.marshall.js +7 -7
  7. package/__tests__/marshalls.classMethods.test.js +9 -9
  8. package/__tests__/marshalls.provenance.test.js +206 -0
  9. package/__tests__/marshalls.repo.test.js +4 -7
  10. package/__tests__/marshalls.signatures.test.js +2 -6
  11. package/__tests__/marshalls.tasks.test.js +2 -2
  12. package/__tests__/packageManager.test.js +1 -1
  13. package/__tests__/packageRepoUtils.test.js +6 -8
  14. package/lib/cliCommons.js +2 -2
  15. package/lib/helpers/cliSupportHandler.js +2 -6
  16. package/lib/helpers/packageRepoUtils.js +9 -10
  17. package/lib/marshall.js +11 -11
  18. package/lib/marshalls/age.marshall.js +3 -3
  19. package/lib/marshalls/author.marshall.js +4 -4
  20. package/lib/marshalls/baseMarshall.js +7 -7
  21. package/lib/marshalls/downloads.marshall.js +3 -3
  22. package/lib/marshalls/expiredDomains.marshall.js +7 -7
  23. package/lib/marshalls/index.js +11 -21
  24. package/lib/marshalls/license.marshall.js +3 -3
  25. package/lib/marshalls/provenance.marshall.js +16 -8
  26. package/lib/marshalls/readme.marshall.js +3 -3
  27. package/lib/marshalls/repo.marshall.js +4 -5
  28. package/lib/marshalls/scripts.marshall.js +5 -5
  29. package/lib/marshalls/signatures.marshall.js +5 -6
  30. package/lib/marshalls/snyk.marshall.js +8 -9
  31. package/lib/packageManager.js +4 -4
  32. package/package.json +39 -55
  33. package/scripts/postinstall.js +4 -4
  34. package/scripts/scriptHelpers.js +3 -2
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "npq",
3
- "version": "2.5.2",
3
+ "version": "3.0.0",
4
4
  "description": "marshall your npm/npm package installs with high quality and class 🎖",
5
5
  "bin": {
6
6
  "npq": "./bin/npq.js",
7
7
  "npq-hero": "./bin/npq-hero.js"
8
8
  },
9
9
  "scripts": {
10
- "lint": "standard --fix && eslint . --ignore-path .gitignore && npm run lint:lockfile",
10
+ "lint": "eslint . --ignore-path .gitignore && npm run lint:lockfile",
11
11
  "lint:lockfile": "lockfile-lint --path package-lock.json --type npm --validate-https --allowed-hosts npm npm",
12
12
  "test": "jest",
13
13
  "test:watch": "jest --watch",
@@ -17,9 +17,13 @@
17
17
  "docs": "npm run docs:code && npm run docs:api",
18
18
  "docs:api": "doxdox *.js --layout bootstrap --output docs/index.html",
19
19
  "docs:code": "docco *.js --output docs/code",
20
- "semantic-release": "semantic-release",
21
- "postinstall": "node scripts/postinstall.js",
22
- "preuninstall": "node scripts/preuninstall.js"
20
+ "semantic-release": "npx semantic-release",
21
+ "#postinstall": "node scripts/postinstall.js",
22
+ "#preuninstall": "node scripts/preuninstall.js",
23
+ "prepare": "husky install"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
23
27
  },
24
28
  "author": {
25
29
  "name": "Liran Tal",
@@ -35,32 +39,29 @@
35
39
  "access": "public"
36
40
  },
37
41
  "devDependencies": {
38
- "@babel/core": "^7.7.4",
39
- "@babel/plugin-transform-runtime": "^7.7.4",
40
- "@babel/preset-env": "^7.7.4",
41
- "@babel/runtime": "^7.7.4",
42
- "@babel/types": "^7.7.4",
43
- "@commitlint/cli": "^7.0.0",
44
- "@commitlint/config-angular": "^8.0.0",
45
- "commitizen": "^3.0.0",
46
- "cz-conventional-changelog": "^2.1.0",
47
- "eslint": "^5.0.0",
48
- "eslint-plugin-import": "^2.2.0",
49
- "eslint-plugin-node": "^8.0.0",
50
- "eslint-plugin-security": "^1.3.0",
51
- "husky": "^3.0.0",
52
- "jest": "^24.9.0",
53
- "lint-staged": "^13.1.0",
42
+ "@babel/core": "^7.23.0",
43
+ "@babel/plugin-transform-runtime": "^7.22.15",
44
+ "@babel/preset-env": "^7.22.20",
45
+ "@babel/runtime": "^7.23.1",
46
+ "@babel/types": "^7.23.0",
47
+ "@commitlint/cli": "^17.7.2",
48
+ "@commitlint/config-angular": "^17.7.0",
49
+ "commitizen": "^4.3.0",
50
+ "cz-conventional-changelog": "^3.3.0",
51
+ "eslint": "^8.50.0",
52
+ "eslint-plugin-import": "^2.28.1",
53
+ "eslint-plugin-node": "^11.1.0",
54
+ "eslint-plugin-security": "^1.7.1",
55
+ "husky": "^8.0.3",
56
+ "jest": "^29.7.0",
57
+ "lint-staged": "^14.0.1",
54
58
  "lockfile-lint": "^4.12.1",
55
- "opn-cli": "^4.0.0",
56
- "prettier": "^2.8.3",
57
- "semantic-release": "21.0.2",
58
- "standard": "^12.0.0"
59
+ "prettier": "^3.0.3"
59
60
  },
60
61
  "jest": {
61
62
  "testEnvironment": "node",
62
63
  "verbose": true,
63
- "notify": true,
64
+ "notify": false,
64
65
  "collectCoverage": true,
65
66
  "coverageThreshold": {
66
67
  "global": {
@@ -93,16 +94,6 @@
93
94
  "path": "./node_modules/cz-conventional-changelog"
94
95
  }
95
96
  },
96
- "husky": {
97
- "hooks": {
98
- "commit-msg": "commitlint --env HUSKY_GIT_PARAMS",
99
- "pre-commit": "lint-staged",
100
- "pre-push": "npm run lint && npm run test",
101
- "post-commit": "git status",
102
- "post-checkout": "git status",
103
- "post-merge": "npm install"
104
- }
105
- },
106
97
  "commitlint": {
107
98
  "extends": [
108
99
  "@commitlint/config-angular"
@@ -115,12 +106,6 @@
115
106
  "git add"
116
107
  ]
117
108
  },
118
- "standard": {
119
- "env": [
120
- "node",
121
- "jest"
122
- ]
123
- },
124
109
  "eslintConfig": {
125
110
  "env": {
126
111
  "node": true,
@@ -132,7 +117,8 @@
132
117
  "security"
133
118
  ],
134
119
  "extends": [
135
- "plugin:node/recommended"
120
+ "plugin:node/recommended",
121
+ "plugin:security/recommended"
136
122
  ],
137
123
  "rules": {
138
124
  "semi": "off",
@@ -154,14 +140,14 @@
154
140
  "node/no-unsupported-features/node-builtins": [
155
141
  "error",
156
142
  {
157
- "version": ">=10.6.0",
143
+ "version": ">=18.17.0",
158
144
  "ignores": []
159
145
  }
160
146
  ],
161
147
  "node/no-unsupported-features/es-syntax": [
162
148
  "error",
163
149
  {
164
- "version": ">=10.6.0",
150
+ "version": ">=18.17.0",
165
151
  "ignores": []
166
152
  }
167
153
  ]
@@ -183,17 +169,15 @@
183
169
  }
184
170
  },
185
171
  "dependencies": {
186
- "chalk": "^2.3.0",
187
- "glob": "^8.0.3",
188
- "inquirer": "^8.0.0",
189
- "listr": "^0.14.0",
190
- "node-fetch": "^2.6.7",
191
- "npm-package-arg": "^10.1.0",
172
+ "glob": "^10.3.10",
173
+ "inquirer": "^8.2.6",
174
+ "kleur": "^4.1.5",
175
+ "listr": "^0.14.3",
176
+ "npm-package-arg": "^11.0.1",
192
177
  "pacote": "^17.0.4",
193
- "semver": "^7.3.8",
194
- "update-notifier": "^5",
195
- "validator": "13.7.0",
196
- "yargs": "^17.6.2"
178
+ "semver": "^7.5.4",
179
+ "validator": "13.11.0",
180
+ "yargs": "^17.7.2"
197
181
  },
198
182
  "release": {
199
183
  "branches": [
@@ -1,5 +1,5 @@
1
1
  const fs = require('fs')
2
- const chalk = require('chalk')
2
+ const color = require('kleur')
3
3
  const inquirer = require('inquirer')
4
4
  const semver = require('semver')
5
5
 
@@ -42,17 +42,17 @@ const runPostInstall = async () => {
42
42
  message: `Do you want to add ${shellConfig.name} aliases for npm and yarn?`
43
43
  }
44
44
  ])
45
- if (answers['install']) {
45
+ if (answers.install) {
46
46
  // eslint-disable-next-line security/detect-non-literal-fs-filename
47
47
  await fs.promises.appendFile(shellConfig.profilePath, shellConfig.aliases)
48
- console.log(chalk.green('✔'), 'Reload your shell profile to use npq!')
48
+ console.log(color.green('✔'), 'Reload your shell profile to use npq!')
49
49
  }
50
50
  } catch (err) {
51
51
  if (err.isTtyError) {
52
52
  // Could not render inquirer prompt; abort auto-install
53
53
  return
54
54
  }
55
- console.error(chalk.red('Failed to add aliases: '), err)
55
+ console.error(color.red('Failed to add aliases: '), err)
56
56
  }
57
57
  }
58
58
 
@@ -43,13 +43,13 @@ module.exports.removeFromFile = async (profilePath, aliases) => {
43
43
  }
44
44
 
45
45
  module.exports.isRunningInYarn = () => {
46
- const execPath = process.env['npm_execpath'] || ''
46
+ const execPath = process.env.npm_execpath || ''
47
47
  const binaryName = execPath.split(path.sep).pop()
48
48
  return binaryName.toLowerCase().includes('yarn')
49
49
  }
50
50
 
51
51
  module.exports.getNpmVersion = () => {
52
- const npmData = process.env['npm_config_user_agent'] || '0.0.0'
52
+ const npmData = process.env.npm_config_user_agent || '0.0.0'
53
53
  const version = /npm\/(.*) node/.exec(npmData)[1]
54
54
  return semver.valid(version) ? version : '0.0.0'
55
55
  }
@@ -61,6 +61,7 @@ const getProfile = async (profilePath) => {
61
61
  return profileData
62
62
  } catch (err) {
63
63
  if (err && err.code === 'ENOENT') {
64
+ return null
64
65
  } else if (err) {
65
66
  throw err
66
67
  }