@npmcli/template-oss 3.6.0 → 3.7.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.
@@ -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: {
@@ -14,10 +35,7 @@ const rootRepo = {
14
35
  '.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
15
36
  '.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
16
37
  '.github/workflows/pull-request.yml': 'pull-request.yml',
17
- '.github/workflows/release-please.yml': {
18
- file: 'release-please.yml',
19
- filter: (o) => !o.pkg.private,
20
- },
38
+ ...releasePlease(),
21
39
  },
22
40
  }
23
41
 
@@ -43,12 +61,13 @@ const rootModule = {
43
61
  // Changes for each workspace but applied to the root of the repo
44
62
  const workspaceRepo = {
45
63
  add: {
46
- '.github/workflows/release-please-{{pkgNameFs}}.yml': {
47
- file: 'release-please.yml',
48
- filter: (o) => !o.pkg.private,
49
- },
64
+ ...releasePlease(true),
50
65
  '.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml',
51
66
  },
67
+ rm: [
68
+ // These are the old release please files that should be removed now
69
+ '.github/workflows/release-please-{{pkgNameFs}}.yml',
70
+ ],
52
71
  }
53
72
 
54
73
  // 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
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "{{#unless pkgRelPath}}.{{/unless}}{{pkgRelPath}}": "{{pkg.version}}"
3
+ }
@@ -1,56 +1,47 @@
1
- name: Release Please {{~#if isWorkspace}} - {{pkgName}}{{/if}}
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
- release-type: node
28
- {{#if pkgRelPath}}
29
- monorepo-tags: true
30
- path: {{pkgRelPath}}
31
- # name can be removed after this is merged
32
- # https://github.com/google-github-actions/release-please-action/pull/459
33
- package-name: "{{pkgName}}"
34
- {{/if}}
35
- changelog-types: >
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 package-lock.json and commit
35
+ - name: Update PR $\{{ matrix.pr.number }} dependencies and commit
45
36
  if: steps.release.outputs.pr
46
37
  env:
47
38
  GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
48
39
  run: |
49
- gh pr checkout $\{{ fromJSON(steps.release.outputs.pr).number }}
40
+ gh pr checkout $\{{ matrix.pr.number }}
50
41
  npm run resetdeps
51
- title="$\{{ fromJSON(steps.release.outputs.pr).title }}"
52
- # get the version from the pr title
53
- # get everything after the last space
54
- git commit -am "deps: {{pkgName}}@${title##* }"
42
+ title="$\{{ matrix.pr.title }}"
43
+ # get the dependency spec from the pr title
44
+ # get everything after ': release ' + replace space with @
45
+ dep_spec=$(echo "${title##*: release }" | tr ' ' @)
46
+ git commit -am "deps: $dep_spec"
55
47
  git push
56
- {{/if}}
@@ -198,7 +198,7 @@ class Json extends Base {
198
198
  comment = (c) => ({ [`//${this.options.config.__NAME__}`]: c })
199
199
 
200
200
  toString (s) {
201
- 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'
202
202
  }
203
203
 
204
204
  parse (s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {