@npmcli/template-oss 4.15.0 → 4.16.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 CHANGED
@@ -195,7 +195,7 @@ const getFullConfig = async ({
195
195
  isLatest,
196
196
  // whether to install and update npm in ci
197
197
  // only do this if we aren't using a custom path to bin
198
- updateNpm: !npmPath.isLocal,
198
+ updateNpm: !npmPath.isLocal && pkgConfig.updateNpm,
199
199
  rootNpmPath: npmPath.root,
200
200
  localNpmPath: npmPath.local,
201
201
  rootNpxPath: npxPath.root,
@@ -228,9 +228,11 @@ const getFullConfig = async ({
228
228
 
229
229
  if (pkgConfig.ciVersions) {
230
230
  let versions = pkgConfig.ciVersions
231
- if (versions === 'latest') {
232
- const defaultVersions = [rootPkgConfig, defaultConfig].find(c => Array.isArray(c.ciVersions))
233
- versions = defaultVersions.ciVersions.slice(-1)
231
+ if (versions === 'latest' || (Array.isArray(versions) && versions.includes('latest'))) {
232
+ const { ciVersions } = [isWorkspace ? rootPkgConfig : {}, defaultConfig]
233
+ .find(c => Array.isArray(c.ciVersions))
234
+ const defaultLatest = ciVersions[ciVersions.length - 1]
235
+ versions = [].concat(versions).map(v => v === 'latest' ? defaultLatest : v)
234
236
  }
235
237
 
236
238
  const { targets, engines } = parseCIVersions(versions)
@@ -251,6 +253,14 @@ const getFullConfig = async ({
251
253
  derived.engines = pkgConfig.engines || engines
252
254
  }
253
255
 
256
+ if (!pkgConfig.eslint) {
257
+ derived.ignorePaths = derived.ignorePaths.filter(p => !p.includes('eslint'))
258
+ if (Array.isArray(pkgConfig.requiredPackages?.devDependencies)) {
259
+ pkgConfig.requiredPackages.devDependencies =
260
+ pkgConfig.requiredPackages.devDependencies.filter(p => !p.includes('eslint'))
261
+ }
262
+ }
263
+
254
264
  const gitUrl = await getGitUrl(rootPkg.path)
255
265
  if (gitUrl) {
256
266
  derived.repository = {
@@ -85,7 +85,10 @@ const rootRepo = {
85
85
  // dir. so we might want to combine these
86
86
  const rootModule = {
87
87
  add: {
88
- '.eslintrc.js': 'eslintrc.js',
88
+ '.eslintrc.js': {
89
+ file: 'eslintrc.js',
90
+ filter: (p) => p.config.eslint,
91
+ },
89
92
  '.gitignore': 'gitignore',
90
93
  '.npmrc': 'npmrc',
91
94
  'SECURITY.md': 'SECURITY.md',
@@ -113,7 +116,10 @@ const workspaceRepo = {
113
116
  // Changes for each workspace but applied to the relative workspace dir
114
117
  const workspaceModule = {
115
118
  add: {
116
- '.eslintrc.js': 'eslintrc.js',
119
+ '.eslintrc.js': {
120
+ file: 'eslintrc.js',
121
+ filter: (p) => p.config.eslint,
122
+ },
117
123
  '.gitignore': 'gitignore',
118
124
  'package.json': 'pkg.json',
119
125
  },
@@ -131,7 +137,7 @@ module.exports = {
131
137
  workspaceModule,
132
138
  windowsCI: true,
133
139
  macCI: true,
134
- branches: ['main', 'latest'],
140
+ branches: ['main', 'latest', 'release/v*'],
135
141
  defaultBranch: 'main',
136
142
  distPaths: [
137
143
  'bin/',
@@ -155,10 +161,12 @@ module.exports = {
155
161
  ciVersions: ['14.17.0', '14.x', '16.13.0', '16.x', '18.0.0', '18.x'],
156
162
  lockfile: false,
157
163
  codeowner: '@npm/cli-team',
164
+ eslint: true,
158
165
  publish: false,
159
166
  npm: 'npm',
160
167
  npx: 'npx',
161
168
  npmSpec: 'latest',
169
+ updateNpm: true,
162
170
  dependabot: 'increase-if-necessary',
163
171
  unwantedPackages: [
164
172
  'eslint',
@@ -2,7 +2,7 @@
2
2
  "author": "GitHub Inc.",
3
3
  "files": {{{ json distPaths }}},
4
4
  "scripts": {
5
- "lint": "eslint \"**/*.js\"",
5
+ "lint": "{{#if eslint}}eslint \"**/*.js\"{{else}}echo linting disabled{{/if}}",
6
6
  "postlint": "template-oss-check",
7
7
  "template-oss-apply": "template-oss-apply --force",
8
8
  "lintfix": "{{ localNpmPath }} run lint -- --fix",
@@ -11,7 +11,6 @@ on:
11
11
  {{#each branches}}
12
12
  - {{ . }}
13
13
  {{/each}}
14
- - release/v*
15
14
 
16
15
  permissions:
17
16
  contents: write
@@ -9,16 +9,16 @@ repository:
9
9
  enable_vulnerability_alerts: true
10
10
 
11
11
  branches:
12
- {{#each branches}}
13
- - name: {{ . }}
12
+ - name: {{ defaultBranch }}
14
13
  protection:
14
+ required_status_checks: null
15
+ enforce_admins: true
15
16
  required_pull_request_reviews:
16
- required_pull_request_review_count: 1
17
- dismiss_stale_reviews: true
17
+ required_approving_review_count: 1
18
18
  require_code_owner_reviews: true
19
+ require_last_push_approval: true
20
+ dismiss_stale_reviews: true
19
21
  restrictions:
20
- teams:
21
- - "npm/cli-team"
22
- enforce_admins: true
23
- required_status_checks: null
24
- {{/each}}
22
+ apps: []
23
+ users: []
24
+ teams: ["cli-team"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.15.0",
3
+ "version": "4.16.0",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {