@npmcli/template-oss 4.1.2 → 4.2.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/apply/apply-files.js +1 -1
- package/lib/apply/index.js +1 -1
- package/lib/check/check-apply.js +5 -4
- package/lib/check/index.js +1 -1
- package/lib/config.js +150 -111
- package/lib/content/_setup-ci-on.yml +32 -0
- package/lib/content/_setup-deps.yml +1 -0
- package/lib/content/{setup-git.yml → _setup-git.yml} +2 -2
- package/lib/content/_setup-job-matrix.yml +27 -0
- package/lib/content/_setup-job.yml +6 -0
- package/lib/content/{setup-node.yml → _setup-node.yml} +2 -0
- package/lib/content/audit.yml +2 -6
- package/lib/content/ci.yml +5 -51
- package/lib/content/dependabot.yml +18 -0
- package/lib/content/eslintrc.js +7 -0
- package/lib/content/gitignore +0 -13
- package/lib/content/index.js +36 -14
- package/lib/content/pkg.json +21 -3
- package/lib/content/post-dependabot.yml +3 -8
- package/lib/content/pull-request.yml +2 -6
- package/lib/content/release-please.yml +6 -15
- package/lib/content/release.yml +20 -0
- package/lib/index.js +21 -21
- package/lib/util/files.js +69 -27
- package/lib/util/gitignore.js +34 -0
- package/lib/util/merge.js +21 -0
- package/lib/util/parser.js +3 -2
- package/lib/util/template.js +21 -19
- package/package.json +7 -2
- package/lib/content/release-test.yml +0 -46
- package/lib/content/setup-deps.yml +0 -1
package/lib/apply/apply-files.js
CHANGED
|
@@ -3,7 +3,7 @@ const log = require('proc-log')
|
|
|
3
3
|
const { rmEach, parseEach } = require('../util/files.js')
|
|
4
4
|
|
|
5
5
|
const run = async (dir, files, options) => {
|
|
6
|
-
const { rm
|
|
6
|
+
const { rm, add } = files
|
|
7
7
|
|
|
8
8
|
log.verbose('apply-files', 'rm', rm)
|
|
9
9
|
await rmEach(dir, rm, options, (f) => fs.rm(f))
|
package/lib/apply/index.js
CHANGED
package/lib/check/check-apply.js
CHANGED
|
@@ -2,13 +2,14 @@ const log = require('proc-log')
|
|
|
2
2
|
const { relative, basename } = require('path')
|
|
3
3
|
const { rmEach, parseEach } = require('../util/files.js')
|
|
4
4
|
const { partition } = require('lodash')
|
|
5
|
+
const localeCompare = require('@isaacs/string-locale-compare')('en')
|
|
5
6
|
|
|
6
7
|
const solution = 'npx template-oss-apply --force'
|
|
7
8
|
|
|
8
9
|
const run = async (type, dir, files, options) => {
|
|
9
10
|
const res = []
|
|
10
11
|
const rel = (f) => relative(options.root, f)
|
|
11
|
-
const { add: addFiles
|
|
12
|
+
const { add: addFiles, rm: rmFiles } = files
|
|
12
13
|
|
|
13
14
|
const rm = await rmEach(dir, rmFiles, options, (f) => rel(f))
|
|
14
15
|
const [add, update] = partition(await parseEach(dir, addFiles, options, async (p) => {
|
|
@@ -28,7 +29,7 @@ const run = async (type, dir, files, options) => {
|
|
|
28
29
|
if (rm.length) {
|
|
29
30
|
res.push({
|
|
30
31
|
title: `The following ${type} files need to be deleted:`,
|
|
31
|
-
body: rm,
|
|
32
|
+
body: rm.sort(localeCompare),
|
|
32
33
|
solution,
|
|
33
34
|
})
|
|
34
35
|
}
|
|
@@ -37,13 +38,13 @@ const run = async (type, dir, files, options) => {
|
|
|
37
38
|
if (add.length) {
|
|
38
39
|
res.push({
|
|
39
40
|
title: `The following ${type} files need to be added:`,
|
|
40
|
-
body: add,
|
|
41
|
+
body: add.sort(localeCompare),
|
|
41
42
|
solution,
|
|
42
43
|
})
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
log.verbose('check-apply', 'update', update)
|
|
46
|
-
res.push(...update.map(({ file, diff }) => ({
|
|
47
|
+
res.push(...update.sort((a, b) => localeCompare(a.file, b.file)).map(({ file, diff }) => ({
|
|
47
48
|
title: `The ${type} file ${basename(file)} needs to be updated:`,
|
|
48
49
|
body: [`${file}\n${'='.repeat(40)}\n${diff}`],
|
|
49
50
|
solution,
|
package/lib/check/index.js
CHANGED
package/lib/config.js
CHANGED
|
@@ -1,101 +1,142 @@
|
|
|
1
|
-
const { relative, dirname, join, posix, win32 } = require('path')
|
|
2
|
-
const
|
|
3
|
-
const { uniq, defaults } = require('lodash')
|
|
1
|
+
const { relative, dirname, join, extname, posix, win32 } = require('path')
|
|
2
|
+
const { defaults, pick, omit, uniq } = require('lodash')
|
|
4
3
|
const parseCIVersions = require('./util/parse-ci-versions.js')
|
|
5
4
|
const getGitUrl = require('./util/get-git-url.js')
|
|
6
|
-
const
|
|
5
|
+
const gitignore = require('./util/gitignore.js')
|
|
6
|
+
const { withArrays } = require('./util/merge.js')
|
|
7
|
+
const { FILE_KEYS, parseConfig: parseFiles, getAddedFiles } = require('./util/files.js')
|
|
7
8
|
|
|
8
9
|
const CONFIG_KEY = 'templateOSS'
|
|
9
10
|
const getPkgConfig = (pkg) => pkg[CONFIG_KEY] || {}
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const { name: NAME, version: LATEST_VERSION } = require('../package.json')
|
|
13
|
+
const MERGE_KEYS = [...FILE_KEYS, 'defaultContent', 'content']
|
|
14
|
+
const DEFAULT_CONTENT = require.resolve(NAME)
|
|
15
|
+
|
|
16
|
+
const merge = withArrays('branches', 'distPaths', 'allowPaths', 'ignorePaths')
|
|
17
|
+
|
|
18
|
+
const makePosix = (str) => str.split(win32.sep).join(posix.sep)
|
|
19
|
+
|
|
20
|
+
const getCmdPath = (key, { rootConfig, defaultConfig, isRoot, path, root }) => {
|
|
21
|
+
// Make a path relative from a workspace to the root if we are in a workspace
|
|
22
|
+
const wsToRoot = (p) => isRoot ? p : makePosix(join(relative(path, root), p))
|
|
23
|
+
|
|
24
|
+
const rootPath = rootConfig[key]
|
|
25
|
+
const defaultPath = defaultConfig[key]
|
|
26
|
+
const isLocal = rootPath && rootPath !== defaultPath
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isLocal,
|
|
30
|
+
root: !isLocal ? defaultPath : `node ${rootPath}`,
|
|
31
|
+
local: !isLocal ? defaultPath : `node ${wsToRoot(rootPath)}`,
|
|
19
32
|
}
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return `!${posix.sep}${first}${isDir ? posix.sep : ''}`
|
|
35
|
+
const mergeConfigs = (...configs) => {
|
|
36
|
+
const mergedConfig = merge(...configs.map(c => pick(c, MERGE_KEYS)))
|
|
37
|
+
return defaults(mergedConfig, {
|
|
38
|
+
defaultContent: DEFAULT_CONTENT,
|
|
39
|
+
// allow all file types by default
|
|
40
|
+
...FILE_KEYS.reduce((acc, key) => {
|
|
41
|
+
acc[key] = true
|
|
42
|
+
return acc
|
|
43
|
+
}, {}),
|
|
44
|
+
})
|
|
33
45
|
}
|
|
34
46
|
|
|
35
|
-
const
|
|
47
|
+
const readContentPath = (path) => {
|
|
48
|
+
if (!path) {
|
|
49
|
+
return {}
|
|
50
|
+
}
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
let content = {}
|
|
53
|
+
const index = extname(path) === '.js' ? path : join(path, 'index.js')
|
|
54
|
+
const dir = dirname(index)
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
content = require(index)
|
|
58
|
+
} catch {
|
|
59
|
+
// its ok if this fails since the content dir
|
|
60
|
+
// might only be to provide other files. the
|
|
61
|
+
// index.js is optional
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { content, dir }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const getConfig = (path, rawConfig) => {
|
|
68
|
+
const config = omit(readContentPath(path).content, FILE_KEYS)
|
|
69
|
+
return merge(config, rawConfig ? omit(rawConfig, FILE_KEYS) : {})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const getFiles = (path, rawConfig) => {
|
|
73
|
+
const { content, dir } = readContentPath(path)
|
|
74
|
+
if (!dir) {
|
|
75
|
+
return []
|
|
76
|
+
}
|
|
77
|
+
return [parseFiles(pick(content, FILE_KEYS), dir, pick(rawConfig, FILE_KEYS)), dir]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const getFullConfig = async ({
|
|
40
81
|
root,
|
|
41
82
|
path,
|
|
42
83
|
pkg,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
config: {
|
|
48
|
-
rootRepo,
|
|
49
|
-
rootModule,
|
|
50
|
-
workspaceRepo,
|
|
51
|
-
workspaceModule,
|
|
52
|
-
version,
|
|
53
|
-
...pkgConfig // this includes config merged in from root
|
|
54
|
-
},
|
|
84
|
+
pkgs,
|
|
85
|
+
workspaces,
|
|
86
|
+
rootConfig: _rootConfig,
|
|
87
|
+
pkgConfig: _pkgConfig,
|
|
55
88
|
}) => {
|
|
56
89
|
const isRoot = root === path
|
|
57
|
-
const
|
|
90
|
+
const isRootMono = isRoot && workspaces.length > 0
|
|
91
|
+
const isLatest = _pkgConfig.version === LATEST_VERSION
|
|
58
92
|
const isDogFood = pkg.name === NAME
|
|
59
93
|
const isForce = process.argv.includes('--force')
|
|
60
|
-
const rawPkgConfig = getPkgConfig(pkg)
|
|
61
94
|
|
|
62
95
|
// this is written to ci yml files so it needs to always use posix
|
|
63
96
|
const pkgRelPath = makePosix(relative(root, path))
|
|
64
|
-
const gitUrl = await getGitUrl(root)
|
|
65
97
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
const workspacePkgs = pkgs.filter((p) => p.path !== path)
|
|
99
|
+
const workspaceDirs = isRootMono && workspaces.map((p) => makePosix(relative(root, p)))
|
|
100
|
+
const workspaceGlobs = isRootMono && pkg.workspaces.map(p => p.replace(/[/*]+$/, ''))
|
|
101
|
+
|
|
102
|
+
// These config items are merged betweent the root and child workspaces and only come from
|
|
103
|
+
// the package.json because they can be used to read configs from other the content directories
|
|
104
|
+
const mergedConfig = mergeConfigs(_rootConfig, _pkgConfig)
|
|
105
|
+
|
|
106
|
+
const defaultConfig = getConfig(DEFAULT_CONTENT)
|
|
107
|
+
const [defaultFiles, defaultDir] = getFiles(DEFAULT_CONTENT, mergedConfig)
|
|
108
|
+
const useDefault = mergedConfig.defaultContent && defaultConfig
|
|
109
|
+
|
|
110
|
+
const rootConfig = getConfig(_rootConfig.content, _rootConfig)
|
|
111
|
+
const [rootFiles, rootDir] = getFiles(_rootConfig.content, mergedConfig)
|
|
112
|
+
|
|
113
|
+
// The content config only gets set from the package we are in, it doesn't inherit
|
|
114
|
+
// anything from the root
|
|
115
|
+
const pkgConfig = merge(useDefault, getConfig(_pkgConfig.content, _pkgConfig))
|
|
116
|
+
const [pkgFiles, pkgDir] = getFiles(mergedConfig.content, mergedConfig)
|
|
117
|
+
|
|
118
|
+
// Files get merged in from the default content (that template-oss provides) as well
|
|
119
|
+
// as any content paths provided from the root or the workspace
|
|
120
|
+
const fileDirs = uniq([useDefault && defaultDir, rootDir, pkgDir].filter(Boolean))
|
|
121
|
+
const files = merge(useDefault && defaultFiles, rootFiles, pkgFiles)
|
|
122
|
+
const repoFiles = isRoot ? files.rootRepo : files.workspaceRepo
|
|
123
|
+
const moduleFiles = isRoot ? files.rootModule : files.workspaceModule
|
|
124
|
+
|
|
125
|
+
const allowRootDirs = [
|
|
126
|
+
// Allways allow module files in root or workspaces
|
|
127
|
+
...getAddedFiles(moduleFiles),
|
|
128
|
+
...isRoot ? [
|
|
129
|
+
// in the root allow all repo files
|
|
130
|
+
...getAddedFiles(repoFiles),
|
|
131
|
+
// and allow all workspace repo level files
|
|
132
|
+
...workspacePkgs.filter(p => p.config.workspaceRepo !== false).flatMap((p) =>
|
|
133
|
+
getAddedFiles(files.workspaceRepo)
|
|
134
|
+
),
|
|
135
|
+
] : [],
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
const npmPath = getCmdPath('npm', { rootConfig, defaultConfig, isRoot, path, root })
|
|
139
|
+
const npxPath = getCmdPath('npx', { rootConfig, defaultConfig, isRoot, path, root })
|
|
99
140
|
|
|
100
141
|
// all derived keys
|
|
101
142
|
const derived = {
|
|
@@ -106,7 +147,8 @@ const getConfig = async ({
|
|
|
106
147
|
// For these cases it is helpful to know if we are in a
|
|
107
148
|
// monorepo since template-oss might be used only for
|
|
108
149
|
// workspaces and not the root or vice versa.
|
|
109
|
-
|
|
150
|
+
isRootMono,
|
|
151
|
+
isMono: isRootMono || !isRoot,
|
|
110
152
|
// repo
|
|
111
153
|
repoDir: root,
|
|
112
154
|
repoFiles,
|
|
@@ -120,10 +162,31 @@ const getConfig = async ({
|
|
|
120
162
|
pkgNameFs: pkg.name.replace(/\//g, '-').replace(/@/g, ''),
|
|
121
163
|
pkgRelPath: pkgRelPath,
|
|
122
164
|
pkgPrivate: !!pkg.private,
|
|
165
|
+
pkgPublic: !pkg.private,
|
|
166
|
+
workspaces: workspaceDirs,
|
|
167
|
+
workspaceGlobs,
|
|
123
168
|
// booleans to control application of updates
|
|
124
169
|
isForce,
|
|
125
170
|
isDogFood,
|
|
126
171
|
isLatest,
|
|
172
|
+
// whether to install and update npm in ci
|
|
173
|
+
// only do this if we aren't using a custom path to bin
|
|
174
|
+
updateNpm: !npmPath.isLocal,
|
|
175
|
+
rootNpmPath: npmPath.root,
|
|
176
|
+
localNpmPath: npmPath.local,
|
|
177
|
+
rootNpxPath: npxPath.root,
|
|
178
|
+
// gitignore
|
|
179
|
+
ignorePaths: [
|
|
180
|
+
...gitignore.sort([
|
|
181
|
+
...gitignore.allowRootDir(allowRootDirs),
|
|
182
|
+
...isRoot && pkgConfig.lockfile ? ['!/package-lock.json'] : [],
|
|
183
|
+
...(pkgConfig.allowPaths || []).map((p) => `!${p}`),
|
|
184
|
+
...(pkgConfig.ignorePaths || []),
|
|
185
|
+
]),
|
|
186
|
+
// these cant be sorted since they rely on order
|
|
187
|
+
// to allow a previously ignored directoy
|
|
188
|
+
...gitignore.allowDir(workspaceDirs || []),
|
|
189
|
+
],
|
|
127
190
|
// needs update if we are dogfooding this repo, with force argv, or its
|
|
128
191
|
// behind the current version
|
|
129
192
|
needsUpdate: isForce || isDogFood || !isLatest,
|
|
@@ -131,55 +194,31 @@ const getConfig = async ({
|
|
|
131
194
|
__NAME__: NAME,
|
|
132
195
|
__CONFIG_KEY__: CONFIG_KEY,
|
|
133
196
|
__VERSION__: LATEST_VERSION,
|
|
197
|
+
__PARTIAL_DIRS__: fileDirs,
|
|
134
198
|
}
|
|
135
199
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const contentDefaults = {}
|
|
143
|
-
|
|
144
|
-
if (content.npmBin && content.npmBin !== baseContent.npmBin) {
|
|
145
|
-
// make it relative to each workspace if they did not set the config themselves
|
|
146
|
-
if (!rawPkgConfig.npmBin) {
|
|
147
|
-
content.npmBin = makePosix(join(relative(path, root), content.npmBin))
|
|
148
|
-
}
|
|
149
|
-
// a bit of a hack but allow custom node paths or no node path at all
|
|
150
|
-
// checks if the first thing has node somewhere in it and if it doesnt
|
|
151
|
-
// puts a system node in front of the script
|
|
152
|
-
const execPaths = content.npmBin.split(' ')[0].split(posix.sep)
|
|
153
|
-
if (execPaths.every(p => p !== 'node')) {
|
|
154
|
-
content.npmBin = `node ${content.npmBin}`
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (Array.isArray(content.ciVersions)) {
|
|
158
|
-
const parsed = parseCIVersions(content.ciVersions)
|
|
159
|
-
contentDefaults.engines = parsed.engines
|
|
160
|
-
content.ciVersions = parsed.targets
|
|
161
|
-
log.verbose('config ci', parsed)
|
|
200
|
+
if (pkgConfig.ciVersions) {
|
|
201
|
+
const versions = pkgConfig.ciVersions
|
|
202
|
+
const defaultVersions = defaultConfig.ciVersions
|
|
203
|
+
const parsed = parseCIVersions(versions === 'latest' ? defaultVersions.slice(-1) : versions)
|
|
204
|
+
derived.ciVersions = parsed.targets
|
|
205
|
+
derived.engines = pkgConfig.engines || parsed.engines
|
|
162
206
|
}
|
|
163
207
|
|
|
208
|
+
const gitUrl = await getGitUrl(root)
|
|
164
209
|
if (gitUrl) {
|
|
165
|
-
|
|
210
|
+
derived.repository = {
|
|
166
211
|
type: 'git',
|
|
167
212
|
url: gitUrl,
|
|
168
213
|
...(pkgRelPath ? { directory: pkgRelPath } : {}),
|
|
169
214
|
}
|
|
170
215
|
}
|
|
171
216
|
|
|
172
|
-
contentDefaults.ignorePaths = uniq(
|
|
173
|
-
[...ignorePaths, ...(content.distPaths || [])].map(negatePath)
|
|
174
|
-
).sort()
|
|
175
|
-
|
|
176
|
-
log.verbose('config', 'defaults', contentDefaults)
|
|
177
|
-
|
|
178
217
|
return {
|
|
179
|
-
...
|
|
218
|
+
...pkgConfig,
|
|
180
219
|
...derived,
|
|
181
220
|
}
|
|
182
221
|
}
|
|
183
222
|
|
|
184
|
-
module.exports =
|
|
223
|
+
module.exports = getFullConfig
|
|
185
224
|
module.exports.getPkgConfig = getPkgConfig
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
workflow_dispatch:
|
|
2
|
+
pull_request:
|
|
3
|
+
branches:
|
|
4
|
+
- '*'
|
|
5
|
+
{{#if pkgRelPath}}
|
|
6
|
+
paths:
|
|
7
|
+
- {{pkgRelPath}}/**
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{#if workspaceGlobs}}
|
|
10
|
+
paths-ignore:
|
|
11
|
+
{{#each workspaceGlobs}}
|
|
12
|
+
- {{.}}/**
|
|
13
|
+
{{/each}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
push:
|
|
16
|
+
branches:
|
|
17
|
+
{{#each branches}}
|
|
18
|
+
- {{.}}
|
|
19
|
+
{{/each}}
|
|
20
|
+
{{#if pkgRelPath}}
|
|
21
|
+
paths:
|
|
22
|
+
- {{pkgRelPath}}/**
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#if workspaceGlobs}}
|
|
25
|
+
paths-ignore:
|
|
26
|
+
{{#each workspaceGlobs}}
|
|
27
|
+
- {{.}}/**
|
|
28
|
+
{{/each}}
|
|
29
|
+
{{/if}}
|
|
30
|
+
schedule:
|
|
31
|
+
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
|
|
32
|
+
- cron: "0 9 * * 1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
- run: {{rootNpmPath}} i --ignore-scripts --no-audit --no-fund {{~#if flags}} {{flags}}{{/if}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
if: github.repository_owner == 'npm'
|
|
2
|
+
strategy:
|
|
3
|
+
fail-fast: false
|
|
4
|
+
matrix:
|
|
5
|
+
node-version:
|
|
6
|
+
{{#each ciVersions}}
|
|
7
|
+
- {{.}}
|
|
8
|
+
{{/each}}
|
|
9
|
+
platform:
|
|
10
|
+
- os: ubuntu-latest
|
|
11
|
+
shell: bash
|
|
12
|
+
{{#if macCI}}
|
|
13
|
+
- os: macos-latest
|
|
14
|
+
shell: bash
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if windowsCI}}
|
|
17
|
+
- os: windows-latest
|
|
18
|
+
shell: cmd
|
|
19
|
+
{{/if}}
|
|
20
|
+
runs-on: $\{{ matrix.platform.os }}
|
|
21
|
+
defaults:
|
|
22
|
+
run:
|
|
23
|
+
shell: $\{{ matrix.platform.shell }}
|
|
24
|
+
steps:
|
|
25
|
+
{{> setupGit}}
|
|
26
|
+
{{> setupNode useMatrix=true}}
|
|
27
|
+
{{> setupDeps}}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
{{#if lockfile}}
|
|
5
5
|
cache: npm
|
|
6
6
|
{{/if}}
|
|
7
|
+
{{#if updateNpm}}
|
|
7
8
|
{{#if useMatrix}}
|
|
8
9
|
- name: Update to workable npm (windows)
|
|
9
10
|
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
|
|
@@ -26,3 +27,4 @@
|
|
|
26
27
|
{{/if}}
|
|
27
28
|
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
|
|
28
29
|
- run: npm -v
|
|
30
|
+
{{/if}}
|
package/lib/content/audit.yml
CHANGED
package/lib/content/ci.yml
CHANGED
|
@@ -1,61 +1,15 @@
|
|
|
1
1
|
name: CI {{~#if isWorkspace}} - {{pkgName}}{{/if}}
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
pull_request:
|
|
6
|
-
branches:
|
|
7
|
-
- '*'
|
|
8
|
-
{{#if pkgRelPath}}
|
|
9
|
-
paths:
|
|
10
|
-
- {{pkgRelPath}}/**
|
|
11
|
-
{{/if}}
|
|
12
|
-
push:
|
|
13
|
-
branches:
|
|
14
|
-
{{#each branches}}
|
|
15
|
-
- {{.}}
|
|
16
|
-
{{/each}}
|
|
17
|
-
{{#if pkgRelPath}}
|
|
18
|
-
paths:
|
|
19
|
-
- {{pkgRelPath}}/**
|
|
20
|
-
{{/if}}
|
|
21
|
-
schedule:
|
|
22
|
-
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
|
|
23
|
-
- cron: "0 9 * * 1"
|
|
4
|
+
{{> setupCiOn}}
|
|
24
5
|
|
|
25
6
|
jobs:
|
|
26
7
|
lint:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
{{> setupGit}}
|
|
30
|
-
{{> setupNode}}
|
|
31
|
-
{{> setupDeps}}
|
|
32
|
-
- run: npm run lint {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
8
|
+
{{> setupJob }}
|
|
9
|
+
- run: {{rootNpmPath}} run lint {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
33
10
|
|
|
34
11
|
test:
|
|
35
|
-
|
|
36
|
-
fail-fast: false
|
|
37
|
-
matrix:
|
|
38
|
-
node-version:
|
|
39
|
-
{{#each ciVersions}}
|
|
40
|
-
- {{.}}
|
|
41
|
-
{{/each}}
|
|
42
|
-
platform:
|
|
43
|
-
- os: ubuntu-latest
|
|
44
|
-
shell: bash
|
|
45
|
-
- os: macos-latest
|
|
46
|
-
shell: bash
|
|
47
|
-
{{#if windowsCI}}
|
|
48
|
-
- os: windows-latest
|
|
49
|
-
shell: cmd
|
|
50
|
-
{{/if}}
|
|
51
|
-
runs-on: $\{{ matrix.platform.os }}
|
|
52
|
-
defaults:
|
|
53
|
-
run:
|
|
54
|
-
shell: $\{{ matrix.platform.shell }}
|
|
55
|
-
steps:
|
|
56
|
-
{{> setupGit}}
|
|
57
|
-
{{> setupNode useMatrix=true}}
|
|
58
|
-
{{> setupDeps}}
|
|
12
|
+
{{> setupJobMatrix }}
|
|
59
13
|
- name: add tap problem matcher
|
|
60
14
|
run: echo "::add-matcher::.github/matchers/tap.json"
|
|
61
|
-
- run:
|
|
15
|
+
- run: {{rootNpmPath}} test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
@@ -13,3 +13,21 @@ updates:
|
|
|
13
13
|
prefix-development: chore
|
|
14
14
|
labels:
|
|
15
15
|
- "Dependencies"
|
|
16
|
+
|
|
17
|
+
{{#if workspaces}}
|
|
18
|
+
{{#each workspaces}}
|
|
19
|
+
- package-ecosystem: npm
|
|
20
|
+
directory: "{{.}}/"
|
|
21
|
+
schedule:
|
|
22
|
+
interval: daily
|
|
23
|
+
allow:
|
|
24
|
+
- dependency-type: direct
|
|
25
|
+
versioning-strategy: increase-if-necessary
|
|
26
|
+
commit-message:
|
|
27
|
+
prefix: deps
|
|
28
|
+
prefix-development: chore
|
|
29
|
+
labels:
|
|
30
|
+
- "Dependencies"
|
|
31
|
+
|
|
32
|
+
{{/each}}
|
|
33
|
+
{{/if}}
|
package/lib/content/eslintrc.js
CHANGED
package/lib/content/gitignore
CHANGED
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
/*
|
|
3
3
|
|
|
4
4
|
# keep these
|
|
5
|
-
!/.eslintrc.local.*
|
|
6
|
-
!**/.gitignore
|
|
7
|
-
!/docs/
|
|
8
|
-
!/tap-snapshots/
|
|
9
|
-
!/test/
|
|
10
|
-
!/map.js
|
|
11
|
-
!/scripts/
|
|
12
|
-
!/README*
|
|
13
|
-
!/LICENSE*
|
|
14
|
-
!/CHANGELOG*
|
|
15
5
|
{{#each ignorePaths}}
|
|
16
6
|
{{.}}
|
|
17
7
|
{{/each}}
|
|
18
|
-
{{#if lockfile}}
|
|
19
|
-
!/package-lock.json
|
|
20
|
-
{{/if}}
|