@npmcli/template-oss 3.2.1 → 3.2.2

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
@@ -112,6 +112,7 @@ const getConfig = async ({
112
112
  pkgName: pkg.name,
113
113
  pkgNameFs: pkg.name.replace(/\//g, '-').replace(/@/g, ''),
114
114
  pkgRelPath: pkgRelPath,
115
+ pkgPrivate: !!pkg.private,
115
116
  // booleans to control application of updates
116
117
  isForce,
117
118
  isDogFood,
@@ -38,7 +38,10 @@ const rootModule = {
38
38
  // Changes for each workspace but applied to the root of the repo
39
39
  const workspaceRepo = {
40
40
  add: {
41
- '.github/workflows/release-please-{{pkgNameFs}}.yml': 'release-please.yml',
41
+ '.github/workflows/release-please-{{pkgNameFs}}.yml': {
42
+ file: 'release-please.yml',
43
+ filter: (o) => !o.pkg.private,
44
+ },
42
45
  '.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml',
43
46
  },
44
47
  }
@@ -7,8 +7,12 @@
7
7
  "template-oss-apply": "template-oss-apply --force",
8
8
  "lintfix": "npm run lint -- --fix",
9
9
  "preversion": "npm test",
10
+ {{#if pkgPrivate}}
11
+ "postversion": "git push origin --follow-tags",
12
+ {{else}}
10
13
  "postversion": "npm publish",
11
14
  "prepublishOnly": "git push origin --follow-tags",
15
+ {{/if}}
12
16
  "snap": "tap",
13
17
  "test": "tap",
14
18
  "posttest": "npm run lint",
@@ -31,3 +31,4 @@ jobs:
31
31
  git add .
32
32
  git commit -am "chore: postinstall for dependabot template-oss PR"
33
33
  git push
34
+ npm run lint
@@ -21,7 +21,7 @@ jobs:
21
21
  release-type: node
22
22
  {{#if pkgRelPath}}
23
23
  monorepo-tags: true
24
- paths: {{pkgRelPath}}
24
+ path: {{pkgRelPath}}
25
25
  {{/if}}
26
26
  changelog-types: >
27
27
  [
package/lib/util/files.js CHANGED
@@ -9,13 +9,24 @@ const fullTarget = (dir, file, options) => join(dir, template(file, options))
9
9
 
10
10
  // given an obj of files, return the full target/source paths and associated parser
11
11
  const getParsers = (dir, files, options) => Object.entries(files).map(([t, s]) => {
12
- let { file, parser: fileParser } = typeof s === 'string' ? { file: s } : s
13
- const target = fullTarget(dir, t, options)
12
+ let {
13
+ file,
14
+ parser: fileParser,
15
+ filter,
16
+ } = typeof s === 'string' ? { file: s } : s
17
+
14
18
  file = join(options.config.sourceDir, file)
19
+ const target = fullTarget(dir, t, options)
20
+
21
+ if (typeof filter === 'function' && !filter(options)) {
22
+ return null
23
+ }
24
+
15
25
  if (fileParser) {
16
26
  // allow files to extend base parsers or create new ones
17
27
  return new (fileParser(Parser.Parsers))(target, file, options)
18
28
  }
29
+
19
30
  return new (Parser(file))(target, file, options)
20
31
  })
21
32
 
@@ -32,7 +43,9 @@ const rmEach = async (dir, files, options, fn) => {
32
43
  const parseEach = async (dir, files, options, fn) => {
33
44
  const res = []
34
45
  for (const parser of getParsers(dir, files, options)) {
35
- res.push(await fn(parser))
46
+ if (parser) {
47
+ res.push(await fn(parser))
48
+ }
36
49
  }
37
50
  return res.filter(Boolean)
38
51
  }
@@ -249,7 +249,7 @@ class PackageJson extends JsonMerge {
249
249
  return unset(pkg.content, keys)
250
250
  }
251
251
  })
252
- pkg.save()
252
+ await pkg.save()
253
253
  }
254
254
  }
255
255
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "npm-package-arg": "^9.0.1",
45
45
  "proc-log": "^2.0.0",
46
46
  "semver": "^7.3.5",
47
- "yaml": "^2.0.0-10"
47
+ "yaml": "^2.0.0-11"
48
48
  },
49
49
  "files": [
50
50
  "bin/",