Skip to content

Commit 0e21342

Browse files
authoredMar 26, 2025··
feat: assorted transition mode removals (#2026)
## PR Checklist - [x] Addresses an existing open issue: * Fixes #1970 * Fixes #2017 * Fixes #2023 * Fixes #2024 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Creates a dedicated `blockRemoveWorkflows` alongside the existing dependencies and files removal blocks. 🎁
1 parent 018ba6f commit 0e21342

24 files changed

+701
-131
lines changed
 

‎src/blocks/blockCSpell.test.ts

+76-16
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ describe("blockCSpell", () => {
5151
],
5252
},
5353
],
54-
"removedWorkflows": [
55-
"lint-spelling",
56-
"spelling",
57-
],
5854
},
5955
"block": [Function],
6056
},
@@ -125,10 +121,6 @@ describe("blockCSpell", () => {
125121
],
126122
},
127123
],
128-
"removedWorkflows": [
129-
"lint-spelling",
130-
"spelling",
131-
],
132124
},
133125
"block": [Function],
134126
},
@@ -198,10 +190,6 @@ describe("blockCSpell", () => {
198190
],
199191
},
200192
],
201-
"removedWorkflows": [
202-
"lint-spelling",
203-
"spelling",
204-
],
205193
},
206194
"block": [Function],
207195
},
@@ -269,10 +257,6 @@ describe("blockCSpell", () => {
269257
],
270258
},
271259
],
272-
"removedWorkflows": [
273-
"lint-spelling",
274-
"spelling",
275-
],
276260
},
277261
"block": [Function],
278262
},
@@ -304,4 +288,80 @@ describe("blockCSpell", () => {
304288
}
305289
`);
306290
});
291+
292+
test("transition mode", () => {
293+
const creation = testBlock(blockCSpell, {
294+
mode: "transition",
295+
options: optionsBase,
296+
});
297+
298+
expect(creation).toMatchInlineSnapshot(`
299+
{
300+
"addons": [
301+
{
302+
"addons": {
303+
"sections": {
304+
"Linting": {
305+
"contents": {
306+
"items": [
307+
"- \`pnpm lint:spelling\` ([cspell](https://cspell.org)): Spell checks across all source files",
308+
],
309+
},
310+
},
311+
},
312+
},
313+
"block": [Function],
314+
},
315+
{
316+
"addons": {
317+
"extensions": [
318+
"streetsidesoftware.code-spell-checker",
319+
],
320+
},
321+
"block": [Function],
322+
},
323+
{
324+
"addons": {
325+
"jobs": [
326+
{
327+
"name": "Lint Spelling",
328+
"steps": [
329+
{
330+
"run": "pnpm lint:spelling",
331+
},
332+
],
333+
},
334+
],
335+
},
336+
"block": [Function],
337+
},
338+
{
339+
"addons": {
340+
"properties": {
341+
"devDependencies": {
342+
"cspell": "8.17.5",
343+
},
344+
"scripts": {
345+
"lint:spelling": "cspell "**" ".github/**/*"",
346+
},
347+
},
348+
},
349+
"block": [Function],
350+
},
351+
{
352+
"addons": {
353+
"workflows": [
354+
"lint-spelling",
355+
"spelling",
356+
],
357+
},
358+
"block": [Function],
359+
},
360+
],
361+
"files": {
362+
"cspell.json": "{"dictionaries":["npm","node","typescript"],"ignorePaths":[".github","CHANGELOG.md","lib","node_modules","pnpm-lock.yaml"]}",
363+
},
364+
}
365+
`);
366+
});
307367
});

‎src/blocks/blockCSpell.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { resolveBin } from "../utils/resolveBin.js";
77
import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
88
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
99
import { blockPackageJson } from "./blockPackageJson.js";
10+
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
1011
import { blockVSCode } from "./blockVSCode.js";
1112
import { CommandPhase } from "./phases.js";
1213

@@ -50,7 +51,6 @@ export const blockCSpell = base.createBlock({
5051
steps: [{ run: "pnpm lint:spelling" }],
5152
},
5253
],
53-
removedWorkflows: ["lint-spelling", "spelling"],
5454
}),
5555
blockPackageJson({
5656
properties: {
@@ -93,4 +93,13 @@ export const blockCSpell = base.createBlock({
9393
],
9494
};
9595
},
96+
transition() {
97+
return {
98+
addons: [
99+
blockRemoveWorkflows({
100+
workflows: ["lint-spelling", "spelling"],
101+
}),
102+
],
103+
};
104+
},
96105
});

‎src/blocks/blockESLint.test.ts

+9-16
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ describe("blockESLint", () => {
6161
],
6262
},
6363
],
64-
"removedWorkflows": [
65-
"eslint",
66-
"lint",
67-
],
6864
},
6965
"block": [Function],
7066
},
@@ -194,10 +190,6 @@ describe("blockESLint", () => {
194190
],
195191
},
196192
],
197-
"removedWorkflows": [
198-
"eslint",
199-
"lint",
200-
],
201193
},
202194
"block": [Function],
203195
},
@@ -271,6 +263,15 @@ describe("blockESLint", () => {
271263
},
272264
"block": [Function],
273265
},
266+
{
267+
"addons": {
268+
"workflows": [
269+
"eslint",
270+
"lint",
271+
],
272+
},
273+
"block": [Function],
274+
},
274275
],
275276
"files": {
276277
"eslint.config.js": "import eslint from "@eslint/js";
@@ -388,10 +389,6 @@ describe("blockESLint", () => {
388389
],
389390
},
390391
],
391-
"removedWorkflows": [
392-
"eslint",
393-
"lint",
394-
],
395392
},
396393
"block": [Function],
397394
},
@@ -538,10 +535,6 @@ describe("blockESLint", () => {
538535
],
539536
},
540537
],
541-
"removedWorkflows": [
542-
"eslint",
543-
"lint",
544-
],
545538
},
546539
"block": [Function],
547540
},

‎src/blocks/blockESLint.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
1111
import { blockPackageJson } from "./blockPackageJson.js";
1212
import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
1313
import { blockRemoveFiles } from "./blockRemoveFiles.js";
14+
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
1415
import { blockVSCode } from "./blockVSCode.js";
1516
import { CommandPhase } from "./phases.js";
1617

@@ -161,7 +162,6 @@ Each should be shown in VS Code, and can be run manually on the command-line:
161162
],
162163
},
163164
],
164-
removedWorkflows: ["eslint", "lint"],
165165
}),
166166
blockPackageJson({
167167
properties: {
@@ -239,6 +239,9 @@ export default tseslint.config(
239239
blockRemoveFiles({
240240
files: [".eslintrc*", ".eslintignore", "eslint.config.{cjs,mjs}"],
241241
}),
242+
blockRemoveWorkflows({
243+
workflows: ["eslint", "lint"],
244+
}),
242245
],
243246
};
244247
},

‎src/blocks/blockESLintPackageJson.test.ts

+49-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { blockESLintPackageJson } from "./blockESLintPackageJson.js";
55
import { optionsBase } from "./options.fakes.js";
66

77
describe("blockESLintPackageJson", () => {
8-
test("production", () => {
8+
test("without mode", () => {
99
const creation = testBlock(blockESLintPackageJson, {
1010
options: optionsBase,
1111
});
@@ -29,8 +29,38 @@ describe("blockESLintPackageJson", () => {
2929
},
3030
{
3131
"addons": {
32-
"removedWorkflows": [
33-
"lint-package-json",
32+
"properties": {
33+
"scripts": {
34+
"lint:package-json": undefined,
35+
},
36+
},
37+
},
38+
"block": [Function],
39+
},
40+
],
41+
}
42+
`);
43+
});
44+
45+
test("transition mode", () => {
46+
const creation = testBlock(blockESLintPackageJson, {
47+
mode: "transition",
48+
options: optionsBase,
49+
});
50+
51+
expect(creation).toMatchInlineSnapshot(`
52+
{
53+
"addons": [
54+
{
55+
"addons": {
56+
"extensions": [
57+
"packageJson.configs.recommended",
58+
],
59+
"imports": [
60+
{
61+
"source": "eslint-plugin-package-json",
62+
"specifier": "packageJson",
63+
},
3464
],
3565
},
3666
"block": [Function],
@@ -45,6 +75,14 @@ describe("blockESLintPackageJson", () => {
4575
},
4676
"block": [Function],
4777
},
78+
{
79+
"addons": {
80+
"files": [
81+
".npmpackagejsonlintrc*",
82+
],
83+
},
84+
"block": [Function],
85+
},
4886
{
4987
"addons": {
5088
"dependencies": [
@@ -54,6 +92,14 @@ describe("blockESLintPackageJson", () => {
5492
},
5593
"block": [Function],
5694
},
95+
{
96+
"addons": {
97+
"workflows": [
98+
"lint-package-json",
99+
],
100+
},
101+
"block": [Function],
102+
},
57103
],
58104
}
59105
`);

‎src/blocks/blockESLintPackageJson.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { base } from "../base.js";
22
import { blockESLint } from "./blockESLint.js";
3-
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
43
import { blockPackageJson } from "./blockPackageJson.js";
54
import { blockRemoveDependencies } from "./blockRemoveDependencies.js";
5+
import { blockRemoveFiles } from "./blockRemoveFiles.js";
6+
import { blockRemoveWorkflows } from "./blockRemoveWorkflows.js";
67

78
export const blockESLintPackageJson = base.createBlock({
89
about: {
@@ -20,22 +21,31 @@ export const blockESLintPackageJson = base.createBlock({
2021
},
2122
],
2223
}),
23-
blockGitHubActionsCI({
24-
removedWorkflows: ["lint-package-json"],
25-
}),
2624
blockPackageJson({
2725
properties: {
2826
scripts: {
2927
"lint:package-json": undefined,
3028
},
3129
},
3230
}),
31+
],
32+
};
33+
},
34+
transition() {
35+
return {
36+
addons: [
37+
blockRemoveFiles({
38+
files: [".npmpackagejsonlintrc*"],
39+
}),
3340
blockRemoveDependencies({
3441
dependencies: [
3542
"npm-package-json-lint",
3643
"npm-package-json-lint-config-default",
3744
],
3845
}),
46+
blockRemoveWorkflows({
47+
workflows: ["lint-package-json"],
48+
}),
3949
],
4050
};
4151
},

‎src/blocks/blockGitHubActionsCI.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const blockGitHubActionsCI = base.createBlock({
3232
}),
3333
)
3434
.optional(),
35-
removedWorkflows: z.array(z.string()).optional(),
3635
},
3736
produce({ addons, options }) {
3837
const { jobs } = addons;
@@ -145,18 +144,11 @@ export const blockGitHubActionsCI = base.createBlock({
145144
},
146145
};
147146
},
148-
transition({ addons }) {
149-
const { removedWorkflows = [] } = addons;
147+
transition() {
150148
return {
151149
addons: [
152150
blockRemoveFiles({
153-
files: [
154-
".circleci",
155-
"travis.yml",
156-
...removedWorkflows.map(
157-
(removedWorkflow) => `.github/workflows/${removedWorkflow}.yml`,
158-
),
159-
],
151+
files: [".circleci", "travis.yml"],
160152
}),
161153
],
162154
};

0 commit comments

Comments
 (0)
Please sign in to comment.