@npmcli/template-oss 4.4.0 → 4.4.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.
@@ -25,10 +25,13 @@ jobs:
25
25
  if: contains(steps.metadata.outputs.dependency-names, '{{ __NAME__ }}')
26
26
  id: flags
27
27
  run: |
28
- if [[ "$\{{ steps.metadata.outputs.directory }}" == "/" ]]; then
28
+ dependabot_dir="$\{{ steps.metadata.outputs.directory }}"
29
+ if [[ "$dependabot_dir" == "/" ]]; then
29
30
  echo "::set-output name=workspace::-iwr"
30
31
  else
31
- echo "::set-output name=workspace::-w $\{{ steps.metadata.outputs.directory }}"
32
+ # strip leading slash from directory so it works as a
33
+ # a path to the workspace flag
34
+ echo "::set-output name=workspace::-w ${dependabot_dir#/}"
32
35
  fi
33
36
 
34
37
  - name: Apply Changes
@@ -65,7 +68,7 @@ jobs:
65
68
  # If the previous step failed, then reset the commit and remove any workflow changes
66
69
  # and attempt to commit and push again. This is helpful because we will have a commit
67
70
  # with the correct prefix that we can then --amend with @npmcli/stafftools later.
68
- - name: Commit and push all changes except workflows
71
+ - name: Push All Changes Except Workflows
69
72
  if: steps.apply.outputs.changes && steps.push-all.outcome == 'failure'
70
73
  env:
71
74
  GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
@@ -20,9 +20,21 @@ const main = async ({ repo: fullRepo, token, dryRun, branch }) => {
20
20
 
21
21
  const [owner, repo] = fullRepo.split('/')
22
22
  const github = await RP.GitHub.create({ owner, repo, token })
23
+
24
+ // This is mostly for testing and debugging. Use environs with the
25
+ // format `RELEASE_PLEASE_<manfiestOverrideConfigName>` (eg
26
+ // `RELEASE_PLEASE_lastReleaseSha=<SHA>`) to set one-off config items
27
+ // for the release please run without needing to commit and push the config.
28
+ const manifestOverrides = Object.entries(process.env)
29
+ .filter(([k, v]) => k.startsWith('RELEASE_PLEASE_') && v != null)
30
+ .map(([k, v]) => [k.replace('RELEASE_PLEASE_', ''), v])
31
+
23
32
  const manifest = await RP.Manifest.fromManifest(
24
33
  github,
25
- branch ?? github.repository.defaultBranch
34
+ branch ?? github.repository.defaultBranch,
35
+ undefined,
36
+ undefined,
37
+ Object.fromEntries(manifestOverrides)
26
38
  )
27
39
 
28
40
  const pullRequests = await (dryRun ? manifest.buildPullRequests() : manifest.createPullRequests())
@@ -10,14 +10,21 @@ const partialName = (s) => basename(s, extname(s)) // remove extension
10
10
  .replace(/^_/, '') // remove leading underscore
11
11
  .replace(/-([a-z])/g, (_, g) => g.toUpperCase()) // camelcase
12
12
 
13
- const makePartials = (dir, setDefault) => {
13
+ const makePartials = (dir, isBase) => {
14
14
  const partials = fs.readdirSync(dir).reduce((acc, f) => {
15
15
  const partial = fs.readFileSync(join(dir, f)).toString()
16
16
  const name = partialName(f)
17
- acc[name] = partial
18
- if (setDefault && f.startsWith('_')) {
17
+
18
+ if (isBase) {
19
+ // in the default dir, everything is a partial
20
+ // and also gets set with a default prefix for extending
21
+ acc[name] = partial
19
22
  acc[partialName(`default-${name}`)] = partial
23
+ } else if (f.startsWith('_')) {
24
+ // otherwise only _ files get set as partials
25
+ acc[name] = partial
20
26
  }
27
+
21
28
  return acc
22
29
  }, {})
23
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npmcli/template-oss",
3
- "version": "4.4.0",
3
+ "version": "4.4.2",
4
4
  "description": "templated files used in npm CLI team oss projects",
5
5
  "main": "lib/content/index.js",
6
6
  "bin": {
@@ -47,7 +47,7 @@
47
47
  "lodash": "^4.17.21",
48
48
  "npm-package-arg": "^9.0.1",
49
49
  "proc-log": "^2.0.0",
50
- "release-please": "npm:@npmcli/release-please@^14.2.4",
50
+ "release-please": "npm:@npmcli/release-please@^14.2.5",
51
51
  "semver": "^7.3.5",
52
52
  "yaml": "^2.1.1"
53
53
  },