@npmcli/template-oss 4.1.2 → 4.3.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.
Files changed (44) hide show
  1. package/bin/release-please.js +42 -28
  2. package/lib/apply/apply-files.js +1 -1
  3. package/lib/apply/index.js +1 -1
  4. package/lib/check/check-apply.js +5 -4
  5. package/lib/check/index.js +1 -1
  6. package/lib/config.js +178 -121
  7. package/lib/content/_job-matrix.yml +29 -0
  8. package/lib/content/_job.yml +8 -0
  9. package/lib/content/_on-ci.yml +30 -0
  10. package/lib/content/_step-checks.yml +24 -0
  11. package/lib/content/_step-deps.yml +2 -0
  12. package/lib/content/_step-git.yml +12 -0
  13. package/lib/content/_step-lint.yml +4 -0
  14. package/lib/content/{setup-node.yml → _step-node.yml} +12 -9
  15. package/lib/content/_step-test.yml +4 -0
  16. package/lib/content/_steps-setup.yml +6 -0
  17. package/lib/content/audit.yml +3 -6
  18. package/lib/content/ci-release.yml +31 -0
  19. package/lib/content/ci.yml +6 -54
  20. package/lib/content/codeql-analysis.yml +10 -17
  21. package/lib/content/commitlintrc.js +1 -1
  22. package/lib/content/dependabot.yml +2 -2
  23. package/lib/content/eslintrc.js +7 -0
  24. package/lib/content/gitignore +1 -14
  25. package/lib/content/index.js +62 -27
  26. package/lib/content/npmrc +1 -1
  27. package/lib/content/pkg.json +34 -14
  28. package/lib/content/post-dependabot.yml +55 -16
  29. package/lib/content/pull-request.yml +11 -13
  30. package/lib/content/release-please-config.json +5 -5
  31. package/lib/content/release-please-manifest.json +1 -1
  32. package/lib/content/release.yml +125 -0
  33. package/lib/index.js +27 -30
  34. package/lib/release-please/index.js +26 -5
  35. package/lib/util/files.js +71 -27
  36. package/lib/util/gitignore.js +34 -0
  37. package/lib/util/merge.js +21 -0
  38. package/lib/util/parser.js +76 -18
  39. package/lib/util/template.js +30 -21
  40. package/package.json +7 -2
  41. package/lib/content/release-please.yml +0 -73
  42. package/lib/content/release-test.yml +0 -46
  43. package/lib/content/setup-deps.yml +0 -1
  44. package/lib/content/setup-git.yml +0 -11
@@ -1,11 +1,13 @@
1
- - uses: actions/setup-node@v3
1
+ - name: Setup Node
2
+ uses: actions/setup-node@v3
2
3
  with:
3
- node-version: {{#if useMatrix}}$\{{ matrix.node-version }}{{else}}{{#each ciVersions}}{{#if @last}}{{.}}{{/if}}{{/each}}{{/if}}
4
+ node-version: {{#if jobNodeMatrix}}$\{{ matrix.node-version }}{{else}}{{ last ciVersions }}{{/if}}
4
5
  {{#if lockfile}}
5
6
  cache: npm
6
7
  {{/if}}
7
- {{#if useMatrix}}
8
- - name: Update to workable npm (windows)
8
+ {{#if updateNpm}}
9
+ {{#if jobNodeMatrix}}
10
+ - name: Update Windows npm
9
11
  # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
10
12
  if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
11
13
  run: |
@@ -15,14 +17,15 @@
15
17
  node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
16
18
  cd ..
17
19
  rmdir /s /q package
18
- - name: Update npm to 7
19
- # If we do test on npm 10 it needs npm7
20
+ - name: Install npm@7
20
21
  if: startsWith(matrix.node-version, '10.')
21
22
  run: npm i --prefer-online --no-fund --no-audit -g npm@7
22
- - name: Update npm to latest
23
+ - name: Install npm@latest
23
24
  if: $\{{ !startsWith(matrix.node-version, '10.') }}
24
25
  {{else}}
25
- - name: Update npm to latest
26
+ - name: Install npm@latest
26
27
  {{/if}}
27
28
  run: npm i --prefer-online --no-fund --no-audit -g npm@latest
28
- - run: npm -v
29
+ - name: npm Version
30
+ run: npm -v
31
+ {{/if}}
@@ -0,0 +1,4 @@
1
+ - name: Add Problem Matcher
2
+ run: echo "::add-matcher::.github/matchers/tap.json"
3
+ - name: Test
4
+ run: {{ rootNpmPath }} test --ignore-scripts {{~#if jobRunFlags}} {{ jobRunFlags }}{{/if}}
@@ -0,0 +1,6 @@
1
+ {{~#if jobCheck}}{{> stepChecks }}{{/if}}
2
+ {{~#unless jobSkipSetup}}
3
+ {{> stepGit }}
4
+ {{> stepNode }}
5
+ {{> stepDeps }}
6
+ {{/unless}}
@@ -8,9 +8,6 @@ on:
8
8
 
9
9
  jobs:
10
10
  audit:
11
- runs-on: ubuntu-latest
12
- steps:
13
- {{> setupGit}}
14
- {{> setupNode}}
15
- {{> setupDeps flags="--package-lock"}}
16
- - run: npm audit
11
+ {{> job jobName="Audit Dependencies" jobDepFlags="--package-lock" }}
12
+ - name: Run Audit
13
+ run: {{ rootNpmPath }} audit
@@ -0,0 +1,31 @@
1
+
2
+ name: CI - Release
3
+
4
+ on:
5
+ workflow_call:
6
+ inputs:
7
+ ref:
8
+ required: true
9
+ type: string
10
+ check-sha:
11
+ required: true
12
+ type: string
13
+
14
+ jobs:
15
+ lint-all:
16
+ {{> job
17
+ jobName="Lint All"
18
+ jobCheck=(obj sha="${{ inputs.check-sha }}")
19
+ jobCheckout=(obj ref="${{ inputs.ref }}")
20
+ }}
21
+ {{> stepLint jobRunFlags=allFlags }}
22
+ {{> stepChecks jobCheck=true }}
23
+
24
+ test-all:
25
+ {{> jobMatrix
26
+ jobName="Test All - ${{ matrix.platform.name }} - Node ${{ matrix.node-version }}"
27
+ jobCheck=(obj sha="${{ inputs.check-sha }}")
28
+ jobCheckout=(obj ref="${{ inputs.ref }}")
29
+ }}
30
+ {{> stepTest jobRunFlags=allFlags }}
31
+ {{> stepChecks jobCheck=true }}
@@ -1,61 +1,13 @@
1
- name: CI {{~#if isWorkspace}} - {{pkgName}}{{/if}}
1
+ name: CI {{~#if isWorkspace}} - {{ pkgName }}{{/if}}
2
2
 
3
3
  on:
4
- workflow_dispatch:
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
+ {{> onCi }}
24
5
 
25
6
  jobs:
26
7
  lint:
27
- runs-on: ubuntu-latest
28
- steps:
29
- {{> setupGit}}
30
- {{> setupNode}}
31
- {{> setupDeps}}
32
- - run: npm run lint {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
8
+ {{> job jobName="Lint" }}
9
+ {{> stepLint jobRunFlags=pkgFlags }}
33
10
 
34
11
  test:
35
- strategy:
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}}
59
- - name: add tap problem matcher
60
- run: echo "::add-matcher::.github/matchers/tap.json"
61
- - run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
12
+ {{> jobMatrix jobName="Test All - ${{ matrix.platform.name }} - Node ${{ matrix.node-version }}" }}
13
+ {{> stepTest jobRunFlags=pkgFlags }}
@@ -1,16 +1,15 @@
1
- name: "CodeQL"
1
+ name: CodeQL
2
2
 
3
3
  on:
4
4
  push:
5
5
  branches:
6
6
  {{#each branches}}
7
- - {{.}}
7
+ - {{ . }}
8
8
  {{/each}}
9
9
  pull_request:
10
- # The branches below must be a subset of the branches above
11
10
  branches:
12
11
  {{#each branches}}
13
- - {{.}}
12
+ - {{ . }}
14
13
  {{/each}}
15
14
  schedule:
16
15
  # "At 10:00 UTC (03:00 PT) on Monday" https://crontab.guru/#0_10_*_*_1
@@ -24,17 +23,11 @@ jobs:
24
23
  actions: read
25
24
  contents: read
26
25
  security-events: write
27
-
28
- strategy:
29
- fail-fast: false
30
- matrix:
31
- language: [javascript]
32
-
33
26
  steps:
34
- {{> setupGit}}
35
- - name: Initialize CodeQL
36
- uses: github/codeql-action/init@v1
37
- with:
38
- languages: $\{{ matrix.language }}
39
- - name: Perform CodeQL Analysis
40
- uses: github/codeql-action/analyze@v1
27
+ {{> stepGit }}
28
+ - name: Initialize CodeQL
29
+ uses: github/codeql-action/init@v2
30
+ with:
31
+ languages: javascript
32
+ - name: Perform CodeQL Analysis
33
+ uses: github/codeql-action/analyze@v2
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  extends: ['@commitlint/config-conventional'],
3
3
  rules: {
4
- 'type-enum': [2, 'always', [{{#each changelogTypes}}'{{type}}'{{#unless @last}}, {{/unless}}{{/each}}]],
4
+ 'type-enum': [2, 'always', [{{{ join (quote (pluck changelogTypes "type")) }}}]],
5
5
  'header-max-length': [2, 'always', 80],
6
6
  'subject-case': [0, 'always', ['lower-case', 'sentence-case', 'start-case']],
7
7
  },
@@ -2,12 +2,12 @@ version: 2
2
2
 
3
3
  updates:
4
4
  - package-ecosystem: npm
5
- directory: "/"
5
+ directory: {{ pkgDir }}
6
6
  schedule:
7
7
  interval: daily
8
8
  allow:
9
9
  - dependency-type: direct
10
- versioning-strategy: increase-if-necessary
10
+ versioning-strategy: {{ dependabot }}
11
11
  commit-message:
12
12
  prefix: deps
13
13
  prefix-development: chore
@@ -8,6 +8,13 @@ const localConfigs = readdir(__dirname)
8
8
 
9
9
  module.exports = {
10
10
  root: true,
11
+ {{#if workspaceGlobs}}
12
+ ignorePatterns: [
13
+ {{#each workspaceGlobs}}
14
+ '{{ . }}',
15
+ {{/each}}
16
+ ],
17
+ {{/if}}
11
18
  extends: [
12
19
  '@npmcli',
13
20
  ...localConfigs,
@@ -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}}
@@ -1,46 +1,67 @@
1
1
  const { name: NAME, version: LATEST_VERSION } = require('../../package.json')
2
2
 
3
- const releasePlease = () => ({
4
- '.github/workflows/release-please.yml': {
5
- file: 'release-please.yml',
6
- filter: (o) => !o.pkg.private,
3
+ const isPublic = (p) => !p.pkg.private
4
+
5
+ const sharedRoot = (name) => ({
6
+ // release
7
+ '.github/workflows/release.yml': {
8
+ file: 'release.yml',
9
+ filter: isPublic,
7
10
  },
8
- '.github/workflows/release-test.yml': {
9
- file: 'release-test.yml',
10
- filter: (o) => !o.pkg.private && o.config.releaseTest === 'release-test.yml',
11
+ '.github/workflows/ci-release.yml': {
12
+ file: 'ci-release.yml',
13
+ filter: isPublic,
11
14
  },
12
15
  '.release-please-manifest.json': {
13
16
  file: 'release-please-manifest.json',
14
- filter: (o) => !o.pkg.private,
15
- parser: (p) => class NoCommentJson extends p.JsonMerge {
17
+ filter: isPublic,
18
+ parser: (p) => class extends p.JsonMerge {
16
19
  comment = null
17
20
  },
18
21
  },
19
22
  'release-please-config.json': {
20
23
  file: 'release-please-config.json',
21
- filter: (o) => !o.pkg.private,
22
- parser: (p) => class NoCommentJson extends p.JsonMerge {
24
+ filter: isPublic,
25
+ parser: (p) => class extends p.JsonMerge {
23
26
  comment = null
24
27
  },
25
28
  },
29
+ // ci
30
+ '.github/matchers/tap.json': 'tap.json',
31
+ [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci.yml',
32
+ // dependabot
33
+ '.github/dependabot.yml': {
34
+ file: 'dependabot.yml',
35
+ clean: (p) => p.config.isRoot,
36
+ // dependabot takes a single top level config file. this parser
37
+ // will run for all configured packages and each one will have
38
+ // its item replaced in the updates array based on the directory
39
+ parser: (p) => class extends p.YmlMerge {
40
+ key = 'updates'
41
+ id = 'directory'
42
+ },
43
+ },
44
+ '.github/workflows/post-dependabot.yml': {
45
+ file: 'post-dependabot.yml',
46
+ },
26
47
  })
27
48
 
28
49
  // Changes applied to the root of the repo
29
50
  const rootRepo = {
30
51
  add: {
31
52
  '.commitlintrc.js': 'commitlintrc.js',
32
- '.github/workflows/ci.yml': 'ci.yml',
33
53
  '.github/ISSUE_TEMPLATE/bug.yml': 'bug.yml',
34
54
  '.github/ISSUE_TEMPLATE/config.yml': 'config.yml',
35
55
  '.github/CODEOWNERS': 'CODEOWNERS',
36
- '.github/dependabot.yml': 'dependabot.yml',
37
- '.github/matchers/tap.json': 'tap.json',
38
56
  '.github/workflows/audit.yml': 'audit.yml',
39
57
  '.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml',
40
- '.github/workflows/post-dependabot.yml': 'post-dependabot.yml',
41
58
  '.github/workflows/pull-request.yml': 'pull-request.yml',
42
- ...releasePlease(),
59
+ ...sharedRoot(),
43
60
  },
61
+ rm: [
62
+ '.github/workflows/release-test.yml',
63
+ '.github/workflows/release-please.yml',
64
+ ],
44
65
  }
45
66
 
46
67
  // These are also applied to the root of the repo
@@ -65,13 +86,11 @@ const rootModule = {
65
86
  // Changes for each workspace but applied to the root of the repo
66
87
  const workspaceRepo = {
67
88
  add: {
68
- ...releasePlease(true),
69
- '.github/matchers/tap.json': 'tap.json',
70
- '.github/workflows/ci-{{pkgNameFs}}.yml': 'ci.yml',
89
+ ...sharedRoot('{{ pkgNameFs }}'),
71
90
  },
72
91
  rm: [
73
92
  // These are the old release please files that should be removed now
74
- '.github/workflows/release-please-{{pkgNameFs}}.yml',
93
+ '.github/workflows/release-please-{{ pkgNameFs }}.yml',
75
94
  ],
76
95
  }
77
96
 
@@ -95,17 +114,33 @@ module.exports = {
95
114
  workspaceRepo,
96
115
  workspaceModule,
97
116
  windowsCI: true,
117
+ macCI: true,
98
118
  branches: ['main', 'latest'],
99
119
  releaseBranches: [],
100
- defaultBranch: 'main',
101
- // Escape hatch since we write a release test file but the
102
- // CLI has a very custom one we dont want to overwrite. This
103
- // setting allows us to call a workflow by any name during release
104
- releaseTest: 'release-test.yml',
105
- distPaths: ['bin/', 'lib/'],
120
+ distPaths: [
121
+ 'bin/',
122
+ 'lib/',
123
+ ],
124
+ allowPaths: [
125
+ '/bin/',
126
+ '/lib/',
127
+ '/.eslintrc.local.*',
128
+ '**/.gitignore',
129
+ '/docs/',
130
+ '/tap-snapshots/',
131
+ '/test/',
132
+ '/map.js',
133
+ '/scripts/',
134
+ '/README*',
135
+ '/LICENSE*',
136
+ '/CHANGELOG*',
137
+ ],
138
+ ignorePaths: [],
106
139
  ciVersions: ['14.17.0', '14.x', '16.13.0', '16.x', '18.0.0', '18.x'],
107
140
  lockfile: false,
108
- npmBin: 'npm',
141
+ npm: 'npm',
142
+ npx: 'npx',
143
+ dependabot: 'increase-if-necessary',
109
144
  unwantedPackages: [
110
145
  'eslint',
111
146
  'eslint-plugin-node',
package/lib/content/npmrc CHANGED
@@ -1 +1 @@
1
- package-lock={{lockfile}}
1
+ package-lock={{ lockfile }}
@@ -1,27 +1,47 @@
1
1
  {
2
2
  "author": "GitHub Inc.",
3
- "files": {{{json distPaths}}},
3
+ "files": {{{ json distPaths }}},
4
4
  "scripts": {
5
5
  "lint": "eslint \"**/*.js\"",
6
6
  "postlint": "template-oss-check",
7
7
  "template-oss-apply": "template-oss-apply --force",
8
- "lintfix": "{{npmBin}} run lint -- --fix",
9
- "preversion": {{{del}}},
10
- "postversion": {{{del}}},
11
- "prepublishOnly": {{{del}}},
8
+ "lintfix": "{{ localNpmPath }} run lint -- --fix",
12
9
  "snap": "tap",
13
10
  "test": "tap",
14
- "posttest": "{{npmBin}} run lint",
15
- "template-copy": {{{del}}},
16
- "lint:fix": {{{del}}}
11
+ "posttest": "{{ localNpmPath }} run lint",
12
+ {{#if isRootMono}}
13
+ "test-all": "{{ localNpmPath }} run test {{ allFlags }}",
14
+ "lint-all": "{{ localNpmPath }} run lint {{ allFlags }}",
15
+ {{/if}}
16
+ "template-copy": {{{ del }}},
17
+ "lint:fix": {{{ del }}},
18
+ "preversion": {{{ del }}},
19
+ "postversion": {{{ del }}},
20
+ "prepublishOnly": {{{ del }}},
21
+ "postpublish": {{{ del }}}
17
22
  },
18
- "repository": {{#if repository}}{{{json repository}}}{{else}}{{{del}}}{{/if}},
23
+ "repository": {{#if repository}}{{{ json repository }}}{{else}}{{{ del }}}{{/if}},
19
24
  "engines": {
20
- "node": {{{json engines}}}
25
+ {{#if engines}}
26
+ "node": {{{ json engines }}}
27
+ {{/if}}
21
28
  },
22
- {{{json __CONFIG_KEY__}}}: {
23
- "version": {{#if isDogFood}}{{{del}}}{{else}}{{{json __VERSION__}}}{{/if}}
29
+ {{{ json __CONFIG_KEY__ }}}: {
30
+ "version": {{#if isDogFood}}{{{ del }}}{{else}}{{{ json __VERSION__ }}}{{/if}}
24
31
  },
25
- "templateVersion": {{{del}}},
26
- "standard": {{{del}}}
32
+ "templateVersion": {{{ del }}},
33
+ "standard": {{{ del }}},
34
+ "tap": {
35
+ {{#if workspacePaths}}
36
+ "test-ignore": "^({{ join workspacePaths "|" }})/**",
37
+ {{/if}}
38
+ "nyc-arg": [
39
+ {{#each workspaceGlobs}}
40
+ "--exclude",
41
+ "{{ . }}",
42
+ {{/each}}
43
+ "--exclude",
44
+ "tap-snapshots/**"
45
+ ]
46
+ }
27
47
  }
@@ -1,31 +1,70 @@
1
- name: Post Dependabot Actions
1
+ name: Post Dependabot
2
2
 
3
3
  on:
4
4
  pull_request
5
5
 
6
- # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
7
6
  permissions:
8
7
  contents: write
9
8
 
10
9
  jobs:
11
- template-oss-apply:
12
- runs-on: ubuntu-latest
13
- if: github.actor == 'dependabot[bot]'
14
- steps:
15
- {{> setupGit with=(obj ref="${{ github.event.pull_request.head_ref }}")}}
16
- {{> setupNode}}
17
- {{> setupDeps}}
18
- - name: Dependabot metadata
10
+ template-oss:
11
+ {{> job
12
+ jobName="template-oss"
13
+ jobIf="github.actor == 'dependabot[bot]'"
14
+ jobCheckout=(obj ref="${{ github.event.pull_request.head_ref }}")
15
+ }}
16
+ - name: Fetch Dependabot Metadata
19
17
  id: metadata
20
- uses: dependabot/fetch-metadata@v1.1.1
18
+ uses: dependabot/fetch-metadata@v1
21
19
  with:
22
- github-token: "$\{{ secrets.GITHUB_TOKEN }}"
23
- - name: Apply {{__NAME__}} changes and lint
24
- if: contains(steps.metadata.outputs.dependency-names, '{{__NAME__}}')
20
+ github-token: $\{{ secrets.GITHUB_TOKEN }}
21
+
22
+ # Dependabot can update multiple directories so we output which directory
23
+ # it is acting on so we can run the command for the correct root or workspace
24
+ - name: Get Dependabot Directory
25
+ if: contains(steps.metadata.outputs.dependency-names, '{{ __NAME__ }}')
26
+ id: flags
27
+ run: |
28
+ if [[ "$\{{ steps.metadata.outputs.directory }}" == "/" ]]; then
29
+ echo "::set-output name=workspace::-iwr"
30
+ else
31
+ echo "::set-output name=workspace::-w $\{{ steps.metadata.outputs.directory }}"
32
+ fi
33
+
34
+ - name: Apply Changes
35
+ if: steps.flags.outputs.workspace
36
+ id: apply
37
+ run: |
38
+ {{ rootNpmPath }} run template-oss-apply $\{{ steps.flags.outputs.workspace }}
39
+ if [[ `git status --porcelain` ]]; then
40
+ echo "::set-output name=changes::true"
41
+ fi
42
+
43
+ # This step will fail if template-oss has made any workflow updates. It is impossible
44
+ # for a workflow to update other workflows. In the case it does fail, we continue
45
+ # and then try to apply only a portion of the changes in the next step
46
+ - name: Push All Changes
47
+ if: steps.apply.outputs.changes
48
+ id: push
49
+ continue-on-error: true
25
50
  env:
26
51
  GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
27
52
  run: |
28
- npm run template-oss-apply
29
53
  git commit -am "chore: postinstall for dependabot template-oss PR"
30
54
  git push
31
- npm run lint
55
+
56
+ - name: Push All Changes Except Workflows
57
+ if: steps.push.outcome == 'failure'
58
+ env:
59
+ GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
60
+ run: |
61
+ git reset HEAD~
62
+ git checkout HEAD -- .github/workflows/
63
+ git clean -fd .github/workflows/
64
+ git commit -am "chore: postinstall for dependabot template-oss PR"
65
+ git push
66
+
67
+ - name: Check Changes
68
+ if: steps.apply.outputs.changes
69
+ run: |
70
+ {{ rootNpmPath }} exec --offline $\{{ steps.flags.outputs.workspace }} -- template-oss-check
@@ -1,4 +1,4 @@
1
- name: Pull Request Linting
1
+ name: Pull Request
2
2
 
3
3
  on:
4
4
  pull_request:
@@ -9,16 +9,14 @@ on:
9
9
  - synchronize
10
10
 
11
11
  jobs:
12
- check:
13
- name: Check PR Title or Commits
14
- runs-on: ubuntu-latest
15
- steps:
16
- {{> setupGit with=(obj fetch-depth=0)}}
17
- {{> setupNode}}
18
- {{> setupDeps}}
19
- - name: Check commits or PR title
20
- env:
21
- PR_TITLE: $\{{ github.event.pull_request.title }}
12
+ commitlint:
13
+ {{> job jobName="Lint Commits" jobCheckout=(obj fetch-depth=0) }}
14
+ - name: Run Commitlint on Commits
15
+ id: commit
16
+ continue-on-error: true
22
17
  run: |
23
- npx --offline commitlint -V --from origin/{{defaultBranch}} --to $\{{ github.event.pull_request.head.sha }} \
24
- || echo $PR_TITLE | npx --offline commitlint -V
18
+ {{ rootNpxPath }} --offline commitlint -V --from origin/$\{{ github.base_ref }} --to $\{{ github.event.pull_request.head.sha }}
19
+ - name: Run Commitlint on PR Title
20
+ if: steps.commit.outcome == 'failure'
21
+ run: |
22
+ echo $\{{ github.event.pull_request.title }} | {{ rootNpxPath }} --offline commitlint -V
@@ -1,13 +1,13 @@
1
1
  {
2
- "separate-pull-requests": {{{del}}},
3
- "plugins": {{#if isMono}}["node-workspace"]{{else}}{{{del}}}{{/if}},
2
+ "separate-pull-requests": {{{ del }}},
3
+ "plugins": {{#if isMono }}["node-workspace"]{{ else }}{{{ del }}}{{/if}},
4
4
  "exclude-packages-from-root": true,
5
5
  "group-pull-request-title-pattern": "chore: release ${version}",
6
6
  "pull-request-title-pattern": "chore: release${component} ${version}",
7
- "changelog-sections": {{{json changelogTypes}}},
7
+ "changelog-sections": {{{ json changelogTypes }}},
8
8
  "packages": {
9
- "{{#unless pkgRelPath}}.{{/unless}}{{pkgRelPath}}": {
10
- {{#unless pkgRelPath}}"package-name": ""{{/unless}}
9
+ "{{ pkgPath }}": {
10
+ {{#if isRoot}}"package-name": ""{{/if}}
11
11
  }
12
12
  }
13
13
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "{{#unless pkgRelPath}}.{{/unless}}{{pkgRelPath}}": "{{pkg.version}}"
2
+ "{{ pkgPath }}": "{{ pkg.version }}"
3
3
  }