@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 +17 -3
- package/lib/content/ci.yml +1 -1
- package/lib/content/post-dependabot.yml +1 -1
- package/lib/util/template.js +0 -1
- package/package.json +1 -1
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
|
|
226
|
-
|
|
227
|
-
|
|
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)
|
package/lib/content/ci.yml
CHANGED
|
@@ -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.
|
|
14
|
+
jobCheckout=(obj ref="${{ github.ref_name }}")
|
|
15
15
|
}}
|
|
16
16
|
- name: Fetch Dependabot Metadata
|
|
17
17
|
id: metadata
|
package/lib/util/template.js
CHANGED
|
@@ -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))
|