@npmcli/template-oss 3.3.2 → 3.4.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 +17 -3
- package/lib/content/gitignore +3 -0
- package/lib/content/index.js +5 -1
- package/lib/content/pkg.json +4 -4
- package/lib/content/setup-git.yml +2 -2
- package/package.json +1 -1
package/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { relative, dirname, posix, win32 } = require('path')
|
|
1
|
+
const { relative, dirname, join, posix, win32 } = require('path')
|
|
2
2
|
const log = require('proc-log')
|
|
3
3
|
const { uniq, defaults } = require('lodash')
|
|
4
4
|
const parseCIVersions = require('./util/parse-ci-versions.js')
|
|
@@ -50,13 +50,14 @@ const getConfig = async ({
|
|
|
50
50
|
workspaceRepo,
|
|
51
51
|
workspaceModule,
|
|
52
52
|
version,
|
|
53
|
-
...
|
|
53
|
+
...pkgConfig // this includes config merged in from root
|
|
54
54
|
},
|
|
55
55
|
}) => {
|
|
56
56
|
const isRoot = root === path
|
|
57
57
|
const isLatest = version === LATEST_VERSION
|
|
58
58
|
const isDogFood = pkg.name === NAME
|
|
59
59
|
const isForce = process.argv.includes('--force')
|
|
60
|
+
const rawPkgConfig = getPkgConfig(pkg)
|
|
60
61
|
|
|
61
62
|
// this is written to ci yml files so it needs to always use posix
|
|
62
63
|
const pkgRelPath = makePosix(relative(root, path))
|
|
@@ -128,12 +129,25 @@ const getConfig = async ({
|
|
|
128
129
|
|
|
129
130
|
// merge the rest of base and pkg content to make the
|
|
130
131
|
// full content object
|
|
131
|
-
const content = { ...baseContent, ...
|
|
132
|
+
const content = { ...baseContent, ...pkgConfig }
|
|
132
133
|
|
|
133
134
|
// set some defaults on content that can be overwritten unlike
|
|
134
135
|
// derived values which are calculated from other config
|
|
135
136
|
const contentDefaults = {}
|
|
136
137
|
|
|
138
|
+
if (content.npmBin && content.npmBin !== baseContent.npmBin) {
|
|
139
|
+
// make it relative to each workspace if they did not set the config themselves
|
|
140
|
+
if (!rawPkgConfig.npmBin) {
|
|
141
|
+
content.npmBin = makePosix(join(relative(path, root), content.npmBin))
|
|
142
|
+
}
|
|
143
|
+
// a bit of a hack but allow custom node paths or no node path at all
|
|
144
|
+
// checks if the first thing has node somewhere in it and if it doesnt
|
|
145
|
+
// puts a system node in front of the script
|
|
146
|
+
const execPaths = content.npmBin.split(' ')[0].split(posix.sep)
|
|
147
|
+
if (execPaths.every(p => p !== 'node')) {
|
|
148
|
+
content.npmBin = `node ${content.npmBin}`
|
|
149
|
+
}
|
|
150
|
+
}
|
|
137
151
|
if (Array.isArray(content.ciVersions)) {
|
|
138
152
|
const parsed = parseCIVersions(content.ciVersions)
|
|
139
153
|
contentDefaults.engines = parsed.engines
|
package/lib/content/gitignore
CHANGED
package/lib/content/index.js
CHANGED
|
@@ -13,7 +13,10 @@ const rootRepo = {
|
|
|
13
13
|
'.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
|
|
14
14
|
'.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
|
|
15
15
|
'.github/workflows/pull-request.yml': 'pull-request.yml',
|
|
16
|
-
'.github/workflows/release-please.yml':
|
|
16
|
+
'.github/workflows/release-please.yml': {
|
|
17
|
+
file: 'release-please.yml',
|
|
18
|
+
filter: (o) => !o.pkg.private,
|
|
19
|
+
},
|
|
17
20
|
},
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -70,6 +73,7 @@ module.exports = {
|
|
|
70
73
|
distPaths: ['bin/', 'lib/'],
|
|
71
74
|
ciVersions: ['12.13.0', '12.x', '14.15.0', '14.x', '16.0.0', '16.x'],
|
|
72
75
|
lockfile: false,
|
|
76
|
+
npmBin: 'npm',
|
|
73
77
|
unwantedPackages: [
|
|
74
78
|
'eslint',
|
|
75
79
|
'eslint-plugin-node',
|
package/lib/content/pkg.json
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
"lint": "eslint \"**/*.js\"",
|
|
6
6
|
"postlint": "template-oss-check",
|
|
7
7
|
"template-oss-apply": "template-oss-apply --force",
|
|
8
|
-
"lintfix": "
|
|
9
|
-
"preversion": "
|
|
8
|
+
"lintfix": "{{npmBin}} run lint -- --fix",
|
|
9
|
+
"preversion": "{{npmBin}} test",
|
|
10
10
|
{{#if pkgPrivate}}
|
|
11
11
|
"postversion": "git push origin --follow-tags",
|
|
12
12
|
{{else}}
|
|
13
|
-
"postversion": "
|
|
13
|
+
"postversion": "{{npmBin}} publish",
|
|
14
14
|
"prepublishOnly": "git push origin --follow-tags",
|
|
15
15
|
{{/if}}
|
|
16
16
|
"snap": "tap",
|
|
17
17
|
"test": "tap",
|
|
18
|
-
"posttest": "
|
|
18
|
+
"posttest": "{{npmBin}} run lint",
|
|
19
19
|
"template-copy": {{{del}}},
|
|
20
20
|
"lint:fix": {{{del}}}
|
|
21
21
|
},
|