@npmcli/template-oss 2.9.0 → 3.0.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/README.md +77 -68
- package/bin/apply.js +22 -0
- package/bin/check.js +26 -0
- package/lib/apply/apply-files.js +31 -0
- package/lib/apply/index.js +5 -0
- package/lib/check/check-apply.js +73 -0
- package/lib/check/check-changelog.js +31 -0
- package/lib/check/check-gitignore.js +67 -0
- package/lib/check/check-required.js +36 -0
- package/lib/check/check-unwanted.js +23 -0
- package/lib/check/index.js +9 -0
- package/lib/config.js +151 -40
- package/lib/content/CODEOWNERS +1 -1
- package/lib/content/LICENSE.md +0 -2
- package/lib/content/SECURITY.md +0 -2
- package/lib/content/audit.yml +5 -12
- package/lib/content/bug.yml +45 -46
- package/lib/content/ci.yml +35 -38
- package/lib/content/codeql-analysis.yml +11 -9
- package/lib/content/commitlintrc.js +1 -4
- package/lib/content/config.yml +0 -2
- package/lib/content/dependabot.yml +13 -14
- package/lib/content/eslintrc.js +0 -2
- package/lib/content/gitignore +8 -14
- package/lib/content/index.js +90 -0
- package/lib/content/npmrc +0 -2
- package/lib/content/package.json +27 -0
- package/lib/content/post-dependabot.yml +16 -15
- package/lib/content/pull-request.yml +12 -11
- package/lib/content/release-please.yml +18 -11
- package/lib/content/setup-git.yml +11 -0
- package/lib/content/setup-node.yml +21 -0
- package/lib/index.js +100 -0
- package/lib/util/files.js +43 -0
- package/lib/util/get-git-url.js +24 -0
- package/lib/util/has-package.js +30 -0
- package/lib/util/json-diff.js +38 -0
- package/lib/util/output.js +35 -0
- package/lib/util/parse-ci-versions.js +78 -0
- package/lib/util/parser.js +279 -0
- package/lib/util/template.js +41 -0
- package/package.json +29 -26
- package/bin/.gitattributes +0 -3
- package/bin/npm-template-check.js +0 -44
- package/bin/postinstall.js +0 -31
- package/lib/content/ci-no-windows.yml +0 -48
- package/lib/content/ci-workspace.yml +0 -63
- package/lib/content/release-please-workspace.yml +0 -29
- package/lib/postinstall/copy-content.js +0 -133
- package/lib/postinstall/update-package.js +0 -100
- package/lib/postlint/check-gitignore.js +0 -59
- package/lib/postlint/check-package.js +0 -90
package/lib/config.js
CHANGED
|
@@ -1,51 +1,162 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const { relative, dirname, posix, win32 } = require('path')
|
|
2
|
+
const log = require('proc-log')
|
|
3
|
+
const { uniq, defaults } = require('lodash')
|
|
4
|
+
const parseCIVersions = require('./util/parse-ci-versions.js')
|
|
5
|
+
const getGitUrl = require('./util/get-git-url.js')
|
|
6
|
+
const { name: NAME, version: LATEST_VERSION } = require('../package.json')
|
|
7
|
+
|
|
8
|
+
const CONFIG_KEY = 'templateOSS'
|
|
9
|
+
const getPkgConfig = (pkg) => pkg[CONFIG_KEY] || {}
|
|
10
|
+
|
|
11
|
+
const getContent = (contentPath) => {
|
|
12
|
+
if (typeof contentPath === 'string') {
|
|
13
|
+
return defaults(require(contentPath), {
|
|
14
|
+
sourceDir: dirname(require.resolve(contentPath)),
|
|
15
|
+
})
|
|
16
|
+
} else {
|
|
17
|
+
// allow passing in content directly for tests
|
|
18
|
+
return contentPath
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// falsy means no content of this type
|
|
23
|
+
const getFiles = (config, content) => config ? content : null
|
|
24
|
+
const getFileKeys = (files) => files ? Object.keys(files.add || {}) : []
|
|
25
|
+
const negatePath = (p) => {
|
|
26
|
+
// XXX: this negates the first part of each path for the gitignore
|
|
27
|
+
// files. it might make sense to negate more specific portions of the
|
|
28
|
+
// path for some paths like workspaces. so instead of ignoring !/workspaces
|
|
29
|
+
// it would only ignore !/workspaces/a, !/workspaces/b, etc
|
|
30
|
+
const [first, ...parts] = p.split(posix.sep)
|
|
31
|
+
const isDir = parts.length > 0
|
|
32
|
+
return `!${posix.sep}${first}${isDir ? posix.sep : ''}`
|
|
11
33
|
}
|
|
12
34
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
const makePosix = (str) => str.split(win32.sep).join(posix.sep)
|
|
36
|
+
|
|
37
|
+
const getConfig = async ({
|
|
38
|
+
pkgs,
|
|
39
|
+
workspaces,
|
|
40
|
+
root,
|
|
41
|
+
path,
|
|
42
|
+
pkg,
|
|
43
|
+
// default content path is looked up via require.resolve
|
|
44
|
+
// so use the name of this module since package.json#main
|
|
45
|
+
// points to the content dir
|
|
46
|
+
content: contentPath = NAME,
|
|
47
|
+
config: {
|
|
48
|
+
rootRepo,
|
|
49
|
+
rootModule,
|
|
50
|
+
workspaceRepo,
|
|
51
|
+
workspaceModule,
|
|
52
|
+
version,
|
|
53
|
+
...pkgContent
|
|
54
|
+
},
|
|
55
|
+
}) => {
|
|
56
|
+
const isRoot = root === path
|
|
57
|
+
const isLatest = version === LATEST_VERSION
|
|
58
|
+
const isDogFood = pkg.name === NAME
|
|
59
|
+
|
|
60
|
+
// this is written to ci yml files so it needs to always use posix
|
|
61
|
+
const pkgRelPath = makePosix(relative(root, path))
|
|
62
|
+
const gitUrl = await getGitUrl(root)
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
rootRepo: rootRepoContent,
|
|
66
|
+
rootModule: rootModuleContent,
|
|
67
|
+
workspaceRepo: workspaceRepoContent,
|
|
68
|
+
workspaceModule: workspaceModuleContent,
|
|
69
|
+
...baseContent
|
|
70
|
+
} = getContent(contentPath)
|
|
71
|
+
|
|
72
|
+
let repoFiles, moduleFiles
|
|
73
|
+
const ignorePaths = []
|
|
74
|
+
|
|
75
|
+
if (isRoot) {
|
|
76
|
+
repoFiles = getFiles(rootRepo, rootRepoContent)
|
|
77
|
+
moduleFiles = getFiles(rootModule, rootModuleContent)
|
|
78
|
+
ignorePaths.push(
|
|
79
|
+
// allow workspace paths if they are set, this is directly from
|
|
80
|
+
// map-workspaces so normalize to posix paths for gitignore
|
|
81
|
+
...workspaces.map((p) => makePosix(relative(root, p))),
|
|
82
|
+
// allow both the repo and module files since this is the root
|
|
83
|
+
...getFileKeys(repoFiles),
|
|
84
|
+
...getFileKeys(moduleFiles),
|
|
85
|
+
// allow all workspace repo level files
|
|
86
|
+
...pkgs.filter((p) => p.path !== path).flatMap((p) =>
|
|
87
|
+
getFileKeys(getFiles(p.config.workspaceRepo, workspaceRepoContent))
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
} else {
|
|
91
|
+
repoFiles = getFiles(workspaceRepo, workspaceRepoContent)
|
|
92
|
+
moduleFiles = getFiles(workspaceModule, workspaceModuleContent)
|
|
93
|
+
// In a workspace gitignores are relative to the workspace dir
|
|
94
|
+
// so we should only allow added module files
|
|
95
|
+
ignorePaths.push(...getFileKeys(moduleFiles))
|
|
20
96
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
97
|
+
|
|
98
|
+
// all derived keys
|
|
99
|
+
const derived = {
|
|
100
|
+
isRoot,
|
|
101
|
+
isWorkspace: !isRoot,
|
|
102
|
+
// repo
|
|
103
|
+
repoDir: root,
|
|
104
|
+
repoFiles,
|
|
105
|
+
applyRepo: !!repoFiles,
|
|
106
|
+
// module
|
|
107
|
+
moduleDir: path,
|
|
108
|
+
moduleFiles,
|
|
109
|
+
applyModule: !!moduleFiles,
|
|
110
|
+
// package
|
|
111
|
+
pkgName: pkg.name,
|
|
112
|
+
pkgNameFs: pkg.name.replace(/\//g, '-').replace(/@/g, ''),
|
|
113
|
+
pkgRelPath: pkgRelPath,
|
|
114
|
+
// force changes if we are dogfooding this repo or with force argv
|
|
115
|
+
// XXX: setup proper cli arg parsing
|
|
116
|
+
isForce: isDogFood || process.argv.includes('--force'),
|
|
117
|
+
isLatest,
|
|
118
|
+
needsUpdate: !isLatest,
|
|
119
|
+
// templateoss specific values
|
|
120
|
+
__NAME__: NAME,
|
|
121
|
+
__CONFIG_KEY__: CONFIG_KEY,
|
|
122
|
+
__VERSION__: LATEST_VERSION,
|
|
123
|
+
__DOGFOOD__: isDogFood,
|
|
26
124
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
125
|
+
|
|
126
|
+
// merge the rest of base and pkg content to make the
|
|
127
|
+
// full content object
|
|
128
|
+
const content = { ...baseContent, ...pkgContent }
|
|
129
|
+
|
|
130
|
+
// set some defaults on content that can be overwritten unlike
|
|
131
|
+
// derived values which are calculated from other config
|
|
132
|
+
const contentDefaults = {}
|
|
133
|
+
|
|
134
|
+
if (Array.isArray(content.ciVersions)) {
|
|
135
|
+
const parsed = parseCIVersions(content.ciVersions)
|
|
136
|
+
contentDefaults.engines = parsed.engines
|
|
137
|
+
content.ciVersions = parsed.targets
|
|
138
|
+
log.verbose('config ci', parsed)
|
|
30
139
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for (const [name, path] of workspaceMap.entries()) {
|
|
38
|
-
if (workspaceSet.has(name)) {
|
|
39
|
-
wsPaths.push(path)
|
|
140
|
+
|
|
141
|
+
if (gitUrl) {
|
|
142
|
+
contentDefaults.repository = {
|
|
143
|
+
type: 'git',
|
|
144
|
+
url: gitUrl,
|
|
145
|
+
...(pkgRelPath ? { directory: pkgRelPath } : {}),
|
|
40
146
|
}
|
|
41
147
|
}
|
|
42
|
-
config.workspacePaths = wsPaths
|
|
43
|
-
|
|
44
|
-
config.paths = config.paths.concat(config.workspacePaths)
|
|
45
148
|
|
|
46
|
-
|
|
149
|
+
contentDefaults.ignorePaths = uniq(
|
|
150
|
+
[...ignorePaths, ...(content.distPaths || [])].map(negatePath)
|
|
151
|
+
).sort()
|
|
47
152
|
|
|
48
|
-
|
|
153
|
+
log.verbose('config', 'defaults', contentDefaults)
|
|
49
154
|
|
|
50
|
-
return
|
|
155
|
+
return {
|
|
156
|
+
...defaults(content, contentDefaults),
|
|
157
|
+
...derived,
|
|
158
|
+
}
|
|
51
159
|
}
|
|
160
|
+
|
|
161
|
+
module.exports = getConfig
|
|
162
|
+
module.exports.getPkgConfig = getPkgConfig
|
package/lib/content/CODEOWNERS
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*
|
|
1
|
+
* @npm/cli-team
|
package/lib/content/LICENSE.md
CHANGED
package/lib/content/SECURITY.md
CHANGED
package/lib/content/audit.yml
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
# This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
name: Audit
|
|
4
2
|
|
|
5
3
|
on:
|
|
4
|
+
workflow_dispatch:
|
|
6
5
|
schedule:
|
|
7
6
|
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
|
|
8
7
|
- cron: "0 1 * * 1"
|
|
9
|
-
workflow_dispatch:
|
|
10
8
|
|
|
11
9
|
jobs:
|
|
12
10
|
audit:
|
|
13
|
-
name: npm audit
|
|
14
11
|
runs-on: ubuntu-latest
|
|
15
12
|
steps:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- name: Install deps
|
|
21
|
-
run: npm i --package-lock
|
|
22
|
-
- name: Audit
|
|
23
|
-
run: npm audit
|
|
13
|
+
{{> setupGit}}
|
|
14
|
+
{{> setupNode }}
|
|
15
|
+
- run: npm i --package-lock
|
|
16
|
+
- run: npm audit
|
package/lib/content/bug.yml
CHANGED
|
@@ -1,54 +1,53 @@
|
|
|
1
|
-
# This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
name: Bug
|
|
4
2
|
description: File a bug/issue
|
|
5
3
|
title: "[BUG] <title>"
|
|
6
|
-
labels: [Bug, Needs Triage]
|
|
4
|
+
labels: [ Bug, Needs Triage ]
|
|
5
|
+
|
|
7
6
|
body:
|
|
8
|
-
- type: checkboxes
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
- type: checkboxes
|
|
8
|
+
attributes:
|
|
9
|
+
label: Is there an existing issue for this?
|
|
10
|
+
description: Please [search here](./issues) to see if an issue already exists
|
|
11
|
+
for your problem.
|
|
12
|
+
options:
|
|
13
|
+
- label: I have searched the existing issues
|
|
14
|
+
required: true
|
|
15
|
+
- type: textarea
|
|
16
|
+
attributes:
|
|
17
|
+
label: Current Behavior
|
|
18
|
+
description: A clear & concise description of what you're experiencing.
|
|
19
|
+
validations:
|
|
20
|
+
required: false
|
|
21
|
+
- type: textarea
|
|
22
|
+
attributes:
|
|
23
|
+
label: Expected Behavior
|
|
24
|
+
description: A clear & concise description of what you expected to happen.
|
|
25
|
+
validations:
|
|
26
|
+
required: false
|
|
27
|
+
- type: textarea
|
|
28
|
+
attributes:
|
|
29
|
+
label: Steps To Reproduce
|
|
30
|
+
description: Steps to reproduce the behavior.
|
|
31
|
+
value: |
|
|
32
|
+
1. In this environment...
|
|
33
|
+
2. With this config...
|
|
34
|
+
3. Run '...'
|
|
35
|
+
4. See error...
|
|
36
|
+
validations:
|
|
37
|
+
required: false
|
|
38
|
+
- type: textarea
|
|
39
|
+
attributes:
|
|
40
|
+
label: Environment
|
|
41
|
+
description: |
|
|
42
|
+
examples:
|
|
43
|
+
- **npm**: 7.6.3
|
|
44
|
+
- **Node**: 13.14.0
|
|
45
|
+
- **OS**: Ubuntu 20.04
|
|
46
|
+
- **platform**: Macbook Pro
|
|
47
|
+
value: |
|
|
48
48
|
- npm:
|
|
49
49
|
- Node:
|
|
50
50
|
- OS:
|
|
51
51
|
- platform:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
validations:
|
|
53
|
+
required: false
|
package/lib/content/ci.yml
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: CI
|
|
1
|
+
name: CI {{~#if isWorkspace}} - {{pkgName}}{{/if}}
|
|
4
2
|
|
|
5
3
|
on:
|
|
4
|
+
workflow_dispatch:
|
|
6
5
|
pull_request:
|
|
6
|
+
branches:
|
|
7
|
+
- '*'
|
|
8
|
+
{{#if pkgRelPath}}
|
|
9
|
+
paths:
|
|
10
|
+
- {{pkgRelPath}}
|
|
11
|
+
{{/if}}
|
|
7
12
|
push:
|
|
8
13
|
branches:
|
|
9
|
-
|
|
10
|
-
-
|
|
14
|
+
{{#each branches}}
|
|
15
|
+
- {{.}}
|
|
16
|
+
{{/each}}
|
|
17
|
+
{{#if pkgRelPath}}
|
|
18
|
+
paths:
|
|
19
|
+
- {{pkgRelPath}}
|
|
20
|
+
{{/if}}
|
|
11
21
|
schedule:
|
|
12
22
|
# "At 02:00 on Monday" https://crontab.guru/#0_2_*_*_1
|
|
13
23
|
- cron: "0 2 * * 1"
|
|
@@ -16,47 +26,34 @@ jobs:
|
|
|
16
26
|
lint:
|
|
17
27
|
runs-on: ubuntu-latest
|
|
18
28
|
steps:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
with:
|
|
22
|
-
node-version: '16'
|
|
23
|
-
- run: npm i --prefer-online -g npm@latest
|
|
29
|
+
{{> setupGit}}
|
|
30
|
+
{{> setupNode}}
|
|
24
31
|
- run: npm i
|
|
25
|
-
- run: npm run lint
|
|
32
|
+
- run: npm run lint {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
26
33
|
|
|
27
34
|
test:
|
|
28
35
|
strategy:
|
|
29
36
|
fail-fast: false
|
|
30
37
|
matrix:
|
|
31
|
-
node-version:
|
|
38
|
+
node-version:
|
|
39
|
+
{{#each ciVersions}}
|
|
40
|
+
- {{.}}
|
|
41
|
+
{{/each}}
|
|
32
42
|
platform:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 }}
|
|
40
52
|
defaults:
|
|
41
53
|
run:
|
|
42
|
-
shell:
|
|
54
|
+
shell: $\{{ matrix.platform.shell }}
|
|
43
55
|
steps:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
with:
|
|
47
|
-
node-version: ${{ matrix.node-version }}
|
|
48
|
-
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
|
|
49
|
-
- name: Update to workable npm (windows)
|
|
50
|
-
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
|
|
51
|
-
run: |
|
|
52
|
-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
|
|
53
|
-
tar xf npm-7.5.4.tgz
|
|
54
|
-
cd package
|
|
55
|
-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
|
|
56
|
-
cd ..
|
|
57
|
-
rmdir /s /q package
|
|
58
|
-
- name: Update npm
|
|
59
|
-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
|
|
60
|
-
- run: npm -v
|
|
56
|
+
{{> setupGit}}
|
|
57
|
+
{{> setupNode}}
|
|
61
58
|
- run: npm i
|
|
62
|
-
- run: npm test --ignore-scripts
|
|
59
|
+
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
# This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
name: "CodeQL"
|
|
4
2
|
|
|
5
3
|
on:
|
|
6
4
|
push:
|
|
7
|
-
branches:
|
|
5
|
+
branches:
|
|
6
|
+
{{#each branches}}
|
|
7
|
+
- {{.}}
|
|
8
|
+
{{/each}}
|
|
8
9
|
pull_request:
|
|
9
10
|
# The branches below must be a subset of the branches above
|
|
10
|
-
branches:
|
|
11
|
+
branches:
|
|
12
|
+
{{#each branches}}
|
|
13
|
+
- {{.}}
|
|
14
|
+
{{/each}}
|
|
11
15
|
schedule:
|
|
12
16
|
# "At 03:00 on Monday" https://crontab.guru/#0_3_*_*_1
|
|
13
17
|
- cron: "0 3 * * 1"
|
|
@@ -24,15 +28,13 @@ jobs:
|
|
|
24
28
|
strategy:
|
|
25
29
|
fail-fast: false
|
|
26
30
|
matrix:
|
|
27
|
-
language: [
|
|
31
|
+
language: [javascript]
|
|
28
32
|
|
|
29
33
|
steps:
|
|
30
|
-
|
|
31
|
-
uses: actions/checkout@v2
|
|
32
|
-
|
|
34
|
+
{{> setupGit}}
|
|
33
35
|
- name: Initialize CodeQL
|
|
34
36
|
uses: github/codeql-action/init@v1
|
|
35
37
|
with:
|
|
36
|
-
languages:
|
|
38
|
+
languages: $\{{ matrix.language }}
|
|
37
39
|
- name: Perform CodeQL Analysis
|
|
38
40
|
uses: github/codeql-action/analyze@v1
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
module.exports = {
|
|
4
2
|
extends: ['@commitlint/config-conventional'],
|
|
5
|
-
// If you change rules be sure to also update release-please.yml
|
|
6
3
|
rules: {
|
|
7
|
-
'type-enum': [2, 'always', [
|
|
4
|
+
'type-enum': [2, 'always', [{{#each changelogTypes}}'{{type}}'{{#unless @last}}, {{/unless}}{{/each}}]],
|
|
8
5
|
'header-max-length': [2, 'always', 80],
|
|
9
6
|
'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
|
|
10
7
|
},
|
package/lib/content/config.yml
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
# This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
version: 2
|
|
2
|
+
|
|
4
3
|
updates:
|
|
5
|
-
- package-ecosystem: npm
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
- package-ecosystem: npm
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: daily
|
|
8
|
+
allow:
|
|
9
|
+
- dependency-type: direct
|
|
10
|
+
versioning-strategy: increase
|
|
11
|
+
commit-message:
|
|
12
|
+
prefix: deps
|
|
13
|
+
prefix-development: chore
|
|
14
|
+
labels:
|
|
15
|
+
- "Dependencies"
|
package/lib/content/eslintrc.js
CHANGED
package/lib/content/gitignore
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
# This file is automatically added by @npmcli/template-oss. Do not edit.
|
|
2
|
-
|
|
3
1
|
# ignore everything in the root
|
|
4
2
|
/*
|
|
5
3
|
|
|
6
4
|
# keep these
|
|
7
|
-
!/.
|
|
8
|
-
!/.npmrc
|
|
9
|
-
!/.eslintrc*
|
|
10
|
-
!/.github
|
|
5
|
+
!/.eslintrc.local.*
|
|
11
6
|
!**/.gitignore
|
|
12
|
-
!/
|
|
13
|
-
!/
|
|
14
|
-
!/
|
|
15
|
-
!/lib
|
|
7
|
+
!/docs/
|
|
8
|
+
!/tap-snapshots/
|
|
9
|
+
!/test/
|
|
16
10
|
!/map.js
|
|
17
|
-
!/
|
|
18
|
-
!/test
|
|
19
|
-
!/scripts
|
|
11
|
+
!/scripts/
|
|
20
12
|
!/README*
|
|
21
13
|
!/LICENSE*
|
|
22
|
-
!/SECURITY*
|
|
23
14
|
!/CHANGELOG*
|
|
15
|
+
{{#each ignorePaths}}
|
|
16
|
+
{{.}}
|
|
17
|
+
{{/each}}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Changes applied to the root of the repo
|
|
2
|
+
const rootRepo = {
|
|
3
|
+
add: {
|
|
4
|
+
'.commitlintrc.js': 'commitlintrc.js',
|
|
5
|
+
'.github/workflows/ci.yml': 'ci.yml',
|
|
6
|
+
'.github/ISSUE_TEMPLATE/bug.yml': 'bug.yml',
|
|
7
|
+
'.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
|
|
8
|
+
'.github/CODEOWNERS': 'CODEOWNERS',
|
|
9
|
+
'.github/dependabot.yml': 'dependabot.yml',
|
|
10
|
+
'.github/workflows/audit.yml': 'audit.yml',
|
|
11
|
+
'.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
|
|
12
|
+
'.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
|
|
13
|
+
'.github/workflows/pull-request.yml': 'pull-request.yml',
|
|
14
|
+
'.github/workflows/release-please.yml': 'release-please.yml',
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// These are also applied to the root of the repo
|
|
19
|
+
// but can by controlled by the `rootModule` config
|
|
20
|
+
// XXX: im not sure the distinction between repo
|
|
21
|
+
// and module in the root. both are applied to the same
|
|
22
|
+
// dir. so we might want to combine these
|
|
23
|
+
const rootModule = {
|
|
24
|
+
add: {
|
|
25
|
+
'.eslintrc.js': 'eslintrc.js',
|
|
26
|
+
'.gitignore': 'gitignore',
|
|
27
|
+
'.npmrc': 'npmrc',
|
|
28
|
+
'SECURITY.md': 'SECURITY.md',
|
|
29
|
+
'package.json': 'package.json',
|
|
30
|
+
},
|
|
31
|
+
rm: [
|
|
32
|
+
'.eslintrc.!(js|local.*)',
|
|
33
|
+
],
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Changes for each workspace but applied to the root of the repo
|
|
37
|
+
const workspaceRepo = {
|
|
38
|
+
add: {
|
|
39
|
+
'.github/workflows/release-please-{{pkgNameFs}}.yml': 'release-please.yml',
|
|
40
|
+
'.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml'
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Changes for each workspace but applied to the relative workspace dir
|
|
45
|
+
const workspaceModule = {
|
|
46
|
+
add: {
|
|
47
|
+
'.eslintrc.js': 'eslintrc.js',
|
|
48
|
+
'.gitignore': 'gitignore',
|
|
49
|
+
'package.json': 'package.json',
|
|
50
|
+
},
|
|
51
|
+
rm: [
|
|
52
|
+
'.npmrc',
|
|
53
|
+
'.eslintrc.!(js|local.*)',
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
rootRepo,
|
|
59
|
+
rootModule,
|
|
60
|
+
workspaceRepo,
|
|
61
|
+
workspaceModule,
|
|
62
|
+
windowsCI: true,
|
|
63
|
+
branches: ['main', 'latest'],
|
|
64
|
+
distPaths: ['bin/', 'lib/'],
|
|
65
|
+
ciVersions: ['12.13.0', '12.x', '14.15.0', '14.x', '16.0.0', '16.x'],
|
|
66
|
+
unwantedPackages: [
|
|
67
|
+
'eslint',
|
|
68
|
+
'eslint-plugin-node',
|
|
69
|
+
'@npmcli/lint',
|
|
70
|
+
'eslint-plugin-promise',
|
|
71
|
+
'eslint-plugin-standard',
|
|
72
|
+
'eslint-plugin-import',
|
|
73
|
+
'standard',
|
|
74
|
+
],
|
|
75
|
+
requiredPackages: {
|
|
76
|
+
devDependencies: {
|
|
77
|
+
'@npmcli/template-oss': '*',
|
|
78
|
+
'@npmcli/eslint-config': '>=3.0.0',
|
|
79
|
+
tap: '>=15.0.0',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
allowedPackages: [],
|
|
83
|
+
changelogTypes: [
|
|
84
|
+
{ type: "feat", section: "Features", hidden: false },
|
|
85
|
+
{ type: "fix", section: "Bug Fixes", hidden: false },
|
|
86
|
+
{ type: "docs", section: "Documentation", hidden: false },
|
|
87
|
+
{ type: "deps", section: "Dependencies", hidden: false },
|
|
88
|
+
{ type: "chore", hidden: true },
|
|
89
|
+
],
|
|
90
|
+
}
|
package/lib/content/npmrc
CHANGED