From c6a4bc3d4b9c664edda5ca26943ac709cda60211 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 5 Dec 2025 08:27:39 -0500 Subject: [PATCH 1/3] feat: switch YAML extension preference from .yml to .yaml --- .github/{FUNDING.yml => FUNDING.yaml} | 0 .github/workflows/{ci.yml => ci.yaml} | 0 .github/workflows/{contributors.yml => contributors.yaml} | 0 .github/workflows/{octoguide.yml => octoguide.yaml} | 0 .github/workflows/{post-release.yml => post-release.yaml} | 0 .../{pr-review-requested.yml => pr-review-requested.yaml} | 0 .github/workflows/{release.yml => release.yaml} | 0 eslint.config.js | 2 +- src/blocks/blockESLintYML.test.ts | 7 +------ src/blocks/blockESLintYML.ts | 2 +- 10 files changed, 3 insertions(+), 8 deletions(-) rename .github/{FUNDING.yml => FUNDING.yaml} (100%) rename .github/workflows/{ci.yml => ci.yaml} (100%) rename .github/workflows/{contributors.yml => contributors.yaml} (100%) rename .github/workflows/{octoguide.yml => octoguide.yaml} (100%) rename .github/workflows/{post-release.yml => post-release.yaml} (100%) rename .github/workflows/{pr-review-requested.yml => pr-review-requested.yaml} (100%) rename .github/workflows/{release.yml => release.yaml} (100%) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yaml similarity index 100% rename from .github/FUNDING.yml rename to .github/FUNDING.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yaml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/ci.yaml diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yaml similarity index 100% rename from .github/workflows/contributors.yml rename to .github/workflows/contributors.yaml diff --git a/.github/workflows/octoguide.yml b/.github/workflows/octoguide.yaml similarity index 100% rename from .github/workflows/octoguide.yml rename to .github/workflows/octoguide.yaml diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yaml similarity index 100% rename from .github/workflows/post-release.yml rename to .github/workflows/post-release.yaml diff --git a/.github/workflows/pr-review-requested.yml b/.github/workflows/pr-review-requested.yaml similarity index 100% rename from .github/workflows/pr-review-requested.yml rename to .github/workflows/pr-review-requested.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 100% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml diff --git a/eslint.config.js b/eslint.config.js index b663c07cb..e13b426e1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -105,7 +105,7 @@ export default defineConfig( extends: [yml.configs["flat/standard"], yml.configs["flat/prettier"]], files: ["**/*.{yml,yaml}"], rules: { - "yml/file-extension": ["error", { extension: "yml" }], + "yml/file-extension": "error", "yml/sort-keys": [ "error", { order: { type: "asc" }, pathPattern: "^.*$" }, diff --git a/src/blocks/blockESLintYML.test.ts b/src/blocks/blockESLintYML.test.ts index 72293f1e9..57edbf91b 100644 --- a/src/blocks/blockESLintYML.test.ts +++ b/src/blocks/blockESLintYML.test.ts @@ -25,12 +25,7 @@ describe("blockESLintYML", () => { "**/*.{yml,yaml}", ], "rules": { - "yml/file-extension": [ - "error", - { - "extension": "yml", - }, - ], + "yml/file-extension": "error", "yml/sort-keys": [ "error", { diff --git a/src/blocks/blockESLintYML.ts b/src/blocks/blockESLintYML.ts index 532da3c1b..93ad11043 100644 --- a/src/blocks/blockESLintYML.ts +++ b/src/blocks/blockESLintYML.ts @@ -17,7 +17,7 @@ export const blockESLintYML = base.createBlock({ ], files: ["**/*.{yml,yaml}"], rules: { - "yml/file-extension": ["error", { extension: "yml" }], + "yml/file-extension": "error", "yml/sort-keys": [ "error", { From 5bb39f2bb6c57b06329da0186971319a2f015821 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 5 Dec 2025 08:36:08 -0500 Subject: [PATCH 2/3] More comprehensive updates --- .github/DEVELOPMENT.md | 2 +- .../{01-bug.yml => 01-bug.yaml} | 0 ...ocumentation.yml => 02-documentation.yaml} | 0 .../{03-feature.yml => 03-feature.yaml} | 0 .../{04-tooling.yml => 04-tooling.yaml} | 0 .../prepare/{action.yml => action.yaml} | 0 docs/Blocks.md | 2 +- docs/CLI.md | 2 +- docs/Configuration Files.md | 2 +- docs/FAQs.md | 10 ++-- src/base.ts | 2 +- src/blocks/blockAllContributors.test.ts | 6 +- src/blocks/blockAllContributors.ts | 2 +- src/blocks/blockCTATransitions.test.ts | 6 +- src/blocks/blockCTATransitions.ts | 6 +- src/blocks/blockCodecov.test.ts | 26 ++++----- src/blocks/blockCodecov.ts | 4 +- src/blocks/blockFunding.ts | 2 +- src/blocks/blockGitHubActionsCI.test.ts | 58 +++++++++---------- src/blocks/blockGitHubActionsCI.ts | 10 ++-- src/blocks/blockGitHubIssueTemplates.ts | 8 +-- src/blocks/blockOctoGuide.test.ts | 20 +++---- src/blocks/blockOctoGuide.ts | 8 +-- src/blocks/blockPnpmDedupe.test.ts | 4 +- src/blocks/blockPnpmDedupe.ts | 2 +- src/blocks/blockReleaseIt.test.ts | 8 +-- src/blocks/blockReleaseIt.ts | 4 +- src/blocks/blockRemoveWorkflows.test.ts | 6 +- src/blocks/blockRemoveWorkflows.ts | 2 +- src/blocks/intake/intakeFileAsYaml.test.ts | 23 ++++++-- src/blocks/intake/intakeFileAsYaml.ts | 7 ++- src/options/readFunding.ts | 2 +- 32 files changed, 125 insertions(+), 109 deletions(-) rename .github/ISSUE_TEMPLATE/{01-bug.yml => 01-bug.yaml} (100%) rename .github/ISSUE_TEMPLATE/{02-documentation.yml => 02-documentation.yaml} (100%) rename .github/ISSUE_TEMPLATE/{03-feature.yml => 03-feature.yaml} (100%) rename .github/ISSUE_TEMPLATE/{04-tooling.yml => 04-tooling.yaml} (100%) rename .github/actions/prepare/{action.yml => action.yaml} (100%) diff --git a/.github/DEVELOPMENT.md b/.github/DEVELOPMENT.md index c82bb4248..93c6b9721 100644 --- a/.github/DEVELOPMENT.md +++ b/.github/DEVELOPMENT.md @@ -52,7 +52,7 @@ Each should be shown in VS Code, and can be run manually on the command-line: - `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files - `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports -- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file +- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yaml` file - `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files Read the individual documentation for each linter to understand how it can be configured and used best. diff --git a/.github/ISSUE_TEMPLATE/01-bug.yml b/.github/ISSUE_TEMPLATE/01-bug.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/01-bug.yml rename to .github/ISSUE_TEMPLATE/01-bug.yaml diff --git a/.github/ISSUE_TEMPLATE/02-documentation.yml b/.github/ISSUE_TEMPLATE/02-documentation.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/02-documentation.yml rename to .github/ISSUE_TEMPLATE/02-documentation.yaml diff --git a/.github/ISSUE_TEMPLATE/03-feature.yml b/.github/ISSUE_TEMPLATE/03-feature.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/03-feature.yml rename to .github/ISSUE_TEMPLATE/03-feature.yaml diff --git a/.github/ISSUE_TEMPLATE/04-tooling.yml b/.github/ISSUE_TEMPLATE/04-tooling.yaml similarity index 100% rename from .github/ISSUE_TEMPLATE/04-tooling.yml rename to .github/ISSUE_TEMPLATE/04-tooling.yaml diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yaml similarity index 100% rename from .github/actions/prepare/action.yml rename to .github/actions/prepare/action.yaml diff --git a/docs/Blocks.md b/docs/Blocks.md index 6d30ee206..8a237bb1d 100644 --- a/docs/Blocks.md +++ b/docs/Blocks.md @@ -316,7 +316,7 @@ Enables [typescript-eslint's stylistic configs](https://typescript-eslint.io/lin ### Lint YML -[`eslint-plugin-yml`](https://ota-meshi.github.io/eslint-plugin-yml): Adds linting for `yaml` and `.yml` files, such as sorting keys. +[`eslint-plugin-yml`](https://ota-meshi.github.io/eslint-plugin-yml): Adds linting for `yaml` and `.yaml` files, such as sorting keys. ### OctoGuide Strict diff --git a/docs/CLI.md b/docs/CLI.md index cff2b6cd3..fa67d6f46 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -50,7 +50,7 @@ Each defaults to a value based on the running system, including an repository if | `--bin` | `string` | Value to set in `package.json`'s `"bin"` property, per [FAQs > How can I use `bin`?](./FAQs.md#how-can-i-use-bin) | _(none)_ | | `--email` | `string` | Email address to be listed as the point of contact in docs and packages (e.g. `example@joshuakgoldberg.com`) | Yours from `gh`, `git config`, or `npm whoami` | | `--emoji` | `string` | decorative emoji to use in descriptions and docs | The last emoji from `description`, or `"💖"` | -| `--funding` | `string` | GitHub organization or username to mention in `funding.yml` | The same as `owner` | +| `--funding` | `string` | GitHub organization or username to mention in `funding.yaml` | The same as `owner` | | `--keywords` | `string[]` | Any number of keywords to include in `package.json` | _(none)_ | | `--owner` | `string` | Organization or user owning the repository | Yours from `gh` or `git config` | | `--pnpm` | `string` | pnpm version for `package.json`'s `packageManager` field | Existing value in `package.json` if it exists | diff --git a/docs/Configuration Files.md b/docs/Configuration Files.md index 1504edfe3..571ec44b4 100644 --- a/docs/Configuration Files.md +++ b/docs/Configuration Files.md @@ -29,7 +29,7 @@ These options are generally only programmatically used internally, but can still | `node` | Node.js engine version(s) to pin and require a minimum of | Values from `.nvmrc` and `package.json`'s `"engines"` | | `packageData` | additional properties to include in `package.json` | Existing values in `package.json` | | `rulesetId` | GitHub branch ruleset ID for main branch protections | Existing ruleset on the `main` branch from the GitHub API | -| `workflowsVersions` | existing versions of GitHub Actions workflows used | Existing action versions in `.github/workflows/*.yml` | +| `workflowsVersions` | existing versions of GitHub Actions workflows used | Existing action versions in `.github/workflows/*.yaml` | For example, changing `node` versions to values different from what would be inferred: diff --git a/docs/FAQs.md b/docs/FAQs.md index 8222c996d..863272431 100644 --- a/docs/FAQs.md +++ b/docs/FAQs.md @@ -11,7 +11,7 @@ It'll walk you through the common activities you'll need to contribute to a repo Yes! After you set up a repository, you can substitute in any tools you'd like. -If you think the tool would be broadly useful to most consumers of this template, feel free to [file a feature request](https://github.com/JoshuaKGoldberg/create-typescript-app/issues/new?assignees=&labels=type%3A+feature&projects=&template=03-feature.yml&title=%F0%9F%9A%80+Feature%3A+%3Cshort+description+of+the+feature%3E) to add it in. +If you think the tool would be broadly useful to most consumers of this template, feel free to [file a feature request](https://github.com/JoshuaKGoldberg/create-typescript-app/issues/new?assignees=&labels=type%3A+feature&projects=&template=03-feature.yaml&title=%F0%9F%9A%80+Feature%3A+%3Cshort+description+of+the+feature%3E) to add it in. ## Can I create a GitHub action? @@ -20,11 +20,11 @@ Here we'll outline the steps required to migrate a CTA app to a GitHub Action: 1. GitHub Actions store built output on a GitHub branch rather than in a published package on npm. As a consequence we should: - - delete `.github/workflows/release.yml` and `.github/workflows/post-release.yml`. - - update `.github/workflows/build.yml` to ensure `dist` is up to date: + - delete `.github/workflows/release.yaml` and `.github/workflows/post-release.yaml`. + - update `.github/workflows/build.yaml` to ensure `dist` is up to date:
- .github/workflows/build.yml + .github/workflows/build.yaml ```yml jobs: @@ -95,7 +95,7 @@ Delete `tsdown.config.ts` then execute the following commands: npx lint-staged ``` -2. Create an [`action.yml` metadata file](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#creating-an-action-metadata-file). +2. Create an [`action.yaml` metadata file](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#creating-an-action-metadata-file). It's worth reading the [GitHub Actions documentation](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#writing-the-action-code). diff --git a/src/base.ts b/src/base.ts index d9891884c..5cbdd3c5f 100644 --- a/src/base.ts +++ b/src/base.ts @@ -98,7 +98,7 @@ export const base = createBase({ funding: z .string() .optional() - .describe("GitHub organization or username to mention in `funding.yml`"), + .describe("GitHub organization or username to mention in `funding.yaml`"), guide: z .object({ href: z.string(), diff --git a/src/blocks/blockAllContributors.test.ts b/src/blocks/blockAllContributors.test.ts index bb7d9e040..89493f95b 100644 --- a/src/blocks/blockAllContributors.test.ts +++ b/src/blocks/blockAllContributors.test.ts @@ -68,7 +68,7 @@ describe("blockAllContributors", () => { }", ".github": { "workflows": { - "contributors.yml": "jobs: + "contributors.yaml": "jobs: contributors: runs-on: ubuntu-latest steps: @@ -214,7 +214,7 @@ describe("blockAllContributors", () => { }", ".github": { "workflows": { - "contributors.yml": "jobs: + "contributors.yaml": "jobs: contributors: runs-on: ubuntu-latest steps: @@ -359,7 +359,7 @@ describe("blockAllContributors", () => { }", ".github": { "workflows": { - "contributors.yml": "jobs: + "contributors.yaml": "jobs: contributors: runs-on: ubuntu-latest steps: diff --git a/src/blocks/blockAllContributors.ts b/src/blocks/blockAllContributors.ts index a4be32cf5..dcc0ffe57 100644 --- a/src/blocks/blockAllContributors.ts +++ b/src/blocks/blockAllContributors.ts @@ -83,7 +83,7 @@ export const blockAllContributors = base.createBlock({ ), ".github": { workflows: { - "contributors.yml": createSoloWorkflowFile({ + "contributors.yaml": createSoloWorkflowFile({ name: "Contributors", on: { push: { diff --git a/src/blocks/blockCTATransitions.test.ts b/src/blocks/blockCTATransitions.test.ts index 90886dbb9..a3d384162 100644 --- a/src/blocks/blockCTATransitions.test.ts +++ b/src/blocks/blockCTATransitions.test.ts @@ -30,7 +30,7 @@ describe("blockCTATransitions", () => { ".github": { "actions": { "transition": { - "action.yml": "description: Runs create-typescript-app in transition mode + "action.yaml": "description: Runs create-typescript-app in transition mode inputs: token: @@ -63,7 +63,7 @@ describe("blockCTATransitions", () => { Cheers! — _The Friendly Bingo Bot_ 💝 - > â„šī¸ These automatic commits keep your repository up-to-date with new versions of [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). If you want to opt out, delete your \`.github/workflows/cta-transitions.yml\` file. + > â„šī¸ These automatic commits keep your repository up-to-date with new versions of [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). If you want to opt out, delete your \`.github/workflows/cta-transitions.yaml\` file. - id: package-change uses: JoshuaKGoldberg/package-change-detector-action@0.1.0 with: @@ -82,7 +82,7 @@ describe("blockCTATransitions", () => { }, }, "workflows": { - "cta.yml": "jobs: + "cta.yaml": "jobs: transition: name: Transition runs-on: ubuntu-latest diff --git a/src/blocks/blockCTATransitions.ts b/src/blocks/blockCTATransitions.ts index 7c1457a9a..ec00cb526 100644 --- a/src/blocks/blockCTATransitions.ts +++ b/src/blocks/blockCTATransitions.ts @@ -28,7 +28,7 @@ export const blockCTATransitions = base.createBlock({ ".github": { actions: { transition: { - "action.yml": formatYaml({ + "action.yaml": formatYaml({ description: "Runs create-typescript-app in transition mode", inputs: { token: { @@ -78,7 +78,7 @@ export const blockCTATransitions = base.createBlock({ "Cheers!", " — _The Friendly Bingo Bot_ 💝", "", - "> â„šī¸ These automatic commits keep your repository up-to-date with new versions of [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). If you want to opt out, delete your `.github/workflows/cta-transitions.yml` file.", + "> â„šī¸ These automatic commits keep your repository up-to-date with new versions of [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). If you want to opt out, delete your `.github/workflows/cta-transitions.yaml` file.", ].join("\n"), }, }, @@ -117,7 +117,7 @@ export const blockCTATransitions = base.createBlock({ }, }, workflows: { - "cta.yml": createSoloWorkflowFile({ + "cta.yaml": createSoloWorkflowFile({ jobName: "Transition", name: "CTA", on: { diff --git a/src/blocks/blockCodecov.test.ts b/src/blocks/blockCodecov.test.ts index b18a73be6..70c715e46 100644 --- a/src/blocks/blockCodecov.test.ts +++ b/src/blocks/blockCodecov.test.ts @@ -99,8 +99,8 @@ describe("blockCodecov", () => { { "addons": { "files": [ - ".github/codecov.yml", - "codecov.yml", + ".github/codecov.yaml", + "codecov.yaml", ], }, "block": [Function], @@ -166,7 +166,7 @@ describe("blockCodecov", () => { }); describe("intake", () => { - it("returns undefined when ci.yml does not exist", () => { + it("returns undefined when ci.yaml does not exist", () => { const actual = testIntake(blockCodecov, { files: { ".github": { @@ -178,12 +178,12 @@ describe("blockCodecov", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when ci.yml contains invalid yml", () => { + it("returns undefined when ci.yaml contains invalid yml", () => { const actual = testIntake(blockCodecov, { files: { ".github": { workflows: { - "ci.yml": ["invalid yml!"], + "ci.yaml": ["invalid yml!"], }, }, }, @@ -192,12 +192,12 @@ describe("blockCodecov", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when ci.yml does not contain a test job", () => { + it("returns undefined when ci.yaml does not contain a test job", () => { const actual = testIntake(blockCodecov, { files: { ".github": { workflows: { - "ci.yml": [ + "ci.yaml": [ jsYaml.dump({ jobs: { other: { @@ -215,12 +215,12 @@ describe("blockCodecov", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when ci.yml contains a test job with only non-string uses", () => { + it("returns undefined when ci.yaml contains a test job with only non-string uses", () => { const actual = testIntake(blockCodecov, { files: { ".github": { workflows: { - "ci.yml": [ + "ci.yaml": [ jsYaml.dump({ jobs: { test: { @@ -242,12 +242,12 @@ describe("blockCodecov", () => { expect(actual).toBeUndefined(); }); - it("returns undefined env when ci.yml contains a test job with no env in its codecov step", () => { + it("returns undefined env when ci.yaml contains a test job with no env in its codecov step", () => { const actual = testIntake(blockCodecov, { files: { ".github": { workflows: { - "ci.yml": [ + "ci.yaml": [ jsYaml.dump({ jobs: { test: { @@ -269,7 +269,7 @@ describe("blockCodecov", () => { expect(actual).toEqual({ env: undefined }); }); - it("returns env when ci.yml contains a test job with env in its codecov step", () => { + it("returns env when ci.yaml contains a test job with env in its codecov step", () => { const env = { CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}", }; @@ -277,7 +277,7 @@ describe("blockCodecov", () => { files: { ".github": { workflows: { - "ci.yml": [ + "ci.yaml": [ jsYaml.dump({ jobs: { test: { diff --git a/src/blocks/blockCodecov.ts b/src/blocks/blockCodecov.ts index 9966ad42c..e28dcc864 100644 --- a/src/blocks/blockCodecov.ts +++ b/src/blocks/blockCodecov.ts @@ -18,7 +18,7 @@ export const blockCodecov = base.createBlock({ intake({ files }) { const steps = intakeFileYamlSteps( files, - [".github", "workflows", "ci.yml"], + [".github", "workflows", "ci.yaml"], ["jobs", "test", "steps"], ); if (!steps) { @@ -78,7 +78,7 @@ export const blockCodecov = base.createBlock({ transition() { return { addons: [ - blockRemoveFiles({ files: [".github/codecov.yml", "codecov.yml"] }), + blockRemoveFiles({ files: [".github/codecov.yaml", "codecov.yaml"] }), ], }; }, diff --git a/src/blocks/blockFunding.ts b/src/blocks/blockFunding.ts index 64cff2929..39879b39b 100644 --- a/src/blocks/blockFunding.ts +++ b/src/blocks/blockFunding.ts @@ -9,7 +9,7 @@ export const blockFunding = base.createBlock({ return { files: { ".github": { - "FUNDING.yml": + "FUNDING.yaml": options.funding && formatYaml({ github: options.funding }), }, }, diff --git a/src/blocks/blockGitHubActionsCI.test.ts b/src/blocks/blockGitHubActionsCI.test.ts index c335f018d..38020e08d 100644 --- a/src/blocks/blockGitHubActionsCI.test.ts +++ b/src/blocks/blockGitHubActionsCI.test.ts @@ -30,7 +30,7 @@ describe("blockGitHubActionsCI", () => { ".github": { "actions": { "prepare": { - "action.yml": "description: Prepares the repo for a typical CI job + "action.yaml": "description: Prepares the repo for a typical CI job name: Prepare @@ -48,8 +48,8 @@ describe("blockGitHubActionsCI", () => { }, }, "workflows": { - "ci.yml": undefined, - "pr-review-requested.yml": "jobs: + "ci.yaml": undefined, + "pr-review-requested.yaml": "jobs: pr_review_requested: runs-on: ubuntu-latest steps: @@ -106,7 +106,7 @@ describe("blockGitHubActionsCI", () => { ".github": { "actions": { "prepare": { - "action.yml": "description: Prepares the repo for a typical CI job + "action.yaml": "description: Prepares the repo for a typical CI job name: Prepare @@ -124,8 +124,8 @@ describe("blockGitHubActionsCI", () => { }, }, "workflows": { - "ci.yml": undefined, - "pr-review-requested.yml": "jobs: + "ci.yaml": undefined, + "pr-review-requested.yaml": "jobs: pr_review_requested: runs-on: ubuntu-latest steps: @@ -176,7 +176,7 @@ describe("blockGitHubActionsCI", () => { ".github": { "actions": { "prepare": { - "action.yml": "description: Prepares the repo for a typical CI job + "action.yaml": "description: Prepares the repo for a typical CI job name: Prepare @@ -194,8 +194,8 @@ describe("blockGitHubActionsCI", () => { }, }, "workflows": { - "ci.yml": undefined, - "pr-review-requested.yml": "jobs: + "ci.yaml": undefined, + "pr-review-requested.yaml": "jobs: pr_review_requested: runs-on: ubuntu-latest steps: @@ -246,7 +246,7 @@ describe("blockGitHubActionsCI", () => { "addons": { "files": [ ".circleci", - "travis.yml", + "travis.yaml", ], }, "block": [Function], @@ -256,7 +256,7 @@ describe("blockGitHubActionsCI", () => { ".github": { "actions": { "prepare": { - "action.yml": "description: Prepares the repo for a typical CI job + "action.yaml": "description: Prepares the repo for a typical CI job name: Prepare @@ -274,8 +274,8 @@ describe("blockGitHubActionsCI", () => { }, }, "workflows": { - "ci.yml": undefined, - "pr-review-requested.yml": "jobs: + "ci.yaml": undefined, + "pr-review-requested.yaml": "jobs: pr_review_requested: runs-on: ubuntu-latest steps: @@ -343,7 +343,7 @@ describe("blockGitHubActionsCI", () => { ".github": { "actions": { "prepare": { - "action.yml": "description: Prepares the repo for a typical CI job + "action.yaml": "description: Prepares the repo for a typical CI job name: Prepare @@ -361,7 +361,7 @@ describe("blockGitHubActionsCI", () => { }, }, "workflows": { - "ci.yml": "jobs: + "ci.yaml": "jobs: validate: name: Validate runs-on: ubuntu-latest @@ -385,7 +385,7 @@ describe("blockGitHubActionsCI", () => { branches: - main ", - "pr-review-requested.yml": "jobs: + "pr-review-requested.yaml": "jobs: pr_review_requested: runs-on: ubuntu-latest steps: @@ -418,7 +418,7 @@ describe("blockGitHubActionsCI", () => { }); describe("intake", () => { - it("returns undefined when action.yml does not exist", () => { + it("returns undefined when action.yaml does not exist", () => { const actual = testIntake(blockGitHubActionsCI, { files: {}, }); @@ -426,13 +426,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when action.yml contains invalid yml", () => { + it("returns undefined when action.yaml contains invalid yml", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yml": ["invalid yml!"], + "action.yaml": ["invalid yml!"], }, }, }, @@ -442,13 +442,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when action.yml does not contain a runs entry", () => { + it("returns undefined when action.yaml does not contain a runs entry", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yml": [ + "action.yaml": [ jsYaml.dump({ other: { steps: [], @@ -464,13 +464,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when action.yml runs steps is not an array", () => { + it("returns undefined when action.yaml runs steps is not an array", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yml": [ + "action.yaml": [ jsYaml.dump({ runs: { steps: true, @@ -486,13 +486,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined env when action.yml contains a test action with actions/setup-node step", () => { + it("returns undefined env when action.yaml contains a test action with actions/setup-node step", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yml": [ + "action.yaml": [ jsYaml.dump({ runs: { steps: [ @@ -512,13 +512,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined env when action.yml contains a test action with no env in its actions/setup-node step", () => { + it("returns undefined env when action.yaml contains a test action with no env in its actions/setup-node step", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yml": [ + "action.yaml": [ jsYaml.dump({ runs: { steps: [ @@ -538,7 +538,7 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns nodeVersion when action.yml contains a test action with node-version in its actions/setup/node step", () => { + it("returns nodeVersion when action.yaml contains a test action with node-version in its actions/setup/node step", () => { const nodeVersion = "20.10.0"; const actual = testIntake(blockGitHubActionsCI, { @@ -546,7 +546,7 @@ describe("blockGitHubActionsCI", () => { ".github": { actions: { prepare: { - "action.yml": [ + "action.yaml": [ jsYaml.dump({ runs: { steps: [ diff --git a/src/blocks/blockGitHubActionsCI.ts b/src/blocks/blockGitHubActionsCI.ts index 7ec7ef386..e2002dfca 100644 --- a/src/blocks/blockGitHubActionsCI.ts +++ b/src/blocks/blockGitHubActionsCI.ts @@ -29,7 +29,7 @@ export const blockGitHubActionsCI = base.createBlock({ intake({ files }) { const steps = intakeFileYamlSteps( files, - [".github", "actions", "prepare", "action.yml"], + [".github", "actions", "prepare", "action.yaml"], ["runs", "steps"], ); if (!steps) { @@ -66,7 +66,7 @@ export const blockGitHubActionsCI = base.createBlock({ ".github": { actions: { prepare: { - "action.yml": formatYaml({ + "action.yaml": formatYaml({ description: "Prepares the repo for a typical CI job", name: "Prepare", runs: { @@ -100,14 +100,14 @@ export const blockGitHubActionsCI = base.createBlock({ }, }, workflows: { - "ci.yml": + "ci.yaml": jobs && createMultiWorkflowFile({ jobs: jobs.sort((a, b) => a.name.localeCompare(b.name)), name: "CI", workflowsVersions: options.workflowsVersions, }), - "pr-review-requested.yml": createSoloWorkflowFile({ + "pr-review-requested.yaml": createSoloWorkflowFile({ name: "PR Review Requested", on: { pull_request_target: { @@ -143,7 +143,7 @@ export const blockGitHubActionsCI = base.createBlock({ return { addons: [ blockRemoveFiles({ - files: [".circleci", "travis.yml"], + files: [".circleci", "travis.yaml"], }), ], }; diff --git a/src/blocks/blockGitHubIssueTemplates.ts b/src/blocks/blockGitHubIssueTemplates.ts index 3079cc36a..da94335a2 100644 --- a/src/blocks/blockGitHubIssueTemplates.ts +++ b/src/blocks/blockGitHubIssueTemplates.ts @@ -10,7 +10,7 @@ export const blockGitHubIssueTemplates = base.createBlock({ files: { ".github": { ISSUE_TEMPLATE: { - "01-bug.yml": formatYaml({ + "01-bug.yaml": formatYaml({ body: [ { attributes: { @@ -69,7 +69,7 @@ export const blockGitHubIssueTemplates = base.createBlock({ name: "🐛 Bug", title: "🐛 Bug: ", }), - "02-documentation.yml": formatYaml({ + "02-documentation.yaml": formatYaml({ body: [ { attributes: { @@ -113,7 +113,7 @@ export const blockGitHubIssueTemplates = base.createBlock({ name: "📝 Documentation", title: "📝 Documentation: ", }), - "03-feature.yml": formatYaml({ + "03-feature.yaml": formatYaml({ body: [ { attributes: { @@ -158,7 +158,7 @@ export const blockGitHubIssueTemplates = base.createBlock({ name: "🚀 Feature", title: "🚀 Feature: ", }), - "04-tooling.yml": formatYaml({ + "04-tooling.yaml": formatYaml({ body: [ { attributes: { diff --git a/src/blocks/blockOctoGuide.test.ts b/src/blocks/blockOctoGuide.test.ts index 589b99ee1..c1164b85a 100644 --- a/src/blocks/blockOctoGuide.test.ts +++ b/src/blocks/blockOctoGuide.test.ts @@ -16,7 +16,7 @@ describe("blockOctoGuide", () => { "files": { ".github": { "workflows": { - "octoguide.yml": "jobs: + "octoguide.yaml": "jobs: octoguide: if: \${{ !endsWith(github.actor, '[bot]') }} runs-on: ubuntu-latest @@ -84,8 +84,8 @@ describe("blockOctoGuide", () => { { "addons": { "files": [ - ".github/workflows/accessibility-alt-text-bot.yml", - ".github/workflows/compliance.yml", + ".github/workflows/accessibility-alt-text-bot.yaml", + ".github/workflows/compliance.yaml", ], }, "block": [Function], @@ -94,7 +94,7 @@ describe("blockOctoGuide", () => { "files": { ".github": { "workflows": { - "octoguide.yml": "jobs: + "octoguide.yaml": "jobs: octoguide: if: \${{ !endsWith(github.actor, '[bot]') }} runs-on: ubuntu-latest @@ -163,7 +163,7 @@ describe("blockOctoGuide", () => { "files": { ".github": { "workflows": { - "octoguide.yml": "jobs: + "octoguide.yaml": "jobs: octoguide: if: \${{ !endsWith(github.actor, '[bot]') }} runs-on: ubuntu-latest @@ -220,7 +220,7 @@ describe("blockOctoGuide", () => { }); describe("intake", () => { - it("returns undefined when octoguide.yml does not exist", () => { + it("returns undefined when octoguide.yaml does not exist", () => { const actual = testIntake(blockOctoGuide, { files: { ".github": { @@ -232,12 +232,12 @@ describe("blockOctoGuide", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when octoguide.yml contains an octoguide job with no octoguide step", () => { + it("returns undefined when octoguide.yaml contains an octoguide job with no octoguide step", () => { const actual = testIntake(blockOctoGuide, { files: { ".github": { workflows: { - "octoguide.yml": [ + "octoguide.yaml": [ jsYaml.dump({ jobs: { octoguide: { @@ -260,14 +260,14 @@ describe("blockOctoGuide", () => { expect(actual).toEqual(undefined); }); - it("returns config when octoguide.yml contains an octoguide job with config in its octoguide step", () => { + it("returns config when octoguide.yaml contains an octoguide job with config in its octoguide step", () => { const config = "strict"; const actual = testIntake(blockOctoGuide, { files: { ".github": { workflows: { - "octoguide.yml": [ + "octoguide.yaml": [ jsYaml.dump({ jobs: { octoguide: { diff --git a/src/blocks/blockOctoGuide.ts b/src/blocks/blockOctoGuide.ts index 9c05ebf8f..5eddcb3ce 100644 --- a/src/blocks/blockOctoGuide.ts +++ b/src/blocks/blockOctoGuide.ts @@ -16,7 +16,7 @@ export const blockOctoGuide = base.createBlock({ intake({ files }) { const steps = intakeFileYamlSteps( files, - [".github", "workflows", "octoguide.yml"], + [".github", "workflows", "octoguide.yaml"], ["jobs", "octoguide", "steps"], ); if (!steps) { @@ -44,7 +44,7 @@ export const blockOctoGuide = base.createBlock({ files: { ".github": { workflows: { - "octoguide.yml": createSoloWorkflowFile({ + "octoguide.yaml": createSoloWorkflowFile({ if: "${{ !endsWith(github.actor, '[bot]') }}", name: "OctoGuide", on: { @@ -96,8 +96,8 @@ export const blockOctoGuide = base.createBlock({ addons: [ blockRemoveFiles({ files: [ - ".github/workflows/accessibility-alt-text-bot.yml", - ".github/workflows/compliance.yml", + ".github/workflows/accessibility-alt-text-bot.yaml", + ".github/workflows/compliance.yaml", ], }), ], diff --git a/src/blocks/blockPnpmDedupe.test.ts b/src/blocks/blockPnpmDedupe.test.ts index 8ecd957d1..1c0c744f6 100644 --- a/src/blocks/blockPnpmDedupe.test.ts +++ b/src/blocks/blockPnpmDedupe.test.ts @@ -19,7 +19,7 @@ describe("blockPnpmDedupe", () => { "Linting": { "contents": { "items": [ - "- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yml\` file", + "- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yaml\` file", ], }, }, @@ -75,7 +75,7 @@ describe("blockPnpmDedupe", () => { "Linting": { "contents": { "items": [ - "- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yml\` file", + "- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yaml\` file", ], }, }, diff --git a/src/blocks/blockPnpmDedupe.ts b/src/blocks/blockPnpmDedupe.ts index ba785dda4..47cf2033e 100644 --- a/src/blocks/blockPnpmDedupe.ts +++ b/src/blocks/blockPnpmDedupe.ts @@ -16,7 +16,7 @@ export const blockPnpmDedupe = base.createBlock({ Linting: { contents: { items: [ - `- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yml\` file`, + `- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yaml\` file`, ], }, }, diff --git a/src/blocks/blockReleaseIt.test.ts b/src/blocks/blockReleaseIt.test.ts index f725f1e06..c3d1c6a66 100644 --- a/src/blocks/blockReleaseIt.test.ts +++ b/src/blocks/blockReleaseIt.test.ts @@ -59,7 +59,7 @@ describe("blockReleaseIt", () => { "files": { ".github": { "workflows": { - "post-release.yml": "jobs: + "post-release.yaml": "jobs: post_release: runs-on: ubuntu-latest steps: @@ -94,7 +94,7 @@ describe("blockReleaseIt", () => { issues: write pull-requests: write ", - "release.yml": "concurrency: + "release.yaml": "concurrency: group: \${{ github.workflow }} @@ -207,7 +207,7 @@ describe("blockReleaseIt", () => { "files": { ".github": { "workflows": { - "post-release.yml": "jobs: + "post-release.yaml": "jobs: post_release: runs-on: ubuntu-latest steps: @@ -242,7 +242,7 @@ describe("blockReleaseIt", () => { issues: write pull-requests: write ", - "release.yml": "concurrency: + "release.yaml": "concurrency: group: \${{ github.workflow }} diff --git a/src/blocks/blockReleaseIt.ts b/src/blocks/blockReleaseIt.ts index 162d6a9d3..06b94b98c 100644 --- a/src/blocks/blockReleaseIt.ts +++ b/src/blocks/blockReleaseIt.ts @@ -66,7 +66,7 @@ export const blockReleaseIt = base.createBlock({ files: { ".github": { workflows: { - "post-release.yml": createSoloWorkflowFile({ + "post-release.yaml": createSoloWorkflowFile({ name: "Post Release", on: { release: { @@ -111,7 +111,7 @@ export const blockReleaseIt = base.createBlock({ }, ], }), - "release.yml": createSoloWorkflowFile({ + "release.yaml": createSoloWorkflowFile({ concurrency: { group: "${{ github.workflow }}", }, diff --git a/src/blocks/blockRemoveWorkflows.test.ts b/src/blocks/blockRemoveWorkflows.test.ts index 41978025f..108673edb 100644 --- a/src/blocks/blockRemoveWorkflows.test.ts +++ b/src/blocks/blockRemoveWorkflows.test.ts @@ -59,9 +59,9 @@ describe("blockRemoveWorkflows", () => { { "addons": { "files": [ - ".github/workflows/a.yml", - ".github/workflows/b.yml", - ".github/workflows/c.yml", + ".github/workflows/a.yaml", + ".github/workflows/b.yaml", + ".github/workflows/c.yaml", ], }, "block": [Function], diff --git a/src/blocks/blockRemoveWorkflows.ts b/src/blocks/blockRemoveWorkflows.ts index 0cc7daec8..47f326485 100644 --- a/src/blocks/blockRemoveWorkflows.ts +++ b/src/blocks/blockRemoveWorkflows.ts @@ -22,7 +22,7 @@ export const blockRemoveWorkflows = base.createBlock({ addons: [ blockRemoveFiles({ files: workflows?.map( - (workflow) => `.github/workflows/${workflow}.yml`, + (workflow) => `.github/workflows/${workflow}.yaml`, ), }), ], diff --git a/src/blocks/intake/intakeFileAsYaml.test.ts b/src/blocks/intake/intakeFileAsYaml.test.ts index 3ad158f03..848728790 100644 --- a/src/blocks/intake/intakeFileAsYaml.test.ts +++ b/src/blocks/intake/intakeFileAsYaml.test.ts @@ -4,28 +4,39 @@ import { intakeFileAsYaml } from "./intakeFileAsYaml.js"; describe(intakeFileAsYaml, () => { it("returns undefined when the file does not exist", () => { - const actual = intakeFileAsYaml({}, []); + const actual = intakeFileAsYaml({}, ["does-not-exist.yaml"]); expect(actual).toBeUndefined(); }); - it("returns undefined when the file does not have valid yml", () => { + it("returns undefined when the file does not have valid YAML under .yaml", () => { const actual = intakeFileAsYaml( { - "file.yml": ["{"], + "file.yaml": ["{"], }, - ["file.yml"], + ["file.yaml"], ); expect(actual).toBeUndefined(); }); - it("returns loaded file contents when the file has valid yml", () => { + it("returns loaded file contents when the file has valid YAML under .yaml", () => { + const actual = intakeFileAsYaml( + { + "file.yaml": ["key: value"], + }, + ["file.yaml"], + ); + + expect(actual).toEqual({ key: "value" }); + }); + + it("returns loaded file contents when the file has valid YAML under .yml", () => { const actual = intakeFileAsYaml( { "file.yml": ["key: value"], }, - ["file.yml"], + ["file.yaml"], ); expect(actual).toEqual({ key: "value" }); diff --git a/src/blocks/intake/intakeFileAsYaml.ts b/src/blocks/intake/intakeFileAsYaml.ts index 459be146e..22d06cfd3 100644 --- a/src/blocks/intake/intakeFileAsYaml.ts +++ b/src/blocks/intake/intakeFileAsYaml.ts @@ -4,7 +4,12 @@ import jsYaml from "js-yaml"; import { intakeFile } from "./intakeFile.js"; export function intakeFileAsYaml(files: IntakeDirectory, filePath: string[]) { - const file = intakeFile(files, filePath); + const file = + intakeFile(files, filePath) ?? + intakeFile(files, [ + ...filePath.slice(0, filePath.length - 1), + filePath[filePath.length - 1].replace(/\.yaml$/i, ".yml"), + ]); try { return file && jsYaml.load(file[0]); diff --git a/src/options/readFunding.ts b/src/options/readFunding.ts index 07f868c4d..9627f86f1 100644 --- a/src/options/readFunding.ts +++ b/src/options/readFunding.ts @@ -5,7 +5,7 @@ import { swallowError } from "../utils/swallowError.js"; export async function readFunding(take: TakeInput) { return swallowError( - await take(inputFromFile, { filePath: ".github/FUNDING.yml" }), + await take(inputFromFile, { filePath: ".github/FUNDING.yaml" }), ) ?.split(":")[1] ?.trim(); From a5ab95d478df4e188cd7cc2a743e505b3e900c3e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 5 Dec 2025 08:37:49 -0500 Subject: [PATCH 3/3] Updated test snapshot processing too --- docs/FAQs.md | 2 +- src/blocks/blockCodecov.test.ts | 4 ++-- src/blocks/blockGitHubActionsCI.test.ts | 4 ++-- src/integration.test.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/FAQs.md b/docs/FAQs.md index 863272431..b9ee4a9a1 100644 --- a/docs/FAQs.md +++ b/docs/FAQs.md @@ -26,7 +26,7 @@ As a consequence we should:
.github/workflows/build.yaml - ```yml + ```yaml jobs: build: runs-on: ubuntu-latest diff --git a/src/blocks/blockCodecov.test.ts b/src/blocks/blockCodecov.test.ts index 70c715e46..6ccb3555c 100644 --- a/src/blocks/blockCodecov.test.ts +++ b/src/blocks/blockCodecov.test.ts @@ -178,12 +178,12 @@ describe("blockCodecov", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when ci.yaml contains invalid yml", () => { + it("returns undefined when ci.yaml contains invalid YAML", () => { const actual = testIntake(blockCodecov, { files: { ".github": { workflows: { - "ci.yaml": ["invalid yml!"], + "ci.yaml": ["invalid YAML!"], }, }, }, diff --git a/src/blocks/blockGitHubActionsCI.test.ts b/src/blocks/blockGitHubActionsCI.test.ts index 38020e08d..34dbbf62f 100644 --- a/src/blocks/blockGitHubActionsCI.test.ts +++ b/src/blocks/blockGitHubActionsCI.test.ts @@ -426,13 +426,13 @@ describe("blockGitHubActionsCI", () => { expect(actual).toBeUndefined(); }); - it("returns undefined when action.yaml contains invalid yml", () => { + it("returns undefined when action.yaml contains invalid YAML", () => { const actual = testIntake(blockGitHubActionsCI, { files: { ".github": { actions: { prepare: { - "action.yaml": ["invalid yml!"], + "action.yaml": ["invalid YAML!"], }, }, }, diff --git a/src/integration.test.ts b/src/integration.test.ts index 4d084dd58..91e9236a0 100644 --- a/src/integration.test.ts +++ b/src/integration.test.ts @@ -136,7 +136,7 @@ If you're interested in learning more, see the 'getting started' docs on: }); const processText = (text: string, filePath: string) => - /all-contributorsrc|js|md|ts|yml/.test(filePath) + /all-contributorsrc|js|md|ts|yaml/.test(filePath) ? prettier.format(text, { filepath: filePath, useTabs: true }) : text;