@npmcli/template-oss 3.2.1 → 3.3.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.
- package/lib/config.js +1 -0
- package/lib/content/audit.yml +1 -1
- package/lib/content/ci.yml +2 -2
- package/lib/content/index.js +5 -1
- package/lib/content/npmrc +1 -1
- package/lib/content/pkg.json +4 -0
- package/lib/content/post-dependabot.yml +4 -4
- package/lib/content/release-please.yml +25 -1
- package/lib/content/setup-node.yml +3 -0
- package/lib/util/files.js +16 -3
- package/lib/util/parser.js +1 -1
- package/package.json +3 -3
package/lib/config.js
CHANGED
package/lib/content/audit.yml
CHANGED
package/lib/content/ci.yml
CHANGED
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
steps:
|
|
29
29
|
{{> setupGit}}
|
|
30
30
|
{{> setupNode}}
|
|
31
|
-
- run: npm i --ignore-scripts
|
|
31
|
+
- run: npm i --ignore-scripts --no-audit --no-fund
|
|
32
32
|
- run: npm run lint {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
33
33
|
|
|
34
34
|
test:
|
|
@@ -55,5 +55,5 @@ jobs:
|
|
|
55
55
|
steps:
|
|
56
56
|
{{> setupGit}}
|
|
57
57
|
{{> setupNode useMatrix=true}}
|
|
58
|
-
- run: npm i --ignore-scripts
|
|
58
|
+
- run: npm i --ignore-scripts --no-audit --no-fund
|
|
59
59
|
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
package/lib/content/index.js
CHANGED
|
@@ -38,7 +38,10 @@ const rootModule = {
|
|
|
38
38
|
// Changes for each workspace but applied to the root of the repo
|
|
39
39
|
const workspaceRepo = {
|
|
40
40
|
add: {
|
|
41
|
-
'.github/workflows/release-please-{{pkgNameFs}}.yml':
|
|
41
|
+
'.github/workflows/release-please-{{pkgNameFs}}.yml': {
|
|
42
|
+
file: 'release-please.yml',
|
|
43
|
+
filter: (o) => !o.pkg.private,
|
|
44
|
+
},
|
|
42
45
|
'.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml',
|
|
43
46
|
},
|
|
44
47
|
}
|
|
@@ -66,6 +69,7 @@ module.exports = {
|
|
|
66
69
|
branches: ['main', 'latest'],
|
|
67
70
|
distPaths: ['bin/', 'lib/'],
|
|
68
71
|
ciVersions: ['12.13.0', '12.x', '14.15.0', '14.x', '16.0.0', '16.x'],
|
|
72
|
+
lockfile: false,
|
|
69
73
|
unwantedPackages: [
|
|
70
74
|
'eslint',
|
|
71
75
|
'eslint-plugin-node',
|
package/lib/content/npmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
package-lock=
|
|
1
|
+
package-lock={{lockfile}}
|
package/lib/content/pkg.json
CHANGED
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
"template-oss-apply": "template-oss-apply --force",
|
|
8
8
|
"lintfix": "npm run lint -- --fix",
|
|
9
9
|
"preversion": "npm test",
|
|
10
|
+
{{#if pkgPrivate}}
|
|
11
|
+
"postversion": "git push origin --follow-tags",
|
|
12
|
+
{{else}}
|
|
10
13
|
"postversion": "npm publish",
|
|
11
14
|
"prepublishOnly": "git push origin --follow-tags",
|
|
15
|
+
{{/if}}
|
|
12
16
|
"snap": "tap",
|
|
13
17
|
"test": "tap",
|
|
14
18
|
"posttest": "npm run lint",
|
|
@@ -3,13 +3,12 @@ name: Post Dependabot Actions
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request
|
|
5
5
|
|
|
6
|
-
# https://docs.github.com/en/
|
|
6
|
+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
|
7
7
|
permissions:
|
|
8
|
-
actions: write
|
|
9
8
|
contents: write
|
|
10
9
|
|
|
11
10
|
jobs:
|
|
12
|
-
|
|
11
|
+
template-oss-apply:
|
|
13
12
|
runs-on: ubuntu-latest
|
|
14
13
|
if: github.actor == 'dependabot[bot]'
|
|
15
14
|
steps:
|
|
@@ -26,8 +25,9 @@ jobs:
|
|
|
26
25
|
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
|
|
27
26
|
run: |
|
|
28
27
|
gh pr checkout $\{{ github.event.pull_request.number }}
|
|
29
|
-
npm install --ignore-scripts
|
|
28
|
+
npm install --ignore-scripts --no-audit --no-fund
|
|
30
29
|
npm run template-oss-apply
|
|
31
30
|
git add .
|
|
32
31
|
git commit -am "chore: postinstall for dependabot template-oss PR"
|
|
33
32
|
git push
|
|
33
|
+
npm run lint
|
|
@@ -11,6 +11,11 @@ on:
|
|
|
11
11
|
- {{.}}
|
|
12
12
|
{{/each}}
|
|
13
13
|
|
|
14
|
+
{{#if isWorkspace}}
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
{{/if}}
|
|
18
|
+
|
|
14
19
|
jobs:
|
|
15
20
|
release-please:
|
|
16
21
|
runs-on: ubuntu-latest
|
|
@@ -21,7 +26,10 @@ jobs:
|
|
|
21
26
|
release-type: node
|
|
22
27
|
{{#if pkgRelPath}}
|
|
23
28
|
monorepo-tags: true
|
|
24
|
-
|
|
29
|
+
path: {{pkgRelPath}}
|
|
30
|
+
# name can be removed after this is merged
|
|
31
|
+
# https://github.com/google-github-actions/release-please-action/pull/459
|
|
32
|
+
package-name: "{{pkgName}}"
|
|
25
33
|
{{/if}}
|
|
26
34
|
changelog-types: >
|
|
27
35
|
[
|
|
@@ -29,3 +37,19 @@ jobs:
|
|
|
29
37
|
{{{json .}}}{{#unless @last}},{{/unless}}
|
|
30
38
|
{{/each}}
|
|
31
39
|
]
|
|
40
|
+
{{#if isWorkspace}}
|
|
41
|
+
{{> setupGit}}
|
|
42
|
+
{{> setupNode}}
|
|
43
|
+
- name: Update package-lock.json and commit
|
|
44
|
+
if: steps.release.outputs.pr
|
|
45
|
+
env:
|
|
46
|
+
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
|
|
47
|
+
run: |
|
|
48
|
+
gh pr checkout $\{{ fromJSON(steps.release.outputs.pr).number }}
|
|
49
|
+
npm run resetdeps
|
|
50
|
+
title="$\{{ fromJSON(steps.release.outputs.pr).title }}"
|
|
51
|
+
# get the version from the pr title
|
|
52
|
+
# get everything after the last space
|
|
53
|
+
git commit -am "deps: {{pkgName}}@${title##* }"
|
|
54
|
+
git push
|
|
55
|
+
{{/if}}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
- uses: actions/setup-node@v3
|
|
2
2
|
with:
|
|
3
3
|
node-version: {{#if useMatrix}}$\{{ matrix.node-version }}{{else}}{{#each ciVersions}}{{#if @last}}{{.}}{{/if}}{{/each}}{{/if}}
|
|
4
|
+
{{#if lockfile}}
|
|
5
|
+
cache: npm
|
|
6
|
+
{{/if}}
|
|
4
7
|
{{#if useMatrix}}
|
|
5
8
|
- name: Update to workable npm (windows)
|
|
6
9
|
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
|
package/lib/util/files.js
CHANGED
|
@@ -9,13 +9,24 @@ const fullTarget = (dir, file, options) => join(dir, template(file, options))
|
|
|
9
9
|
|
|
10
10
|
// given an obj of files, return the full target/source paths and associated parser
|
|
11
11
|
const getParsers = (dir, files, options) => Object.entries(files).map(([t, s]) => {
|
|
12
|
-
let {
|
|
13
|
-
|
|
12
|
+
let {
|
|
13
|
+
file,
|
|
14
|
+
parser: fileParser,
|
|
15
|
+
filter,
|
|
16
|
+
} = typeof s === 'string' ? { file: s } : s
|
|
17
|
+
|
|
14
18
|
file = join(options.config.sourceDir, file)
|
|
19
|
+
const target = fullTarget(dir, t, options)
|
|
20
|
+
|
|
21
|
+
if (typeof filter === 'function' && !filter(options)) {
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
if (fileParser) {
|
|
16
26
|
// allow files to extend base parsers or create new ones
|
|
17
27
|
return new (fileParser(Parser.Parsers))(target, file, options)
|
|
18
28
|
}
|
|
29
|
+
|
|
19
30
|
return new (Parser(file))(target, file, options)
|
|
20
31
|
})
|
|
21
32
|
|
|
@@ -32,7 +43,9 @@ const rmEach = async (dir, files, options, fn) => {
|
|
|
32
43
|
const parseEach = async (dir, files, options, fn) => {
|
|
33
44
|
const res = []
|
|
34
45
|
for (const parser of getParsers(dir, files, options)) {
|
|
35
|
-
|
|
46
|
+
if (parser) {
|
|
47
|
+
res.push(await fn(parser))
|
|
48
|
+
}
|
|
36
49
|
}
|
|
37
50
|
return res.filter(Boolean)
|
|
38
51
|
}
|
package/lib/util/parser.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/template-oss",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "templated files used in npm CLI team oss projects",
|
|
5
5
|
"main": "lib/content/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@npmcli/fs": "^2.0.1",
|
|
35
35
|
"@npmcli/git": "^3.0.0",
|
|
36
36
|
"@npmcli/map-workspaces": "^2.0.2",
|
|
37
|
-
"@npmcli/package-json": "^
|
|
37
|
+
"@npmcli/package-json": "^2.0.0",
|
|
38
38
|
"diff": "^5.0.0",
|
|
39
39
|
"handlebars": "^4.7.7",
|
|
40
40
|
"hosted-git-info": "^5.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"npm-package-arg": "^9.0.1",
|
|
45
45
|
"proc-log": "^2.0.0",
|
|
46
46
|
"semver": "^7.3.5",
|
|
47
|
-
"yaml": "^2.0.0-
|
|
47
|
+
"yaml": "^2.0.0-11"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"bin/",
|