@npmcli/template-oss 4.4.3 → 4.4.5

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
@@ -1,5 +1,6 @@
1
1
  const { relative, dirname, join, extname, posix, win32 } = require('path')
2
2
  const { defaults, pick, omit, uniq } = require('lodash')
3
+ const semver = require('semver')
3
4
  const parseCIVersions = require('./util/parse-ci-versions.js')
4
5
  const getGitUrl = require('./util/get-git-url.js')
5
6
  const gitignore = require('./util/gitignore.js')
@@ -222,9 +223,22 @@ const getFullConfig = async ({
222
223
  versions = defaultVersions.ciVersions.slice(-1)
223
224
  }
224
225
 
225
- const parsed = parseCIVersions(versions)
226
- derived.ciVersions = parsed.targets
227
- derived.engines = pkgConfig.engines || parsed.engines
226
+ const { targets, engines } = parseCIVersions(versions)
227
+
228
+ // get just a list of the target versions (not ranges)
229
+ // these are used for the node version when doing engines checks
230
+ // since we want to test in the lowest version of each major
231
+ let targetVersions = targets.filter(t => semver.valid(t))
232
+ // if the versions are all ranges then convert them to the lower bound of each range
233
+ if (!targetVersions.length) {
234
+ targetVersions = targets.filter(t => semver.validRange(t)).map(t => {
235
+ return new semver.Range(t).set[0][0].semver.version
236
+ })
237
+ }
238
+
239
+ derived.ciVersions = targets
240
+ derived.baseCiVersions = targetVersions
241
+ derived.engines = pkgConfig.engines || engines
228
242
  }
229
243
 
230
244
  const gitUrl = await getGitUrl(root)
@@ -10,7 +10,7 @@ jobs:
10
10
  jobDepFlags="--engines-strict"
11
11
  macCI=false
12
12
  windowsCI=false
13
- ciVersions=(reject ciVersions '\.x$')
13
+ ciVersions=baseCiVersions
14
14
  }}
15
15
 
16
16
  lint:
@@ -11,7 +11,7 @@ jobs:
11
11
  {{> job
12
12
  jobName="template-oss"
13
13
  jobIf="github.actor == 'dependabot[bot]'"
14
- jobCheckout=(obj ref="${{ github.event.pull_request.head.ref }}")
14
+ jobCheckout=(obj ref="${{ github.ref_name }}")
15
15
  }}
16
16
  - name: Fetch Dependabot Metadata
17
17
  id: metadata
@@ -35,7 +35,6 @@ const setupHandlebars = (baseDir, ...otherDirs) => {
35
35
  Handlebars.registerHelper('obj', ({ hash }) => Object.fromEntries(safeValues(hash)))
36
36
  Handlebars.registerHelper('join', (arr, sep) => arr.join(typeof sep === 'string' ? sep : ', '))
37
37
  Handlebars.registerHelper('pluck', (arr, key) => arr.map(a => a[key]))
38
- Handlebars.registerHelper('reject', (arr, re) => arr.filter(a => !new RegExp(re).test(a)))
39
38
  Handlebars.registerHelper('quote', (arr) => arr.map(a => `'${a}'`))
40
39
  Handlebars.registerHelper('last', (arr) => arr[arr.length - 1])
41
40
  Handlebars.registerHelper('json', (c) => JSON.stringify(c))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.4.3",
3
+ "version": "4.4.5",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {