npq 2.3.1 → 2.4.1
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
queue_rules:
|
|
2
|
+
- name: Snyk PRs Queue
|
|
3
|
+
conditions:
|
|
4
|
+
- "check-success ~= .*"
|
|
5
|
+
|
|
6
|
+
pull_request_rules:
|
|
7
|
+
- name: Automatic merge Snyk PRs on Status Checks passing
|
|
8
|
+
conditions:
|
|
9
|
+
- title~=^\[Snyk\]
|
|
10
|
+
- head~=^snyk-fix
|
|
11
|
+
- base=main
|
|
12
|
+
actions:
|
|
13
|
+
queue:
|
|
14
|
+
name: "Snyk PRs Queue"
|
|
15
|
+
label:
|
|
16
|
+
add:
|
|
17
|
+
- "auto-merge"
|
|
@@ -7,7 +7,7 @@ jobs:
|
|
|
7
7
|
strategy:
|
|
8
8
|
matrix:
|
|
9
9
|
platform: [ubuntu-latest]
|
|
10
|
-
node: ['
|
|
10
|
+
node: ['18', '20']
|
|
11
11
|
name: Node ${{ matrix.node }} (${{ matrix.platform }})
|
|
12
12
|
runs-on: ${{ matrix.platform }}
|
|
13
13
|
steps:
|
|
@@ -16,13 +16,13 @@ jobs:
|
|
|
16
16
|
with:
|
|
17
17
|
node-version: ${{ matrix.node }}
|
|
18
18
|
- name: install dependencies
|
|
19
|
-
run:
|
|
19
|
+
run: npm ci --ignore-engines --ignore-scripts
|
|
20
20
|
- name: lint code
|
|
21
|
-
run:
|
|
21
|
+
run: npm run lint
|
|
22
22
|
env:
|
|
23
23
|
CI: true
|
|
24
24
|
- name: run tests
|
|
25
|
-
run:
|
|
25
|
+
run: npm run test
|
|
26
26
|
env:
|
|
27
27
|
CI: true
|
|
28
28
|
- name: coverage
|
|
@@ -50,9 +50,9 @@ jobs:
|
|
|
50
50
|
with:
|
|
51
51
|
node-version: '18'
|
|
52
52
|
- name: install dependencies
|
|
53
|
-
run:
|
|
53
|
+
run: npm ci --ignore-engines --ignore-scripts
|
|
54
54
|
- name: release
|
|
55
|
-
run:
|
|
55
|
+
run: npm run semantic-release
|
|
56
56
|
env:
|
|
57
57
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
58
58
|
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -37,20 +37,13 @@ class BaseMarshall {
|
|
|
37
37
|
return data
|
|
38
38
|
})
|
|
39
39
|
.catch((err) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
pkg: pkg.packageString,
|
|
44
|
-
message: err.message
|
|
45
|
-
},
|
|
46
|
-
true
|
|
47
|
-
)
|
|
48
|
-
} else {
|
|
49
|
-
this.setMessage({
|
|
40
|
+
this.setMessage(
|
|
41
|
+
{
|
|
50
42
|
pkg: pkg.packageString,
|
|
51
43
|
message: err.message
|
|
52
|
-
}
|
|
53
|
-
|
|
44
|
+
},
|
|
45
|
+
Boolean(err instanceof Warning)
|
|
46
|
+
)
|
|
54
47
|
})
|
|
55
48
|
}
|
|
56
49
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const BaseMarshall = require('./baseMarshall')
|
|
4
|
+
const pacote = require('pacote')
|
|
5
|
+
|
|
6
|
+
const MARSHALL_NAME = 'signatures'
|
|
7
|
+
|
|
8
|
+
class Marshall extends BaseMarshall {
|
|
9
|
+
constructor (options) {
|
|
10
|
+
super(options)
|
|
11
|
+
this.name = MARSHALL_NAME
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
title () {
|
|
15
|
+
return 'Verifying registry signatures for package'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
validate (pkg) {
|
|
19
|
+
// @TODO currently we're hardcoding the official npm registry
|
|
20
|
+
// this should however allow for local proxies and other registries
|
|
21
|
+
return this.fetchRegistryKeys()
|
|
22
|
+
.then((keys) => {
|
|
23
|
+
return pacote.manifest(`${pkg.packageName}@${pkg.packageVersion}`, {
|
|
24
|
+
verifySignatures: true,
|
|
25
|
+
registry: 'https://registry.npmjs.org',
|
|
26
|
+
|
|
27
|
+
[`//registry.npmjs.org/:_keys`]: keys
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
.then((metadata) => {
|
|
31
|
+
return metadata
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
fetchRegistryKeys () {
|
|
36
|
+
const registryHost = 'https://registry.npmjs.org'
|
|
37
|
+
const registryKeysEndpoint = '/-/npm/v1/keys'
|
|
38
|
+
|
|
39
|
+
const registryKeysUrl = `${registryHost}${registryKeysEndpoint}`
|
|
40
|
+
// eslint-disable-next-line no-undef
|
|
41
|
+
return fetch(registryKeysUrl)
|
|
42
|
+
.then((response) => {
|
|
43
|
+
return response.json()
|
|
44
|
+
})
|
|
45
|
+
.then((response) => {
|
|
46
|
+
const registryKeys = response.keys
|
|
47
|
+
|
|
48
|
+
return registryKeys.map((key) => ({
|
|
49
|
+
...key,
|
|
50
|
+
pemkey: `-----BEGIN PUBLIC KEY-----\n${key.key}\n-----END PUBLIC KEY-----`
|
|
51
|
+
}))
|
|
52
|
+
})
|
|
53
|
+
.then((keys) => {
|
|
54
|
+
return keys
|
|
55
|
+
})
|
|
56
|
+
.catch((error) => {
|
|
57
|
+
throw new Error(`error fetching registry keys: ${error.message}`)
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = Marshall
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npq",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "marshall your npm/
|
|
3
|
+
"version": "2.4.1",
|
|
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 &&
|
|
11
|
-
"lint:lockfile": "lockfile-lint --path
|
|
10
|
+
"lint": "standard --fix && eslint . --ignore-path .gitignore && npm run lint:lockfile",
|
|
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",
|
|
14
14
|
"coverage:view": "opn coverage/lcov-report/index.html",
|
|
15
15
|
"commit": "git-cz",
|
|
16
16
|
"format": "prettier --config .prettierrc.js --write '**/*.js'",
|
|
17
|
-
"docs": "
|
|
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
20
|
"semantic-release": "semantic-release",
|
|
@@ -44,8 +44,6 @@
|
|
|
44
44
|
"@commitlint/config-angular": "^8.0.0",
|
|
45
45
|
"commitizen": "^3.0.0",
|
|
46
46
|
"cz-conventional-changelog": "^2.1.0",
|
|
47
|
-
"docco": "^0.7.0",
|
|
48
|
-
"doxdox": "^3.0.0",
|
|
49
47
|
"eslint": "^5.0.0",
|
|
50
48
|
"eslint-plugin-import": "^2.2.0",
|
|
51
49
|
"eslint-plugin-node": "^8.0.0",
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
"husky": "^3.0.0",
|
|
54
52
|
"jest": "^24.9.0",
|
|
55
53
|
"lint-staged": "^13.1.0",
|
|
56
|
-
"lockfile-lint": "^
|
|
54
|
+
"lockfile-lint": "^4.12.1",
|
|
57
55
|
"opn-cli": "^4.0.0",
|
|
58
56
|
"prettier": "^2.8.3",
|
|
59
57
|
"semantic-release": "21.0.2",
|
|
@@ -99,10 +97,10 @@
|
|
|
99
97
|
"hooks": {
|
|
100
98
|
"commit-msg": "commitlint --env HUSKY_GIT_PARAMS",
|
|
101
99
|
"pre-commit": "lint-staged",
|
|
102
|
-
"pre-push": "
|
|
100
|
+
"pre-push": "npm run lint && npm run test",
|
|
103
101
|
"post-commit": "git status",
|
|
104
102
|
"post-checkout": "git status",
|
|
105
|
-
"post-merge": "
|
|
103
|
+
"post-merge": "npm install"
|
|
106
104
|
}
|
|
107
105
|
},
|
|
108
106
|
"commitlint": {
|
|
@@ -112,8 +110,8 @@
|
|
|
112
110
|
},
|
|
113
111
|
"lint-staged": {
|
|
114
112
|
"**/*.js": [
|
|
115
|
-
"
|
|
116
|
-
"
|
|
113
|
+
"npm run format",
|
|
114
|
+
"npm run lint",
|
|
117
115
|
"git add"
|
|
118
116
|
]
|
|
119
117
|
},
|
|
@@ -191,6 +189,7 @@
|
|
|
191
189
|
"listr": "^0.14.0",
|
|
192
190
|
"node-fetch": "^2.6.7",
|
|
193
191
|
"npm-package-arg": "^10.1.0",
|
|
192
|
+
"pacote": "^17.0.4",
|
|
194
193
|
"semver": "^7.3.8",
|
|
195
194
|
"update-notifier": "^5",
|
|
196
195
|
"validator": "13.7.0",
|