From 35c679b79cb1252f6eeab32b318f51cf9e6f00e5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 16 Jan 2024 15:17:40 -0500 Subject: [PATCH 1/2] fix: rimraf coverage directories in --mode migrate --- package.json | 1 + pnpm-lock.yaml | 11 ++++ src/create/createWithOptions.test.ts | 2 +- src/create/createWithOptions.ts | 11 +--- src/initialize/initializeWithOptions.ts | 10 +--- src/migrate/migrateWithOptions.ts | 11 +--- src/shared/createCleanUpFilesCommands.ts | 18 ------- ...runCommands.test.ts => runCleanup.test.ts} | 2 +- src/steps/runCleanup.ts | 51 +++++++++++++++++++ src/steps/runCommands.ts | 35 ------------- 10 files changed, 71 insertions(+), 81 deletions(-) delete mode 100644 src/shared/createCleanUpFilesCommands.ts rename src/steps/{runCommands.test.ts => runCleanup.test.ts} (97%) create mode 100644 src/steps/runCleanup.ts delete mode 100644 src/steps/runCommands.ts diff --git a/package.json b/package.json index 31d825356..4efdab8e8 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "prettier-plugin-curly": "^0.1.3", "prettier-plugin-packagejson": "^2.4.7", "release-it": "^17.0.0", + "rimraf": "^5.0.5", "sentences-per-line": "^0.2.1", "should-semantic-release": "^0.2.1", "tsup": "^8.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6b7bb83d8..8ebbc1347 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -169,6 +169,9 @@ devDependencies: release-it: specifier: ^17.0.0 version: 17.0.0(typescript@5.3.3) + rimraf: + specifier: ^5.0.5 + version: 5.0.5 sentences-per-line: specifier: ^0.2.1 version: 0.2.1 @@ -6922,6 +6925,14 @@ packages: glob: 7.2.3 dev: true + /rimraf@5.0.5: + resolution: {integrity: sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==} + engines: {node: '>=14'} + hasBin: true + dependencies: + glob: 10.3.10 + dev: true + /rollup@4.5.1: resolution: {integrity: sha512-0EQribZoPKpb5z1NW/QYm3XSR//Xr8BeEXU49Lc/mQmpmVVG5jPUVrpc2iptup/0WMrY9mzas0fxH+TjYvG2CA==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} diff --git a/src/create/createWithOptions.test.ts b/src/create/createWithOptions.test.ts index d11b7ad8c..5f2f3d694 100644 --- a/src/create/createWithOptions.test.ts +++ b/src/create/createWithOptions.test.ts @@ -8,7 +8,7 @@ import { addToolAllContributors } from "../steps/addToolAllContributors.js"; import { finalizeDependencies } from "../steps/finalizeDependencies.js"; import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js"; import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js"; -import { runCommands } from "../steps/runCommands.js"; +import { runCommands } from "../steps/runCleanup.js"; import { createWithOptions } from "./createWithOptions.js"; const optionsBase: Options = { diff --git a/src/create/createWithOptions.ts b/src/create/createWithOptions.ts index 9351c2064..f70b02fad 100644 --- a/src/create/createWithOptions.ts +++ b/src/create/createWithOptions.ts @@ -1,14 +1,13 @@ import { $ } from "execa"; import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; -import { createCleanUpFilesCommands } from "../shared/createCleanUpFilesCommands.js"; import { doesRepositoryExist } from "../shared/doesRepositoryExist.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { addToolAllContributors } from "../steps/addToolAllContributors.js"; import { finalizeDependencies } from "../steps/finalizeDependencies.js"; import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js"; import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js"; -import { runCommands } from "../steps/runCommands.js"; +import { runCleanup } from "../steps/runCleanup.js"; import { writeReadme } from "../steps/writeReadme/index.js"; import { writeStructure } from "../steps/writing/writeStructure.js"; @@ -46,13 +45,7 @@ export async function createWithOptions({ github, options }: GitHubAndOptions) { ); } - await runCommands( - "Cleaning up files", - createCleanUpFilesCommands({ - bin: !!options.bin, - dedupe: true, - }), - ); + await runCleanup(options); } const sendToGitHub = diff --git a/src/initialize/initializeWithOptions.ts b/src/initialize/initializeWithOptions.ts index 127fb6b14..a54ea6115 100644 --- a/src/initialize/initializeWithOptions.ts +++ b/src/initialize/initializeWithOptions.ts @@ -1,12 +1,11 @@ import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; -import { createCleanUpFilesCommands } from "../shared/createCleanUpFilesCommands.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { addOwnerAsAllContributor } from "../steps/addOwnerAsAllContributor.js"; import { clearChangelog } from "../steps/clearChangelog.js"; import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js"; import { removeSetupScripts } from "../steps/removeSetupScripts.js"; import { resetGitTags } from "../steps/resetGitTags.js"; -import { runCommands } from "../steps/runCommands.js"; +import { runCleanup } from "../steps/runCleanup.js"; import { uninstallPackages } from "../steps/uninstallPackages.js"; import { updateAllContributorsTable } from "../steps/updateAllContributorsTable.js"; import { updateLocalFiles } from "../steps/updateLocalFiles.js"; @@ -61,10 +60,5 @@ export async function initializeWithOptions({ ); } - await runCommands( - "Cleaning up files", - createCleanUpFilesCommands({ - bin: !!options.bin, - }), - ); + await runCleanup(options); } diff --git a/src/migrate/migrateWithOptions.ts b/src/migrate/migrateWithOptions.ts index 05b128ace..1ea6a1831 100644 --- a/src/migrate/migrateWithOptions.ts +++ b/src/migrate/migrateWithOptions.ts @@ -1,12 +1,11 @@ import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; -import { createCleanUpFilesCommands } from "../shared/createCleanUpFilesCommands.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { clearUnnecessaryFiles } from "../steps/clearUnnecessaryFiles.js"; import { detectExistingContributors } from "../steps/detectExistingContributors.js"; import { finalizeDependencies } from "../steps/finalizeDependencies.js"; import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js"; import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js"; -import { runCommands } from "../steps/runCommands.js"; +import { runCleanup } from "../steps/runCleanup.js"; import { updateAllContributorsTable } from "../steps/updateAllContributorsTable.js"; import { updateLocalFiles } from "../steps/updateLocalFiles.js"; import { writeReadme } from "../steps/writeReadme/index.js"; @@ -66,11 +65,5 @@ export async function migrateWithOptions({ await withSpinner("Populating CSpell dictionary", populateCSpellDictionary); } - await runCommands( - "Cleaning up files", - createCleanUpFilesCommands({ - bin: !!options.bin, - dedupe: true, - }), - ); + await runCleanup(options); } diff --git a/src/shared/createCleanUpFilesCommands.ts b/src/shared/createCleanUpFilesCommands.ts deleted file mode 100644 index b10eecfd9..000000000 --- a/src/shared/createCleanUpFilesCommands.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface CleanUpFilesOptions { - bin?: boolean; - dedupe?: boolean; -} - -export function createCleanUpFilesCommands({ - bin, - dedupe, -}: CleanUpFilesOptions) { - return [ - // There's no need to dedupe when initializing from the fixed template - ...(dedupe ? ["pnpm dedupe"] : []), - // n/no-missing-import rightfully reports on a missing the bin .js file - ...(bin ? ["pnpm build"] : []), - "pnpm lint --fix", - "pnpm format --write", - ]; -} diff --git a/src/steps/runCommands.test.ts b/src/steps/runCleanup.test.ts similarity index 97% rename from src/steps/runCommands.test.ts rename to src/steps/runCleanup.test.ts index 90ffd6eac..2d0c0f3ca 100644 --- a/src/steps/runCommands.test.ts +++ b/src/steps/runCleanup.test.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import { describe, expect, it, vi } from "vitest"; -import { runCommands } from "./runCommands.js"; +import { runCommands } from "./runCleanup.js"; const mockExecaCommand = vi.fn().mockRejectedValue("Oh no!"); diff --git a/src/steps/runCleanup.ts b/src/steps/runCleanup.ts new file mode 100644 index 000000000..7a5788373 --- /dev/null +++ b/src/steps/runCleanup.ts @@ -0,0 +1,51 @@ +import chalk from "chalk"; +import { execaCommand } from "execa"; +import { rimraf } from "rimraf"; + +import { logLine } from "../shared/cli/lines.js"; +import { withSpinner } from "../shared/cli/spinners.js"; +import { Options } from "../shared/types.js"; + +export async function runCleanup({ bin, mode }: Pick) { + const failed: string[] = []; + const commands = [ + // There's no need to dedupe when initializing from the fixed template + ...(mode === "initialize" ? [] : ["pnpm dedupe"]), + // n/no-missing-import rightfully reports on a missing the bin .js file + ...(bin ? ["pnpm build"] : []), + "pnpm lint --fix", + "pnpm format --write", + ]; + + await withSpinner("Cleaning up files", async () => { + if (mode === "migrate") { + // Coverage folders can slow down format and lint times something awful. + // https://github.com/JoshuaKGoldberg/create-typescript-app/issues/1221 + await rimraf("coverage*"); + } + + for (const command of commands) { + try { + await execaCommand(command); + } catch { + failed.push(command); + } + } + }); + + if (!failed.length) { + return; + } + + logLine(); + + for (const command of failed) { + logLine( + [ + chalk.yellow(`🟡 Running \``), + chalk.yellowBright(command), + chalk.yellow(`\` failed. You should run it and fix its complaints.`), + ].join(""), + ); + } +} diff --git a/src/steps/runCommands.ts b/src/steps/runCommands.ts deleted file mode 100644 index 328e57a9d..000000000 --- a/src/steps/runCommands.ts +++ /dev/null @@ -1,35 +0,0 @@ -import chalk from "chalk"; -import { execaCommand } from "execa"; - -import { logLine } from "../shared/cli/lines.js"; -import { withSpinner } from "../shared/cli/spinners.js"; - -export async function runCommands(label: string, commands: string[]) { - const failed: string[] = []; - - await withSpinner(label, async () => { - for (const command of commands) { - try { - await execaCommand(command); - } catch { - failed.push(command); - } - } - }); - - if (!failed.length) { - return; - } - - logLine(); - - for (const command of failed) { - logLine( - [ - chalk.yellow(`🟡 Running \``), - chalk.yellowBright(command), - chalk.yellow(`\` failed. You should run it and fix its complaints.`), - ].join(""), - ); - } -} From 714504143db5ff326e1b5d5db4f9a324988f83a8 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 16 Jan 2024 15:33:59 -0500 Subject: [PATCH 2/2] Update tests and also clear before e2e tests --- script/create-test-e2e.js | 3 +- script/initialize-test-e2e.js | 3 ++ script/migrate-test-e2e.js | 3 ++ src/create/createWithOptions.test.ts | 12 ++++---- src/create/createWithOptions.ts | 3 +- src/initialize/initializeWithOptions.ts | 3 +- src/migrate/migrateWithOptions.ts | 3 +- src/shared/createCleanUpFilesCommands.test.ts | 25 ----------------- src/shared/createCleanupCommands.test.ts | 28 +++++++++++++++++++ src/shared/createCleanupCommands.ts | 15 ++++++++++ src/steps/runCleanup.test.ts | 10 +++---- src/steps/runCleanup.ts | 12 ++------ src/steps/uninstallPackages.ts | 1 + 13 files changed, 71 insertions(+), 50 deletions(-) delete mode 100644 src/shared/createCleanUpFilesCommands.test.ts create mode 100644 src/shared/createCleanupCommands.test.ts create mode 100644 src/shared/createCleanupCommands.ts diff --git a/script/create-test-e2e.js b/script/create-test-e2e.js index 0f41aa0e9..fa9429809 100644 --- a/script/create-test-e2e.js +++ b/script/create-test-e2e.js @@ -1,5 +1,6 @@ import { $, execaCommand } from "execa"; import { strict as assert } from "node:assert"; +import { rimraf } from "rimraf"; const author = "Test Author"; const description = "Test description."; @@ -8,7 +9,7 @@ const repository = "create-typescript-app"; const owner = "TestOwner"; const title = "Test Title"; -await $`rm -rf ${repository}`; +await rimraf(["coverage*", repository]); // Fist we run with --mode create to create a new new local repository, // asserting that pnpm i passes in that repository's directory. diff --git a/script/initialize-test-e2e.js b/script/initialize-test-e2e.js index 3f8e414d0..8d0354b07 100644 --- a/script/initialize-test-e2e.js +++ b/script/initialize-test-e2e.js @@ -2,12 +2,15 @@ import { $ } from "execa"; import { globby } from "globby"; import { strict as assert } from "node:assert"; import * as fs from "node:fs/promises"; +import { rimraf } from "rimraf"; const description = "New Description Test"; const owner = "RNR1"; const title = "New Title Test"; const repository = "new-repository-test"; +await rimraf("coverage*"); + // Fist we run with --mode initialize to modify the local repository files, // asserting that the created package.json keeps the general description. await $({ diff --git a/script/migrate-test-e2e.js b/script/migrate-test-e2e.js index cce4aa4fd..cac41a4a3 100644 --- a/script/migrate-test-e2e.js +++ b/script/migrate-test-e2e.js @@ -1,6 +1,7 @@ import chalk from "chalk"; import { $, execaCommand } from "execa"; import * as fs from "node:fs/promises"; +import { rimraf } from "rimraf"; import { assert, describe, expect, test } from "vitest"; import packageData from "../package.json" assert { type: "json" }; @@ -37,6 +38,8 @@ const logoAlt = `Project logo: the TypeScript blue square with rounded corners, const owner = "JoshuaKGoldberg"; const title = "Create TypeScript App"; +await rimraf("coverage*"); + const originalReadme = (await fs.readFile("README.md")).toString(); const originalSnapshots = ( diff --git a/src/create/createWithOptions.test.ts b/src/create/createWithOptions.test.ts index 5f2f3d694..6e7156a60 100644 --- a/src/create/createWithOptions.test.ts +++ b/src/create/createWithOptions.test.ts @@ -8,7 +8,7 @@ import { addToolAllContributors } from "../steps/addToolAllContributors.js"; import { finalizeDependencies } from "../steps/finalizeDependencies.js"; import { initializeGitHubRepository } from "../steps/initializeGitHubRepository/index.js"; import { populateCSpellDictionary } from "../steps/populateCSpellDictionary.js"; -import { runCommands } from "../steps/runCleanup.js"; +import { runCleanup } from "../steps/runCleanup.js"; import { createWithOptions } from "./createWithOptions.js"; const optionsBase: Options = { @@ -63,7 +63,7 @@ vi.mock("../steps/finalizeDependencies.js"); vi.mock("../steps/populateCSpellDictionary.js"); -vi.mock("../steps/runCommands.js"); +vi.mock("../steps/runCleanup.js"); vi.mock("../shared/doesRepositoryExist.js", () => ({ doesRepositoryExist: vi.fn().mockResolvedValue(true), @@ -114,7 +114,7 @@ describe("createWithOptions", () => { expect(addToolAllContributors).not.toHaveBeenCalled(); }); - it("does not call finalizeDependencies, populateCSpellDictionary, or runCommands when skipInstall is true", async () => { + it("does not call finalizeDependencies, populateCSpellDictionary, or runCleanup when skipInstall is true", async () => { const options = { ...optionsBase, skipInstall: true, @@ -123,10 +123,10 @@ describe("createWithOptions", () => { await createWithOptions({ github, options }); expect(finalizeDependencies).not.toHaveBeenCalled(); expect(populateCSpellDictionary).not.toHaveBeenCalled(); - expect(runCommands).not.toHaveBeenCalled(); + expect(runCleanup).not.toHaveBeenCalled(); }); - it("calls finalizeDependencies, populateCSpellDictionary, and runCommands when skipInstall is false", async () => { + it("calls finalizeDependencies, populateCSpellDictionary, and runCleanup when skipInstall is false", async () => { const options = { ...optionsBase, skipInstall: false, @@ -136,7 +136,7 @@ describe("createWithOptions", () => { expect(finalizeDependencies).toHaveBeenCalledWith(options); expect(populateCSpellDictionary).toHaveBeenCalled(); - expect(runCommands).toHaveBeenCalled(); + expect(runCleanup).toHaveBeenCalled(); }); it("does not initialize GitHub repository if repository does not exist", async () => { diff --git a/src/create/createWithOptions.ts b/src/create/createWithOptions.ts index f70b02fad..c8a9fd99b 100644 --- a/src/create/createWithOptions.ts +++ b/src/create/createWithOptions.ts @@ -1,6 +1,7 @@ import { $ } from "execa"; import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; +import { createCleanupCommands } from "../shared/createCleanupCommands.js"; import { doesRepositoryExist } from "../shared/doesRepositoryExist.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { addToolAllContributors } from "../steps/addToolAllContributors.js"; @@ -45,7 +46,7 @@ export async function createWithOptions({ github, options }: GitHubAndOptions) { ); } - await runCleanup(options); + await runCleanup(createCleanupCommands(options), options.mode); } const sendToGitHub = diff --git a/src/initialize/initializeWithOptions.ts b/src/initialize/initializeWithOptions.ts index a54ea6115..73f6592e2 100644 --- a/src/initialize/initializeWithOptions.ts +++ b/src/initialize/initializeWithOptions.ts @@ -1,4 +1,5 @@ import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; +import { createCleanupCommands } from "../shared/createCleanupCommands.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { addOwnerAsAllContributor } from "../steps/addOwnerAsAllContributor.js"; import { clearChangelog } from "../steps/clearChangelog.js"; @@ -60,5 +61,5 @@ export async function initializeWithOptions({ ); } - await runCleanup(options); + await runCleanup(createCleanupCommands(options), options.mode); } diff --git a/src/migrate/migrateWithOptions.ts b/src/migrate/migrateWithOptions.ts index 1ea6a1831..27fa80cca 100644 --- a/src/migrate/migrateWithOptions.ts +++ b/src/migrate/migrateWithOptions.ts @@ -1,4 +1,5 @@ import { withSpinner, withSpinners } from "../shared/cli/spinners.js"; +import { createCleanupCommands } from "../shared/createCleanupCommands.js"; import { GitHubAndOptions } from "../shared/options/readOptions.js"; import { clearUnnecessaryFiles } from "../steps/clearUnnecessaryFiles.js"; import { detectExistingContributors } from "../steps/detectExistingContributors.js"; @@ -65,5 +66,5 @@ export async function migrateWithOptions({ await withSpinner("Populating CSpell dictionary", populateCSpellDictionary); } - await runCleanup(options); + await runCleanup(createCleanupCommands(options), options.mode); } diff --git a/src/shared/createCleanUpFilesCommands.test.ts b/src/shared/createCleanUpFilesCommands.test.ts deleted file mode 100644 index 9fbf4a756..000000000 --- a/src/shared/createCleanUpFilesCommands.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { describe, expect, it } from "vitest"; - -import { createCleanUpFilesCommands } from "./createCleanUpFilesCommands.js"; - -describe("createCleanUpFilesCommands", () => { - it("only lints and formats when no options are specified", () => { - const actual = createCleanUpFilesCommands({}); - - expect(actual).toEqual(["pnpm lint --fix", "pnpm format --write"]); - }); - - it("runs dedupe and build before it lints and formats when both options are specified", () => { - const actual = createCleanUpFilesCommands({ - bin: true, - dedupe: true, - }); - - expect(actual).toEqual([ - "pnpm dedupe", - "pnpm build", - "pnpm lint --fix", - "pnpm format --write", - ]); - }); -}); diff --git a/src/shared/createCleanupCommands.test.ts b/src/shared/createCleanupCommands.test.ts new file mode 100644 index 000000000..86454c689 --- /dev/null +++ b/src/shared/createCleanupCommands.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it } from "vitest"; + +import { createCleanupCommands } from "./createCleanupCommands.js"; + +describe("createCleanupCommands", () => { + it("only lints and formats when bin is not enabled and mode is initialize", () => { + const actual = createCleanupCommands({ + bin: undefined, + mode: "initialize", + }); + + expect(actual).toEqual(["pnpm lint --fix", "pnpm format --write"]); + }); + + it("runs dedupe and build before it lints and formats when bin is enabled and mode is create", () => { + const actual = createCleanupCommands({ + bin: "bin/index.js", + mode: "create", + }); + + expect(actual).toEqual([ + "pnpm dedupe", + "pnpm build", + "pnpm lint --fix", + "pnpm format --write", + ]); + }); +}); diff --git a/src/shared/createCleanupCommands.ts b/src/shared/createCleanupCommands.ts new file mode 100644 index 000000000..21b5aa0fa --- /dev/null +++ b/src/shared/createCleanupCommands.ts @@ -0,0 +1,15 @@ +import { Options } from "./types.js"; + +export function createCleanupCommands({ + bin, + mode, +}: Pick) { + return [ + // There's no need to dedupe when initializing from the fixed template + ...(mode === "initialize" ? [] : ["pnpm dedupe"]), + // n/no-missing-import rightfully reports on a missing the bin .js file + ...(bin ? ["pnpm build"] : []), + "pnpm lint --fix", + "pnpm format --write", + ]; +} diff --git a/src/steps/runCleanup.test.ts b/src/steps/runCleanup.test.ts index 2d0c0f3ca..70cc1fe4c 100644 --- a/src/steps/runCleanup.test.ts +++ b/src/steps/runCleanup.test.ts @@ -1,7 +1,7 @@ import chalk from "chalk"; import { describe, expect, it, vi } from "vitest"; -import { runCommands } from "./runCleanup.js"; +import { runCleanup } from "./runCleanup.js"; const mockExecaCommand = vi.fn().mockRejectedValue("Oh no!"); @@ -23,11 +23,11 @@ vi.mock("../shared/cli/spinners.js", () => ({ withSpinner: vi.fn((_label: string, callback: () => unknown) => callback()), })); -describe("runCommands", () => { +describe("runCleanup", () => { it("does not log when the commands all succeed", async () => { mockExecaCommand.mockResolvedValue(undefined); - await runCommands("label", ["first", "second"]); + await runCleanup(["first", "second"], "create"); expect(mockLogLine).not.toHaveBeenCalled(); }); @@ -37,7 +37,7 @@ describe("runCommands", () => { .mockRejectedValueOnce(new Error("Oh no!")) .mockResolvedValue(undefined); - await runCommands("label", ["first", "second"]); + await runCleanup(["first", "second"], "create"); expect(mockLogLine).toHaveBeenCalledWith( [ @@ -51,7 +51,7 @@ describe("runCommands", () => { it("logs twice when two commands fail", async () => { mockExecaCommand.mockRejectedValue(new Error("Oh no!")); - await runCommands("label", ["first", "second"]); + await runCleanup(["first", "second"], "create"); expect(mockLogLine).toHaveBeenCalledWith( [ diff --git a/src/steps/runCleanup.ts b/src/steps/runCleanup.ts index 7a5788373..79e441353 100644 --- a/src/steps/runCleanup.ts +++ b/src/steps/runCleanup.ts @@ -4,18 +4,10 @@ import { rimraf } from "rimraf"; import { logLine } from "../shared/cli/lines.js"; import { withSpinner } from "../shared/cli/spinners.js"; -import { Options } from "../shared/types.js"; +import { Mode } from "../shared/types.js"; -export async function runCleanup({ bin, mode }: Pick) { +export async function runCleanup(commands: string[], mode: Mode) { const failed: string[] = []; - const commands = [ - // There's no need to dedupe when initializing from the fixed template - ...(mode === "initialize" ? [] : ["pnpm dedupe"]), - // n/no-missing-import rightfully reports on a missing the bin .js file - ...(bin ? ["pnpm build"] : []), - "pnpm lint --fix", - "pnpm format --write", - ]; await withSpinner("Cleaning up files", async () => { if (mode === "migrate") { diff --git a/src/steps/uninstallPackages.ts b/src/steps/uninstallPackages.ts index 3aca08fa3..44d625009 100644 --- a/src/steps/uninstallPackages.ts +++ b/src/steps/uninstallPackages.ts @@ -38,6 +38,7 @@ export async function uninstallPackages(offline: boolean | undefined) { "c8", "eslint-config-prettier", "globby", + "rimraf", "tsx", ], packageData.devDependencies,