From 3e1792c441752d52bb3b446698dc6a0850b3b4de Mon Sep 17 00:00:00 2001 From: Dan Rose Date: Mon, 6 Nov 2023 01:11:09 -0600 Subject: [PATCH] fix: add suffix to template files (#362) Add `.hbs` as a suffix to all Handlebars template files. --- .eslintrc.local.json | 6 --- README.md | 22 ++++---- lib/content/{CODEOWNERS => CODEOWNERS.hbs} | 0 ...E_OF_CONDUCT.md => CODE_OF_CONDUCT-md.hbs} | 0 .../{CONTRIBUTING.md => CONTRIBUTING-md.hbs} | 0 lib/content/{LICENSE.md => LICENSE-md.hbs} | 0 lib/content/{SECURITY.md => SECURITY-md.hbs} | 0 .../{_job-matrix.yml => _job-matrix-yml.hbs} | 2 +- ...n.yml => _job-release-integration-yml.hbs} | 2 +- lib/content/{_job.yml => _job-yml.hbs} | 2 +- lib/content/{_on-ci.yml => _on-ci-yml.hbs} | 0 .../{_step-audit.yml => _step-audit-yml.hbs} | 0 ...{_step-checks.yml => _step-checks-yml.hbs} | 0 .../{_step-deps.yml => _step-deps-yml.hbs} | 0 .../{_step-git.yml => _step-git-yml.hbs} | 0 .../{_step-lint.yml => _step-lint-yml.hbs} | 0 .../{_step-node.yml => _step-node-yml.hbs} | 0 .../{_step-test.yml => _step-test-yml.hbs} | 0 lib/content/_steps-setup-yml.hbs | 6 +++ lib/content/_steps-setup.yml | 6 --- lib/content/{audit.yml => audit-yml.hbs} | 4 +- lib/content/{bug.yml => bug-yml.hbs} | 0 .../{ci-release.yml => ci-release-yml.hbs} | 12 ++--- lib/content/ci-yml.hbs | 13 +++++ lib/content/ci.yml | 13 ----- ...l-analysis.yml => codeql-analysis-yml.hbs} | 2 +- .../{commitlintrc.js => commitlintrc-js.hbs} | 0 lib/content/{config.yml => config-yml.hbs} | 0 .../{dependabot.yml => dependabot-yml.hbs} | 0 lib/content/{eslintrc.js => eslintrc-js.hbs} | 0 lib/content/{gitignore => gitignore.hbs} | 0 lib/content/index.js | 52 +++++++++---------- lib/content/{npmrc => npmrc.hbs} | 0 lib/content/{pkg.json => package-json.hbs} | 0 ...dependabot.yml => post-dependabot-yml.hbs} | 2 +- ...{pull-request.yml => pull-request-yml.hbs} | 2 +- ...ig.json => release-please-config-json.hbs} | 0 ....json => release-please-manifest-json.hbs} | 0 lib/content/{release.yml => release-yml.hbs} | 20 +++---- .../{settings.yml => settings-yml.hbs} | 0 lib/content/{tap.json => tap-json.hbs} | 0 test/apply/allow-paths.js | 4 +- test/apply/index.js | 18 +++---- test/setup.js | 2 +- 44 files changed, 92 insertions(+), 98 deletions(-) delete mode 100644 .eslintrc.local.json rename lib/content/{CODEOWNERS => CODEOWNERS.hbs} (100%) rename lib/content/{CODE_OF_CONDUCT.md => CODE_OF_CONDUCT-md.hbs} (100%) rename lib/content/{CONTRIBUTING.md => CONTRIBUTING-md.hbs} (100%) rename lib/content/{LICENSE.md => LICENSE-md.hbs} (100%) rename lib/content/{SECURITY.md => SECURITY-md.hbs} (100%) rename lib/content/{_job-matrix.yml => _job-matrix-yml.hbs} (93%) rename lib/content/{_job-release-integration.yml => _job-release-integration-yml.hbs} (97%) rename lib/content/{_job.yml => _job-yml.hbs} (87%) rename lib/content/{_on-ci.yml => _on-ci-yml.hbs} (100%) rename lib/content/{_step-audit.yml => _step-audit-yml.hbs} (100%) rename lib/content/{_step-checks.yml => _step-checks-yml.hbs} (100%) rename lib/content/{_step-deps.yml => _step-deps-yml.hbs} (100%) rename lib/content/{_step-git.yml => _step-git-yml.hbs} (100%) rename lib/content/{_step-lint.yml => _step-lint-yml.hbs} (100%) rename lib/content/{_step-node.yml => _step-node-yml.hbs} (100%) rename lib/content/{_step-test.yml => _step-test-yml.hbs} (100%) create mode 100644 lib/content/_steps-setup-yml.hbs delete mode 100644 lib/content/_steps-setup.yml rename lib/content/{audit.yml => audit-yml.hbs} (61%) rename lib/content/{bug.yml => bug-yml.hbs} (100%) rename lib/content/{ci-release.yml => ci-release-yml.hbs} (73%) create mode 100644 lib/content/ci-yml.hbs delete mode 100644 lib/content/ci.yml rename lib/content/{codeql-analysis.yml => codeql-analysis-yml.hbs} (96%) rename lib/content/{commitlintrc.js => commitlintrc-js.hbs} (100%) rename lib/content/{config.yml => config-yml.hbs} (100%) rename lib/content/{dependabot.yml => dependabot-yml.hbs} (100%) rename lib/content/{eslintrc.js => eslintrc-js.hbs} (100%) rename lib/content/{gitignore => gitignore.hbs} (100%) rename lib/content/{npmrc => npmrc.hbs} (100%) rename lib/content/{pkg.json => package-json.hbs} (100%) rename lib/content/{post-dependabot.yml => post-dependabot-yml.hbs} (99%) rename lib/content/{pull-request.yml => pull-request-yml.hbs} (89%) rename lib/content/{release-please-config.json => release-please-config-json.hbs} (100%) rename lib/content/{release-please-manifest.json => release-please-manifest-json.hbs} (100%) rename lib/content/{release.yml => release-yml.hbs} (90%) rename lib/content/{settings.yml => settings-yml.hbs} (100%) rename lib/content/{tap.json => tap-json.hbs} (100%) diff --git a/.eslintrc.local.json b/.eslintrc.local.json deleted file mode 100644 index a3e78e7e..00000000 --- a/.eslintrc.local.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "ignorePatterns": [ - "lib/content/*", - "!lib/content/index.js" - ] -} diff --git a/README.md b/README.md index 1a423510..18bf24af 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This module bundles the npm CLI team's basics for package development into a single devDependency. -**CAUTION: THESE CHANGES WILL OVERWRITE ANY LOCAL FILES AND SETTINGS** +**CAUTION: THESE CHANGES WILL OVERWRITE LOCAL FILES AND SETTINGS** ### Configuration @@ -60,21 +60,21 @@ any of the same settings in the root. ### Content All the templated content for this repo lives in -[`lib/content/`](./lib/content/). The `index.js`[./lib/content/index.js] file +[`lib/content/`](./lib/content/). The [`index.js`](./lib/content/index.js) file controls how and where this content is written. Content files can be overwritten or merged with the existing target file. -Currently mergining is only supported for `package.json` files. +Merging is only supported for some types of files (ini, yaml, json, package.json) Each content file goes through the following pipeline: 1. It is read from its source location -1. It is are templated using Handlebars with the variables from each packages's - config (with some derived values generated in [`config.js`](./lib/config.js) -1. It is parsed based on its file extension in +2. It is compiled using [Handlebars](https://handlebarsjs.com/) with the variables from each packages's + config (with some derived values generated in [`config.js`](./lib/config.js)) +3. It is parsed based on its file extension in [`parser.js`](./lib/util/parser.js) -1. Additional logic is applied by the parser -1. It is written to its target location +4. Additional logic is applied by the parser +5. It is written to its target location ### Usage @@ -82,7 +82,7 @@ This package provides two bin scripts: #### `template-oss-check` -This will check if any of the applied files different from the target content, +This will check if any of the applied files differ from the target content, or if any of the other associated checks fail. The diffs of each file or check will be reported with instructions on how to fix it. @@ -92,7 +92,7 @@ This will write all source files to their target locations in the cwd. It will do nothing if `package.json#templateOSS.version` is the same as the version being run. This can be overridden by `--force`. -This is the script that is run on `postinsall`. +This is the script that is run on `postinstall`. ### Extending @@ -100,7 +100,7 @@ This is the script that is run on `postinsall`. This directory is where all the logic for applying files lives. It should be possible to add new files without modifying anything in this directory. To add a -file, add the templated file to `lib/content/$FILENAME` and add entry for it in +file, add the templated file to `lib/content/$FILENAME` and an entry for it in `lib/content/index.js` depending on where and when it should be written (root vs workspace, repo vs module, add vs remove, etc). diff --git a/lib/content/CODEOWNERS b/lib/content/CODEOWNERS.hbs similarity index 100% rename from lib/content/CODEOWNERS rename to lib/content/CODEOWNERS.hbs diff --git a/lib/content/CODE_OF_CONDUCT.md b/lib/content/CODE_OF_CONDUCT-md.hbs similarity index 100% rename from lib/content/CODE_OF_CONDUCT.md rename to lib/content/CODE_OF_CONDUCT-md.hbs diff --git a/lib/content/CONTRIBUTING.md b/lib/content/CONTRIBUTING-md.hbs similarity index 100% rename from lib/content/CONTRIBUTING.md rename to lib/content/CONTRIBUTING-md.hbs diff --git a/lib/content/LICENSE.md b/lib/content/LICENSE-md.hbs similarity index 100% rename from lib/content/LICENSE.md rename to lib/content/LICENSE-md.hbs diff --git a/lib/content/SECURITY.md b/lib/content/SECURITY-md.hbs similarity index 100% rename from lib/content/SECURITY.md rename to lib/content/SECURITY-md.hbs diff --git a/lib/content/_job-matrix.yml b/lib/content/_job-matrix-yml.hbs similarity index 93% rename from lib/content/_job-matrix.yml rename to lib/content/_job-matrix-yml.hbs index 8d77a5c2..5ad768b0 100644 --- a/lib/content/_job-matrix.yml +++ b/lib/content/_job-matrix-yml.hbs @@ -26,4 +26,4 @@ defaults: run: shell: $\{{ matrix.platform.shell }} steps: - {{> stepsSetup jobIsMatrix=true }} + {{> stepsSetupYml jobIsMatrix=true }} diff --git a/lib/content/_job-release-integration.yml b/lib/content/_job-release-integration-yml.hbs similarity index 97% rename from lib/content/_job-release-integration.yml rename to lib/content/_job-release-integration-yml.hbs index 136ca0a1..2cd8787f 100644 --- a/lib/content/_job-release-integration.yml +++ b/lib/content/_job-release-integration-yml.hbs @@ -29,7 +29,7 @@ defaults: run: shell: bash steps: - {{> stepNode lockfile=false }} + {{> stepNodeYml lockfile=false }} - name: View in Registry run: | EXIT_CODE=0 diff --git a/lib/content/_job.yml b/lib/content/_job-yml.hbs similarity index 87% rename from lib/content/_job.yml rename to lib/content/_job-yml.hbs index 48c6100a..4dab1885 100644 --- a/lib/content/_job.yml +++ b/lib/content/_job-yml.hbs @@ -5,4 +5,4 @@ defaults: run: shell: bash steps: - {{> stepsSetup }} + {{> stepsSetupYml }} diff --git a/lib/content/_on-ci.yml b/lib/content/_on-ci-yml.hbs similarity index 100% rename from lib/content/_on-ci.yml rename to lib/content/_on-ci-yml.hbs diff --git a/lib/content/_step-audit.yml b/lib/content/_step-audit-yml.hbs similarity index 100% rename from lib/content/_step-audit.yml rename to lib/content/_step-audit-yml.hbs diff --git a/lib/content/_step-checks.yml b/lib/content/_step-checks-yml.hbs similarity index 100% rename from lib/content/_step-checks.yml rename to lib/content/_step-checks-yml.hbs diff --git a/lib/content/_step-deps.yml b/lib/content/_step-deps-yml.hbs similarity index 100% rename from lib/content/_step-deps.yml rename to lib/content/_step-deps-yml.hbs diff --git a/lib/content/_step-git.yml b/lib/content/_step-git-yml.hbs similarity index 100% rename from lib/content/_step-git.yml rename to lib/content/_step-git-yml.hbs diff --git a/lib/content/_step-lint.yml b/lib/content/_step-lint-yml.hbs similarity index 100% rename from lib/content/_step-lint.yml rename to lib/content/_step-lint-yml.hbs diff --git a/lib/content/_step-node.yml b/lib/content/_step-node-yml.hbs similarity index 100% rename from lib/content/_step-node.yml rename to lib/content/_step-node-yml.hbs diff --git a/lib/content/_step-test.yml b/lib/content/_step-test-yml.hbs similarity index 100% rename from lib/content/_step-test.yml rename to lib/content/_step-test-yml.hbs diff --git a/lib/content/_steps-setup-yml.hbs b/lib/content/_steps-setup-yml.hbs new file mode 100644 index 00000000..962f2885 --- /dev/null +++ b/lib/content/_steps-setup-yml.hbs @@ -0,0 +1,6 @@ +{{~#if jobCheck}}{{> stepChecksYml }}{{/if}} +{{~#unless jobSkipSetup}} +{{> stepGitYml }} +{{> stepNodeYml }} +{{> stepDepsYml }} +{{/unless}} diff --git a/lib/content/_steps-setup.yml b/lib/content/_steps-setup.yml deleted file mode 100644 index e17d5f3d..00000000 --- a/lib/content/_steps-setup.yml +++ /dev/null @@ -1,6 +0,0 @@ -{{~#if jobCheck}}{{> stepChecks }}{{/if}} -{{~#unless jobSkipSetup}} -{{> stepGit }} -{{> stepNode }} -{{> stepDeps }} -{{/unless}} diff --git a/lib/content/audit.yml b/lib/content/audit-yml.hbs similarity index 61% rename from lib/content/audit.yml rename to lib/content/audit-yml.hbs index 77ef4b89..07794faa 100644 --- a/lib/content/audit.yml +++ b/lib/content/audit-yml.hbs @@ -8,5 +8,5 @@ on: jobs: audit: - {{> job jobName="Audit Dependencies" jobDepFlags="--package-lock" }} - {{> stepAudit }} + {{> jobYml jobName="Audit Dependencies" jobDepFlags="--package-lock" }} + {{> stepAuditYml }} diff --git a/lib/content/bug.yml b/lib/content/bug-yml.hbs similarity index 100% rename from lib/content/bug.yml rename to lib/content/bug-yml.hbs diff --git a/lib/content/ci-release.yml b/lib/content/ci-release-yml.hbs similarity index 73% rename from lib/content/ci-release.yml rename to lib/content/ci-release-yml.hbs index 73bb97b8..6253ffe9 100644 --- a/lib/content/ci-release.yml +++ b/lib/content/ci-release-yml.hbs @@ -19,19 +19,19 @@ on: jobs: lint-all: - {{> job + {{> jobYml jobName="Lint All" jobCheck=(obj sha="inputs.check-sha") jobCheckout=(obj ref="${{ inputs.ref }}") }} - {{> stepLint jobRunFlags=allFlags }} - {{> stepChecks jobCheck=true }} + {{> stepLintYml jobRunFlags=allFlags }} + {{> stepChecksYml jobCheck=true }} test-all: - {{> jobMatrix + {{> jobMatrixYml jobName="Test All" jobCheck=(obj sha="inputs.check-sha") jobCheckout=(obj ref="${{ inputs.ref }}") }} - {{> stepTest jobRunFlags=allFlags }} - {{> stepChecks jobCheck=true }} + {{> stepTestYml jobRunFlags=allFlags }} + {{> stepChecksYml jobCheck=true }} diff --git a/lib/content/ci-yml.hbs b/lib/content/ci-yml.hbs new file mode 100644 index 00000000..ebb6d917 --- /dev/null +++ b/lib/content/ci-yml.hbs @@ -0,0 +1,13 @@ +name: CI {{~#if isWorkspace}} - {{ pkgName }}{{/if}} + +on: + {{> onCiYml }} + +jobs: + lint: + {{> jobYml jobName="Lint" }} + {{> stepLintYml jobRunFlags=pkgFlags }} + + test: + {{> jobMatrixYml jobName="Test" }} + {{> stepTestYml jobRunFlags=pkgFlags }} diff --git a/lib/content/ci.yml b/lib/content/ci.yml deleted file mode 100644 index 0226d0c3..00000000 --- a/lib/content/ci.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: CI {{~#if isWorkspace}} - {{ pkgName }}{{/if}} - -on: - {{> onCi }} - -jobs: - lint: - {{> job jobName="Lint" }} - {{> stepLint jobRunFlags=pkgFlags }} - - test: - {{> jobMatrix jobName="Test" }} - {{> stepTest jobRunFlags=pkgFlags }} diff --git a/lib/content/codeql-analysis.yml b/lib/content/codeql-analysis-yml.hbs similarity index 96% rename from lib/content/codeql-analysis.yml rename to lib/content/codeql-analysis-yml.hbs index 4903a0be..78415d3f 100644 --- a/lib/content/codeql-analysis.yml +++ b/lib/content/codeql-analysis-yml.hbs @@ -24,7 +24,7 @@ jobs: contents: read security-events: write steps: - {{> stepGit }} + {{> stepGitYml }} - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/lib/content/commitlintrc.js b/lib/content/commitlintrc-js.hbs similarity index 100% rename from lib/content/commitlintrc.js rename to lib/content/commitlintrc-js.hbs diff --git a/lib/content/config.yml b/lib/content/config-yml.hbs similarity index 100% rename from lib/content/config.yml rename to lib/content/config-yml.hbs diff --git a/lib/content/dependabot.yml b/lib/content/dependabot-yml.hbs similarity index 100% rename from lib/content/dependabot.yml rename to lib/content/dependabot-yml.hbs diff --git a/lib/content/eslintrc.js b/lib/content/eslintrc-js.hbs similarity index 100% rename from lib/content/eslintrc.js rename to lib/content/eslintrc-js.hbs diff --git a/lib/content/gitignore b/lib/content/gitignore.hbs similarity index 100% rename from lib/content/gitignore rename to lib/content/gitignore.hbs diff --git a/lib/content/index.js b/lib/content/index.js index ed916cc9..bccb3711 100644 --- a/lib/content/index.js +++ b/lib/content/index.js @@ -5,22 +5,22 @@ const isPublic = (p) => p.config.isPublic const sharedRootAdd = (name) => ({ // release '.github/workflows/release.yml': { - file: 'release.yml', + file: 'release-yml.hbs', filter: isPublic, }, '.github/workflows/ci-release.yml': { - file: 'ci-release.yml', + file: 'ci-release-yml.hbs', filter: isPublic, }, '.release-please-manifest.json': { - file: 'release-please-manifest.json', + file: 'release-please-manifest-json.hbs', filter: isPublic, parser: (p) => class extends p.JsonMerge { comment = null }, }, 'release-please-config.json': { - file: 'release-please-config.json', + file: 'release-please-config-json.hbs', filter: isPublic, parser: (p) => class extends p.JsonMerge { comment = null @@ -28,23 +28,23 @@ const sharedRootAdd = (name) => ({ }, // this lint commits which is only necessary for releases '.github/workflows/pull-request.yml': { - file: 'pull-request.yml', + file: 'pull-request-yml.hbs', filter: isPublic, }, // ci - '.github/matchers/tap.json': 'tap.json', - [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci.yml', + '.github/matchers/tap.json': 'tap-json.hbs', + [`.github/workflows/ci${name ? `-${name}` : ''}.yml`]: 'ci-yml.hbs', // dependabot '.github/dependabot.yml': { - file: 'dependabot.yml', + file: 'dependabot-yml.hbs', filter: (p) => p.config.dependabot, }, '.github/workflows/post-dependabot.yml': { - file: 'post-dependabot.yml', + file: 'post-dependabot-yml.hbs', filter: (p) => p.config.dependabot, }, '.github/settings.yml': { - file: 'settings.yml', + file: 'settings-yml.hbs', filter: (p) => !p.config.isReleaseBranch, }, }) @@ -61,12 +61,12 @@ const sharedRootRm = () => ({ // Changes applied to the root of the repo const rootRepo = { add: { - '.commitlintrc.js': 'commitlintrc.js', - '.github/ISSUE_TEMPLATE/bug.yml': 'bug.yml', - '.github/ISSUE_TEMPLATE/config.yml': 'config.yml', - '.github/CODEOWNERS': 'CODEOWNERS', - '.github/workflows/audit.yml': 'audit.yml', - '.github/workflows/codeql-analysis.yml': 'codeql-analysis.yml', + '.commitlintrc.js': 'commitlintrc-js.hbs', + '.github/ISSUE_TEMPLATE/bug.yml': 'bug-yml.hbs', + '.github/ISSUE_TEMPLATE/config.yml': 'config-yml.hbs', + '.github/CODEOWNERS': 'CODEOWNERS.hbs', + '.github/workflows/audit.yml': 'audit-yml.hbs', + '.github/workflows/codeql-analysis.yml': 'codeql-analysis-yml.hbs', ...sharedRootAdd(), }, rm: { @@ -84,15 +84,15 @@ const rootRepo = { const rootModule = { add: { '.eslintrc.js': { - file: 'eslintrc.js', + file: 'eslintrc-js.hbs', filter: (p) => p.config.eslint, }, - '.gitignore': 'gitignore', - '.npmrc': 'npmrc', - 'SECURITY.md': 'SECURITY.md', - 'CODE_OF_CONDUCT.md': 'CODE_OF_CONDUCT.md', - 'CONTRIBUTING.md': 'CONTRIBUTING.md', - 'package.json': 'pkg.json', + '.gitignore': 'gitignore.hbs', + '.npmrc': 'npmrc.hbs', + 'SECURITY.md': 'SECURITY-md.hbs', + 'CODE_OF_CONDUCT.md': 'CODE_OF_CONDUCT-md.hbs', + 'CONTRIBUTING.md': 'CONTRIBUTING-md.hbs', + 'package.json': 'package-json.hbs', }, rm: [ '.eslintrc.!(js|local.*)', @@ -115,11 +115,11 @@ const workspaceRepo = { const workspaceModule = { add: { '.eslintrc.js': { - file: 'eslintrc.js', + file: 'eslintrc-js.hbs', filter: (p) => p.config.eslint, }, - '.gitignore': 'gitignore', - 'package.json': 'pkg.json', + '.gitignore': 'gitignore.hbs', + 'package.json': 'package-json.hbs', }, rm: [ '.npmrc', diff --git a/lib/content/npmrc b/lib/content/npmrc.hbs similarity index 100% rename from lib/content/npmrc rename to lib/content/npmrc.hbs diff --git a/lib/content/pkg.json b/lib/content/package-json.hbs similarity index 100% rename from lib/content/pkg.json rename to lib/content/package-json.hbs diff --git a/lib/content/post-dependabot.yml b/lib/content/post-dependabot-yml.hbs similarity index 99% rename from lib/content/post-dependabot.yml rename to lib/content/post-dependabot-yml.hbs index fe7526c4..46cfdc58 100644 --- a/lib/content/post-dependabot.yml +++ b/lib/content/post-dependabot-yml.hbs @@ -8,7 +8,7 @@ permissions: jobs: template-oss: - {{> job + {{> jobYml jobName="template-oss" jobIf="github.actor == 'dependabot[bot]'" jobCheckout=(obj ref="${{ github.event.pull_request.head.ref }}") diff --git a/lib/content/pull-request.yml b/lib/content/pull-request-yml.hbs similarity index 89% rename from lib/content/pull-request.yml rename to lib/content/pull-request-yml.hbs index 3c523b71..a4db6afe 100644 --- a/lib/content/pull-request.yml +++ b/lib/content/pull-request-yml.hbs @@ -10,7 +10,7 @@ on: jobs: commitlint: - {{> job jobName="Lint Commits" jobCheckout=(obj fetch-depth=0) }} + {{> jobYml jobName="Lint Commits" jobCheckout=(obj fetch-depth=0) }} - name: Run Commitlint on Commits id: commit continue-on-error: true diff --git a/lib/content/release-please-config.json b/lib/content/release-please-config-json.hbs similarity index 100% rename from lib/content/release-please-config.json rename to lib/content/release-please-config-json.hbs diff --git a/lib/content/release-please-manifest.json b/lib/content/release-please-manifest-json.hbs similarity index 100% rename from lib/content/release-please-manifest.json rename to lib/content/release-please-manifest-json.hbs diff --git a/lib/content/release.yml b/lib/content/release-yml.hbs similarity index 90% rename from lib/content/release.yml rename to lib/content/release-yml.hbs index 976e1e90..43e7acbc 100644 --- a/lib/content/release.yml +++ b/lib/content/release-yml.hbs @@ -27,7 +27,7 @@ jobs: pr-number: $\{{ steps.release.outputs.pr-number }} comment-id: $\{{ steps.pr-comment.outputs.result }} check-id: $\{{ steps.check.outputs.check_id }} - {{> job jobName="Release" }} + {{> jobYml jobName="Release" }} - name: Release Please id: release env: @@ -66,14 +66,14 @@ jobs: } return commentId - {{> stepChecks jobCheck=(obj name="Release" sha="steps.release.outputs.pr-sha") }} + {{> stepChecksYml jobCheck=(obj name="Release" sha="steps.release.outputs.pr-sha") }} update: needs: release outputs: sha: $\{{ steps.commit.outputs.sha }} check-id: $\{{ steps.check.outputs.check_id }} - {{> job + {{> jobYml jobName="Update - Release" jobIf="needs.release.outputs.pr" jobCheckout=(obj ref="${{ needs.release.outputs.branch }}" fetch-depth=0) @@ -94,8 +94,8 @@ jobs: git commit --all --amend --no-edit || true git push --force-with-lease echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - {{> stepChecks jobName="Update - Release" jobCheck=(obj sha="steps.commit.outputs.sha" name="Release" )}} - {{> stepChecks jobCheck=(obj id="needs.release.outputs.check-id" )}} + {{> stepChecksYml jobName="Update - Release" jobCheck=(obj sha="steps.commit.outputs.sha" name="Release" )}} + {{> stepChecksYml jobCheck=(obj id="needs.release.outputs.check-id" )}} ci: name: CI - Release @@ -108,7 +108,7 @@ jobs: post-ci: needs: [release, update, ci] - {{> job jobName="Post CI - Release" jobIf="needs.release.outputs.pr && always()" jobSkipSetup=true }} + {{> jobYml jobName="Post CI - Release" jobIf="needs.release.outputs.pr && always()" jobSkipSetup=true }} - name: Get Needs Result id: needs-result run: | @@ -121,11 +121,11 @@ jobs: result="success" fi echo "result=$result" >> $GITHUB_OUTPUT - {{> stepChecks jobCheck=(obj id="needs.update.outputs.check-id" status="steps.needs-result.outputs.result") }} + {{> stepChecksYml jobCheck=(obj id="needs.update.outputs.check-id" status="steps.needs-result.outputs.result") }} post-release: needs: release - {{> job jobName="Post Release - Release" jobIf="needs.release.outputs.releases" jobSkipSetup=true }} + {{> jobYml jobName="Post Release - Release" jobIf="needs.release.outputs.releases" jobSkipSetup=true }} - name: Create Release PR Comment uses: actions/github-script@v6 env: @@ -163,11 +163,11 @@ jobs: needs: release name: Release Integration if: needs.release.outputs.release - {{> jobReleaseIntegration }} + {{> jobReleaseIntegrationYml }} post-release-integration: needs: [release, release-integration] - {{> job jobName="Post Release Integration - Release" jobIf="needs.release.outputs.release && always()" jobSkipSetup=true }} + {{> jobYml jobName="Post Release Integration - Release" jobIf="needs.release.outputs.release && always()" jobSkipSetup=true }} - name: Get Needs Result id: needs-result run: | diff --git a/lib/content/settings.yml b/lib/content/settings-yml.hbs similarity index 100% rename from lib/content/settings.yml rename to lib/content/settings-yml.hbs diff --git a/lib/content/tap.json b/lib/content/tap-json.hbs similarity index 100% rename from lib/content/tap.json rename to lib/content/tap-json.hbs diff --git a/test/apply/allow-paths.js b/test/apply/allow-paths.js index 2cf93fd1..fd272d68 100644 --- a/test/apply/allow-paths.js +++ b/test/apply/allow-paths.js @@ -34,8 +34,8 @@ t.test('works with custom content', async (t) => { }, testdir: { content_dir: { - 'paths.json': '{{{json allowPaths}}}', - 'index.js': 'module.exports={rootRepo:{add:{"paths.json":"paths.json"}}}', + 'paths-json.hbs': '{{{json allowPaths}}}', + 'index.js': 'module.exports={rootRepo:{add:{"paths.json":"paths-json.hbs"}}}', }, }, }) diff --git a/test/apply/index.js b/test/apply/index.js index a26ea1bf..f813b36a 100644 --- a/test/apply/index.js +++ b/test/apply/index.js @@ -161,7 +161,7 @@ t.test('workspace config can override root', async (t) => { a: { templateOSS: { workspaceModule: { - add: { '.eslintrc.js': 'eslintrc.js' }, + add: { '.eslintrc.js': 'eslintrc-js.hbs' }, rm: { '.npmrc': true }, }, }, @@ -199,8 +199,8 @@ t.test('workspaces can override content', async (t) => { testdir: { content_dir: { 'index.js': 'module.exports={}' }, content_dir2: { - 'x.js': 'exists', - 'index.js': 'module.exports={workspaceRepo:{add:{"x.js":"x.js"}}}', + 'x-js.hbs': 'exists', + 'index.js': 'module.exports={workspaceRepo:{add:{"x.js":"x-js.hbs"}}}', }, }, }) @@ -221,12 +221,12 @@ t.test('content can override partials', async (t) => { content_dir: { 'index.js': `module.exports={ rootRepo:{ - add:{'.github/workflows/ci-release.yml': 'ci-release.yml'} + add:{'.github/workflows/ci-release.yml': 'ci-release-yml.hbs'} } }`, - 'ci-release.yml': '{{> ciRelease }}\n job: 1', - '_step-deps.yml': '- run: INSTALL\n', - '_step-test.yml': '- run: TEST\n{{> defaultStepTest }}\n', + 'ci-release-yml.hbs': '{{> ciReleaseYml }}\n job: 1', + '_step-deps-yml.hbs': '- run: INSTALL\n', + '_step-test-yml.hbs': '- run: TEST\n{{> defaultStepTestYml }}\n', }, }, }) @@ -250,8 +250,8 @@ t.test('content can extend files', async (t) => { testdir: { content_dir: { // eslint-disable-next-line max-len - 'index.js': 'module.exports={rootRepo:{add:{".github/workflows/release.yml": "release.yml"}}}', - 'release.yml': '{{> ciRelease}}\n smoke-publish:\n runs-on: ubuntu-latest', + 'index.js': 'module.exports={rootRepo:{add:{".github/workflows/release.yml": "release-yml.hbs"}}}', + 'release-yml.hbs': '{{> ciReleaseYml}}\n smoke-publish:\n runs-on: ubuntu-latest', }, }, }) diff --git a/test/setup.js b/test/setup.js index 32c817de..2f9f8387 100644 --- a/test/setup.js +++ b/test/setup.js @@ -106,7 +106,7 @@ const setup = async (t, { workspaces = {}, testdir = {}, mocks = {}, - ok, + ok = false, } = {}) => { const wsLookup = {} const pkg = merge(