@npmcli/template-oss 4.25.0 → 4.26.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.
package/lib/config.js CHANGED
@@ -129,6 +129,9 @@ const getFullConfig = async ({
129
129
 
130
130
  const esm = pkg.pkgJson?.type === 'module' || !!pkgConfig.typescript || !!pkgConfig.esm
131
131
 
132
+ // test runner configuration
133
+ const isNodeTest = pkgConfig.testRunner === 'node:test'
134
+
132
135
  // all derived keys
133
136
  const derived = {
134
137
  isRoot,
@@ -168,10 +171,12 @@ const getFullConfig = async ({
168
171
  esm,
169
172
  cjsExt: esm ? 'cjs' : 'js',
170
173
  deleteJsExt: esm ? 'js' : 'cjs',
174
+ // test runner
175
+ isNodeTest,
171
176
  // tap
172
177
  // 18 and up doesn't like nyc-arg
173
- tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major >= 18,
174
- tap16: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
178
+ tap18: !isNodeTest && semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major >= 18,
179
+ tap16: !isNodeTest && semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 16,
175
180
  // booleans to control application of updates
176
181
  isForce,
177
182
  isDogFood,
@@ -202,6 +207,11 @@ const getFullConfig = async ({
202
207
  )
203
208
  }
204
209
 
210
+ // When using node:test, we don't need tap as a dependency
211
+ if (isNodeTest && Array.isArray(pkgConfig.requiredPackages?.devDependencies)) {
212
+ pkgConfig.requiredPackages.devDependencies = pkgConfig.requiredPackages.devDependencies.filter(p => p !== 'tap')
213
+ }
214
+
205
215
  pkgConfig.lintIgnorePaths = [
206
216
  ...(pkgConfig.ignorePaths || []),
207
217
  ...(pkgConfig.lintIgnorePaths || []),
@@ -1,4 +1,15 @@
1
+ {{#unless isNodeTest}}
1
2
  - name: Add Problem Matcher
2
3
  run: echo "::add-matcher::.github/matchers/tap.json"
4
+ {{/unless}}
5
+ {{#if isNodeTest}}
6
+ - name: Test (with coverage on Node >= 24)
7
+ if: $\{{ fromJSON(matrix.node-version) >= 24 }}
8
+ run: {{ rootNpmPath }} run test:cover --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
9
+ - name: Test (without coverage on Node < 24)
10
+ if: $\{{ fromJSON(matrix.node-version) < 24 }}
11
+ run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
12
+ {{else}}
3
13
  - name: Test
4
14
  run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
15
+ {{/if}}
@@ -37,7 +37,10 @@ const sharedRootAdd = name => ({
37
37
  filter: isPublic,
38
38
  },
39
39
  // ci
40
- '.github/matchers/tap.json': 'tap-json.hbs',
40
+ '.github/matchers/tap.json': {
41
+ file: 'tap-json.hbs',
42
+ filter: p => !p.config.isNodeTest,
43
+ },
41
44
  [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci-yml.hbs',
42
45
  // dependabot
43
46
  '.github/dependabot.yml': {
@@ -185,6 +188,7 @@ module.exports = {
185
188
  publish: false,
186
189
  typescript: false,
187
190
  esm: false,
191
+ testRunner: 'tap',
188
192
  updateNpm: true,
189
193
  dependabot: 'increase-if-necessary',
190
194
  dependabotInterval: 'daily',
@@ -17,8 +17,16 @@
17
17
  {{/if}}
18
18
  "postlint": "template-oss-check",
19
19
  "template-oss-apply": "template-oss-apply --force",
20
+ {{#if isNodeTest}}
21
+ "snap": "node --test --test-update-snapshots",
22
+ "test": "node --test --test-timeout=3000",
23
+ "test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100",
24
+ {{else}}
20
25
  "snap": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
21
26
  "test": "{{#if typescript}}{{#if tap16}}c8 {{/if}}{{/if}}tap",
27
+ "test:cover": {{{ del }}},
28
+ "test:nocover": {{{ del }}},
29
+ {{/if}}
22
30
  "posttest": "{{ localNpmPath }} run lint",
23
31
  {{#if isRootMono}}
24
32
  "test-all": "{{ localNpmPath }} run test {{ allFlags }}",
@@ -40,6 +48,10 @@
40
48
  },
41
49
  "templateVersion": {{{ del }}},
42
50
  "standard": {{{ del }}},
51
+ {{#if isNodeTest}}
52
+ "nyc": {{{ del }}},
53
+ "tap": {{{ del }}}
54
+ {{else}}
43
55
  "nyc": {{#if tap18}}{
44
56
  "exclude": {{{ json workspaceGlobs }}}
45
57
  }{{else}}{{{ del }}}{{/if}},
@@ -78,4 +90,5 @@
78
90
  "tap-snapshots/**"
79
91
  ]{{/if}}
80
92
  }
93
+ {{/if}}
81
94
  }
@@ -1,15 +1,14 @@
1
- const { Octokit } = require('@octokit/rest')
2
1
  const core = require('@actions/core')
3
2
  const { join } = require('path')
4
3
  const semver = require('semver')
5
4
  const assert = require('assert')
6
5
  const dedent = require('dedent')
7
6
  const mapWorkspaces = require('@npmcli/map-workspaces')
8
- const { request: fetch } = require('undici')
9
7
  const { getPublishTag, block, noop } = require('./util')
10
8
 
11
9
  class ReleaseManager {
12
10
  #octokit
11
+ #token
13
12
  #owner
14
13
  #repo
15
14
  #cwd
@@ -28,7 +27,7 @@ class ReleaseManager {
28
27
  assert(pr, 'pr is required')
29
28
  assert(defaultTag, 'defaultTag is required')
30
29
 
31
- this.#octokit = new Octokit({ auth: token })
30
+ this.#token = token
32
31
  this.#owner = repo.split('/')[0]
33
32
  this.#repo = repo.split('/')[1]
34
33
  this.#cwd = cwd
@@ -43,9 +42,15 @@ class ReleaseManager {
43
42
 
44
43
  static async run(options) {
45
44
  const manager = new ReleaseManager(options)
45
+ await manager.#init()
46
46
  return manager.run()
47
47
  }
48
48
 
49
+ async #init() {
50
+ const { Octokit } = await import('@octokit/rest')
51
+ this.#octokit = new Octokit({ auth: this.#token })
52
+ }
53
+
49
54
  async run() {
50
55
  const { data: pullRequest } = await this.#octokit.rest.pulls.get({
51
56
  owner: this.#owner,
@@ -168,15 +173,15 @@ class ReleaseManager {
168
173
  // up because that means something is very wrong. This is a rare edge
169
174
  // case that isn't worth testing.
170
175
 
171
- if (r.statusCode === 200) {
176
+ if (r.status === 200) {
172
177
  this.#info('Found release process from wiki')
173
- return r.body.text()
174
- } else if (r.statusCode === 404) {
178
+ return r.text()
179
+ } else if (r.status === 404) {
175
180
  this.#info('No release process found in wiki, falling back to default process')
176
181
  return this.#getReleaseSteps()
177
182
  /* c8 ignore next 3 */
178
183
  } else {
179
- throw new Error(`Release process fetch failed with status: ${r.statusCode}`)
184
+ throw new Error(`Release process fetch failed with status: ${r.status}`)
180
185
  }
181
186
  })
182
187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {
@@ -38,28 +38,27 @@
38
38
  "@commitlint/cli": "^19.0.3",
39
39
  "@commitlint/config-conventional": "^19.2.2",
40
40
  "@isaacs/string-locale-compare": "^1.1.0",
41
- "@npmcli/arborist": "^7.2.1",
42
- "@npmcli/git": "^6.0.0",
43
- "@npmcli/map-workspaces": "^4.0.0",
44
- "@npmcli/package-json": "^6.0.0",
45
- "@octokit/rest": "^19.0.4",
41
+ "@npmcli/arborist": "^9.1.2",
42
+ "@npmcli/git": "^7.0.0",
43
+ "@npmcli/map-workspaces": "^5.0.0",
44
+ "@npmcli/package-json": "^7.0.0",
45
+ "@octokit/rest": "^22.0.0",
46
46
  "dedent": "^1.5.1",
47
- "diff": "^7.0.0",
48
- "glob": "^10.1.0",
47
+ "diff": "^8.0.2",
48
+ "glob": "^11.0.3",
49
49
  "handlebars": "^4.7.7",
50
- "hosted-git-info": "^8.0.0",
50
+ "hosted-git-info": "^9.0.0",
51
51
  "ini": "^5.0.0",
52
52
  "json-parse-even-better-errors": "^4.0.0",
53
53
  "just-deep-map-values": "^1.1.1",
54
54
  "just-diff": "^6.0.0",
55
55
  "just-omit": "^2.2.0",
56
56
  "lodash": "^4.17.21",
57
- "minimatch": "^9.0.2",
58
- "npm-package-arg": "^12.0.0",
57
+ "minimatch": "^10.0.3",
58
+ "npm-package-arg": "^13.0.0",
59
59
  "proc-log": "^5.0.0",
60
- "release-please": "16.15.0",
60
+ "release-please": "^17.1.1",
61
61
  "semver": "^7.3.5",
62
- "undici": "^6.7.0",
63
62
  "yaml": "^2.1.1"
64
63
  },
65
64
  "files": [
@@ -71,15 +70,12 @@
71
70
  "@npmcli/eslint-config": "^5.0.0",
72
71
  "@npmcli/template-oss": "file:./",
73
72
  "eslint-config-prettier": "^9.1.0",
74
- "nock": "^13.3.8",
73
+ "nock": "^14.0.6",
75
74
  "prettier": "^3.2.5",
76
75
  "tap": "^21.0.1"
77
76
  },
78
77
  "tap": {
79
78
  "timeout": 600,
80
- "node-arg": [
81
- "--no-experimental-fetch"
82
- ],
83
79
  "exclude": [
84
80
  "workspace/test-workspace/**"
85
81
  ],