@npmcli/template-oss 3.5.0 → 3.7.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/check/check-changelog.js +3 -4
- package/lib/check/check-gitignore.js +1 -2
- package/lib/content/audit.yml +2 -2
- package/lib/content/ci.yml +4 -2
- package/lib/content/codeql-analysis.yml +2 -2
- package/lib/content/index.js +29 -8
- package/lib/content/release-please-config.json +15 -0
- package/lib/content/release-please-manifest.json +3 -0
- package/lib/content/release-please.yml +20 -30
- package/lib/content/tap.json +28 -0
- package/lib/util/get-git-url.js +3 -1
- package/lib/util/parser.js +2 -3
- package/package.json +2 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const fs = require('@npmcli/fs')
|
|
2
|
-
const { EOL } = require('os')
|
|
3
2
|
const { join, relative } = require('path')
|
|
4
3
|
|
|
5
4
|
const run = async ({ root, path }) => {
|
|
@@ -10,13 +9,13 @@ const run = async ({ root, path }) => {
|
|
|
10
9
|
|
|
11
10
|
if (await fs.exists(changelog)) {
|
|
12
11
|
const content = await fs.readFile(changelog, { encoding: 'utf8' })
|
|
13
|
-
const mustStart =
|
|
14
|
-
if (!
|
|
12
|
+
const mustStart = /^#\s+Changelog\r?\n\r?\n#/
|
|
13
|
+
if (!mustStart.test(content)) {
|
|
15
14
|
return {
|
|
16
15
|
title: `The ${relative(root, changelog)} is incorrect:`,
|
|
17
16
|
body: [
|
|
18
17
|
'The changelog should start with',
|
|
19
|
-
`"
|
|
18
|
+
`"# Changelog\n\n#"`,
|
|
20
19
|
],
|
|
21
20
|
solution: 'reformat the changelog to have the correct heading',
|
|
22
21
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const log = require('proc-log')
|
|
2
|
-
const { EOL } = require('os')
|
|
3
2
|
const { resolve, relative, basename } = require('path')
|
|
4
3
|
const fs = require('@npmcli/fs')
|
|
5
4
|
const git = require('@npmcli/git')
|
|
@@ -48,7 +47,7 @@ const run = async ({ root, path, config }) => {
|
|
|
48
47
|
|
|
49
48
|
const ignores = (await fs.readFile(ignoreFile))
|
|
50
49
|
.toString()
|
|
51
|
-
.split(
|
|
50
|
+
.split(/\r?\n/)
|
|
52
51
|
.filter((l) => l && !l.trim().startsWith('#'))
|
|
53
52
|
|
|
54
53
|
const relIgnore = relativeToRoot(ignoreFile)
|
package/lib/content/audit.yml
CHANGED
package/lib/content/ci.yml
CHANGED
|
@@ -19,8 +19,8 @@ on:
|
|
|
19
19
|
- {{pkgRelPath}}/**
|
|
20
20
|
{{/if}}
|
|
21
21
|
schedule:
|
|
22
|
-
# "At 02:00 on Monday" https://crontab.guru/#
|
|
23
|
-
- cron: "0
|
|
22
|
+
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
|
|
23
|
+
- cron: "0 9 * * 1"
|
|
24
24
|
|
|
25
25
|
jobs:
|
|
26
26
|
lint:
|
|
@@ -55,5 +55,7 @@ jobs:
|
|
|
55
55
|
steps:
|
|
56
56
|
{{> setupGit}}
|
|
57
57
|
{{> setupNode useMatrix=true}}
|
|
58
|
+
- name: add tap problem matcher
|
|
59
|
+
run: echo "::add-matcher::.github/matchers/tap.json"
|
|
58
60
|
- run: npm i --ignore-scripts --no-audit --no-fund
|
|
59
61
|
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
package/lib/content/index.js
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
const { name: NAME, version: LATEST_VERSION } = require('../../package.json')
|
|
2
2
|
|
|
3
|
+
const releasePlease = () => ({
|
|
4
|
+
'.github/workflows/release-please.yml': {
|
|
5
|
+
file: 'release-please.yml',
|
|
6
|
+
filter: (o) => !o.pkg.private,
|
|
7
|
+
},
|
|
8
|
+
'.release-please-manifest.json': {
|
|
9
|
+
file: 'release-please-manifest.json',
|
|
10
|
+
filter: (o) => !o.pkg.private,
|
|
11
|
+
parser: (p) => class NoCommentJson extends p.JsonMerge {
|
|
12
|
+
comment = null
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
'release-please-config.json': {
|
|
16
|
+
file: 'release-please-config.json',
|
|
17
|
+
filter: (o) => !o.pkg.private,
|
|
18
|
+
parser: (p) => class NoCommentJson extends p.JsonMerge {
|
|
19
|
+
comment = null
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
3
24
|
// Changes applied to the root of the repo
|
|
4
25
|
const rootRepo = {
|
|
5
26
|
add: {
|
|
@@ -9,14 +30,12 @@ const rootRepo = {
|
|
|
9
30
|
'.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
|
|
10
31
|
'.github/CODEOWNERS': 'CODEOWNERS',
|
|
11
32
|
'.github/dependabot.yml': 'dependabot.yml',
|
|
33
|
+
'.github/matchers/tap.json': 'tap.json',
|
|
12
34
|
'.github/workflows/audit.yml': 'audit.yml',
|
|
13
35
|
'.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
|
|
14
36
|
'.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
|
|
15
37
|
'.github/workflows/pull-request.yml': 'pull-request.yml',
|
|
16
|
-
|
|
17
|
-
file: 'release-please.yml',
|
|
18
|
-
filter: (o) => !o.pkg.private,
|
|
19
|
-
},
|
|
38
|
+
...releasePlease(),
|
|
20
39
|
},
|
|
21
40
|
}
|
|
22
41
|
|
|
@@ -42,12 +61,14 @@ const rootModule = {
|
|
|
42
61
|
// Changes for each workspace but applied to the root of the repo
|
|
43
62
|
const workspaceRepo = {
|
|
44
63
|
add: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
filter: (o) => !o.pkg.private,
|
|
48
|
-
},
|
|
64
|
+
...releasePlease(true),
|
|
65
|
+
'.github/matchers/tap.json': 'tap.json',
|
|
49
66
|
'.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml',
|
|
50
67
|
},
|
|
68
|
+
rm: [
|
|
69
|
+
// These are the old release please files that should be removed now
|
|
70
|
+
'.github/workflows/release-please-{{pkgNameFs}}.yml',
|
|
71
|
+
],
|
|
51
72
|
}
|
|
52
73
|
|
|
53
74
|
// Changes for each workspace but applied to the relative workspace dir
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"separate-pull-requests": true,
|
|
3
|
+
"changelog-sections": [
|
|
4
|
+
{"type":"feat","section":"Features","hidden":false},
|
|
5
|
+
{"type":"fix","section":"Bug Fixes","hidden":false},
|
|
6
|
+
{"type":"docs","section":"Documentation","hidden":false},
|
|
7
|
+
{"type":"deps","section":"Dependencies","hidden":false},
|
|
8
|
+
{"type":"chore","hidden":true}
|
|
9
|
+
],
|
|
10
|
+
"packages": {
|
|
11
|
+
"{{#unless pkgRelPath}}.{{/unless}}{{pkgRelPath}}": {
|
|
12
|
+
{{#unless pkgRelPath}}"package-name": ""{{/unless}}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,56 +1,46 @@
|
|
|
1
|
-
name: Release Please
|
|
1
|
+
name: Release Please
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
{{#if pkgRelPath}}
|
|
6
|
-
paths:
|
|
7
|
-
- {{pkgRelPath}}/**
|
|
8
|
-
{{/if}}
|
|
9
5
|
branches:
|
|
10
6
|
{{#each branches}}
|
|
11
7
|
- {{.}}
|
|
12
8
|
{{/each}}
|
|
13
9
|
|
|
14
|
-
{{#if isWorkspace}}
|
|
15
10
|
permissions:
|
|
16
11
|
contents: write
|
|
17
12
|
pull-requests: write
|
|
18
|
-
{{/if}}
|
|
19
13
|
|
|
20
14
|
jobs:
|
|
21
15
|
release-please:
|
|
22
16
|
runs-on: ubuntu-latest
|
|
17
|
+
outputs:
|
|
18
|
+
prs: $\{{ steps.release.outputs.prs }}
|
|
23
19
|
steps:
|
|
24
20
|
- uses: google-github-actions/release-please-action@v3
|
|
25
21
|
id: release
|
|
26
22
|
with:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{{#each changelogTypes}}
|
|
38
|
-
{{{json .}}}{{#unless @last}},{{/unless}}
|
|
39
|
-
{{/each}}
|
|
40
|
-
]
|
|
41
|
-
{{#if isWorkspace}}
|
|
23
|
+
command: manifest
|
|
24
|
+
|
|
25
|
+
update-prs:
|
|
26
|
+
needs: release-please
|
|
27
|
+
if: needs.release-please.outputs.prs
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
strategy:
|
|
30
|
+
matrix:
|
|
31
|
+
pr: $\{{ fromJSON(needs.release-please.outputs.prs) }}
|
|
32
|
+
steps:
|
|
42
33
|
{{> setupGit}}
|
|
43
34
|
{{> setupNode}}
|
|
44
|
-
- name: Update
|
|
45
|
-
if: steps.release.outputs.pr
|
|
35
|
+
- name: Update PR $\{{ matrix.pr.number }} dependencies and commit
|
|
46
36
|
env:
|
|
47
37
|
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
|
|
48
38
|
run: |
|
|
49
|
-
gh pr checkout $\{{
|
|
39
|
+
gh pr checkout $\{{ matrix.pr.number }}
|
|
50
40
|
npm run resetdeps
|
|
51
|
-
title="$\{{
|
|
52
|
-
# get the
|
|
53
|
-
# get everything after
|
|
54
|
-
|
|
41
|
+
title="$\{{ matrix.pr.title }}"
|
|
42
|
+
# get the dependency spec from the pr title
|
|
43
|
+
# get everything after ': release ' + replace space with @
|
|
44
|
+
dep_spec=$(echo "${title##*: release }" | tr ' ' @)
|
|
45
|
+
git commit -am "deps: $dep_spec"
|
|
55
46
|
git push
|
|
56
|
-
{{/if}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"problemMatcher": [{
|
|
3
|
+
"owner": "tap",
|
|
4
|
+
"pattern" : [
|
|
5
|
+
{
|
|
6
|
+
"regexp": "^\\s*not ok \\d+ - (.*)",
|
|
7
|
+
"message": 1
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"regexp": "^\\s*---"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"regexp": "^\\s*at:"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"regexp": "^\\s*line:\\s*(\\d+)",
|
|
17
|
+
"line": 1
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"regexp": "^\\s*column:\\s*(\\d+)",
|
|
21
|
+
"column": 1
|
|
22
|
+
}, {
|
|
23
|
+
"regexp": "^\\s*file:\\s*(.*)",
|
|
24
|
+
"file": 1
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}]
|
|
28
|
+
}
|
package/lib/util/get-git-url.js
CHANGED
package/lib/util/parser.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const fs = require('@npmcli/fs')
|
|
2
|
-
const { EOL } = require('os')
|
|
3
2
|
const { basename, extname, dirname } = require('path')
|
|
4
3
|
const yaml = require('yaml')
|
|
5
4
|
const NpmPackageJson = require('@npmcli/package-json')
|
|
@@ -56,7 +55,7 @@ class Base {
|
|
|
56
55
|
|
|
57
56
|
prepare (s) {
|
|
58
57
|
const header = this.header()
|
|
59
|
-
return header ? header
|
|
58
|
+
return header ? `${header}\n\n${s}` : s
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
prepareTarget (s) {
|
|
@@ -199,7 +198,7 @@ class Json extends Base {
|
|
|
199
198
|
comment = (c) => ({ [`//${this.options.config.__NAME__}`]: c })
|
|
200
199
|
|
|
201
200
|
toString (s) {
|
|
202
|
-
return JSON.stringify(s, (_, v) => v === this.DELETE ? undefined : v, 2)
|
|
201
|
+
return JSON.stringify(s, (_, v) => v === this.DELETE ? undefined : v, 2).trim() + '\n'
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
parse (s) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/template-oss",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "templated files used in npm CLI team oss projects",
|
|
5
5
|
"main": "lib/content/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"npm-package-arg": "^9.0.1",
|
|
46
46
|
"proc-log": "^2.0.0",
|
|
47
47
|
"semver": "^7.3.5",
|
|
48
|
-
"yaml": "
|
|
48
|
+
"yaml": "2.0.0-11"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"bin/",
|