Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use remove-dependencies in blockTSup and blockVitest #1892

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"parse-package-name": "^1.0.0",
"populate-all-contributors-for-repository": "^0.1.2",
"prettier": "^3.4.2",
"remove-dependencies": "^0.1.0",
"remove-undefined-objects": "^5.0.0",
"replace-in-file": "^8.3.0",
"rimraf": "^6.0.1",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/next/blocks/blockTSup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ describe("blockTSup", () => {
",
},
"scripts": [
{
"commands": [
"node path/to/remove-dependencies/bin/index.js @babel/core babel",
],
"phase": 3,
},
{
"commands": [
"rm -rf .babelrc* babel.config.* dist lib",
Expand Down
12 changes: 12 additions & 0 deletions src/next/blocks/blockTSup.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { vi } from "vitest";
import { z } from "zod";

import { base } from "../base.js";
import { resolveBin } from "../utils/resolveBin.js";
import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
import { blockESLint } from "./blockESLint.js";
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js";
import { blockPackageJson } from "./blockPackageJson.js";
import { getPackageDependencies } from "./packageData.js";
import { CommandPhase } from "./phases.js";

vi.mock("../utils/resolveBin.js", () => ({
resolveBin: (bin: string) => `path/to/${bin}`,
}));

export const blockTSup = base.createBlock({
about: {
name: "tsup",
Expand All @@ -19,6 +25,12 @@ export const blockTSup = base.createBlock({
migrate() {
return {
scripts: [
{
commands: [
`node ${resolveBin("remove-dependencies/bin/index.js")} @babel/core babel`,
],
phase: CommandPhase.Process,
},
{
commands: ["rm -rf .babelrc* babel.config.* dist lib"],
phase: CommandPhase.Migrations,
Expand Down
12 changes: 11 additions & 1 deletion src/next/blocks/blockVitest.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { testBlock } from "create-testers";
import { describe, expect, test } from "vitest";
import { describe, expect, test, vi } from "vitest";

import { blockVitest } from "./blockVitest.js";
import { optionsBase } from "./options.fakes.js";

vi.mock("../utils/resolveBin.js", () => ({
resolveBin: (bin: string) => `path/to/${bin}`,
}));

describe("blockVitest", () => {
test("without addons or mode", () => {
const creation = testBlock(blockVitest, {
Expand Down Expand Up @@ -467,6 +471,12 @@ describe("blockVitest", () => {
",
},
"scripts": [
{
"commands": [
"node path/to/remove-dependencies/bin/index.js eslint-plugin-jest eslint-plugin-mocha eslint-plugin-vitest jest mocha",
],
"phase": 3,
},
{
"commands": [
"rm .mocha* jest.config.* vitest.config.*",
Expand Down
7 changes: 7 additions & 0 deletions src/next/blocks/blockVitest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from "zod";

import { base } from "../base.js";
import { resolveBin } from "../utils/resolveBin.js";
import { blockCSpell } from "./blockCSpell.js";
import { blockDevelopmentDocs } from "./blockDevelopmentDocs.js";
import { blockESLint } from "./blockESLint.js";
Expand Down Expand Up @@ -32,6 +33,12 @@ export const blockVitest = base.createBlock({
migrate() {
return {
scripts: [
{
commands: [
`node ${resolveBin("remove-dependencies/bin/index.js")} eslint-plugin-jest eslint-plugin-mocha eslint-plugin-vitest jest mocha`,
],
phase: CommandPhase.Process,
},
{
commands: ["rm .mocha* jest.config.* vitest.config.*"],
phase: CommandPhase.Migrations,
Expand Down
1 change: 1 addition & 0 deletions src/steps/uninstallPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export async function uninstallPackages(offline: boolean | undefined) {
"parse-package-name",
"populate-all-contributors-for-repository",
"prettier",
"remove-dependencies",
"remove-undefined-objects",
"replace-in-file",
"rimraf",
Expand Down
Loading