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!(v2): remove codemod #6918

Merged
merged 1 commit into from
Jul 21, 2023
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
5 changes: 5 additions & 0 deletions .changeset/stupid-emus-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": major
---

remove codemod command
4 changes: 0 additions & 4 deletions packages/remix-dev/__tests__/cli-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe("remix CLI", () => {
$ remix routes [projectDir]
$ remix watch [projectDir]
$ remix setup [remixPlatform]
$ remix codemod <codemod> [projectDir]

Options:
--help, -h Print this help message and exit
Expand All @@ -111,9 +110,6 @@ describe("remix CLI", () => {
--no-delete Skip deleting the \`remix.init\` script
\`routes\` Options:
--json Print the routes as JSON
\`codemod\` Options:
--dry Dry run (no changes are made to files)
--force Bypass Git safety checks

Values:
- projectDir The Remix project directory
Expand Down
38 changes: 0 additions & 38 deletions packages/remix-dev/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import { readConfig } from "../config";
import { formatRoutes, RoutesFormat, isRoutesFormat } from "../config/format";
import { detectPackageManager } from "./detectPackageManager";
import { setupRemix, isSetupPlatform, SetupPlatform } from "./setup";
import runCodemod from "../codemod";
import { CodemodError } from "../codemod/utils/error";
import { TaskError } from "../codemod/utils/task";
import { transpile as convertFileToJS } from "./useJavascript";
import type { Options } from "../compiler/options";
import { createFileWatchCache } from "../compiler/fileWatchCache";
Expand Down Expand Up @@ -206,41 +203,6 @@ export async function dev(
await devServer_unstable.serve(config, resolved);
}

export async function codemod(
codemodName?: string,
projectDir?: string,
{ dry = false, force = false } = {}
) {
if (!codemodName) {
console.error(colors.red("Error: Missing codemod name"));
console.log(
"Usage: " +
colors.gray(
`remix codemod <${colors.arg("codemod")}> [${colors.arg(
"projectDir"
)}]`
)
);
process.exit(1);
}
try {
await runCodemod(projectDir ?? process.cwd(), codemodName, {
dry,
force,
});
} catch (error: unknown) {
if (error instanceof CodemodError) {
console.error(`${colors.red("Error:")} ${error.message}`);
if (error.additionalInfo) console.info(colors.gray(error.additionalInfo));
process.exit(1);
}
if (error instanceof TaskError) {
process.exit(1);
}
throw error;
}
}

let clientEntries = ["entry.client.tsx", "entry.client.js", "entry.client.jsx"];
let serverEntries = ["entry.server.tsx", "entry.server.js", "entry.server.jsx"];
let entries = ["entry.client", "entry.server"];
Expand Down
8 changes: 0 additions & 8 deletions packages/remix-dev/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
$ remix routes [${colors.arg("projectDir")}]
$ remix watch [${colors.arg("projectDir")}]
$ remix setup [${colors.arg("remixPlatform")}]
$ remix codemod <${colors.arg("codemod")}> [${colors.arg("projectDir")}]

${colors.heading("Options")}:
--help, -h Print this help message and exit
Expand All @@ -39,9 +38,6 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
--no-delete Skip deleting the \`remix.init\` script
\`routes\` Options:
--json Print the routes as JSON
\`codemod\` Options:
--dry Dry run (no changes are made to files)
--force Bypass Git safety checks

${colors.heading("Values")}:
- ${colors.arg("projectDir")} The Remix project directory
Expand Down Expand Up @@ -225,10 +221,6 @@ export async function run(argv: string[] = process.argv.slice(2)) {
case "setup":
await commands.setup(input[1]);
break;
case "codemod": {
await commands.codemod(input[1], input[2]);
break;
}
case "reveal": {
// TODO: simplify getting started guide
await commands.generateEntry(input[1], input[2], flags.typescript);
Expand Down
6 changes: 0 additions & 6 deletions packages/remix-dev/codemod/codemod.ts

This file was deleted.

67 changes: 0 additions & 67 deletions packages/remix-dev/codemod/index.ts

This file was deleted.

14 changes: 0 additions & 14 deletions packages/remix-dev/codemod/utils/error.ts

This file was deleted.

29 changes: 0 additions & 29 deletions packages/remix-dev/codemod/utils/git.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/remix-dev/codemod/utils/log.ts

This file was deleted.

26 changes: 0 additions & 26 deletions packages/remix-dev/codemod/utils/task.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/remix-dev/compiler/plugins/deprecatedRemixPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ export function deprecatedRemixPackagePlugin(ctx: Context): Plugin {
ctx.logger.warn(`deprecated \`remix\` import in ${relativePath}`, {
details: [
"Imports from the `remix` package were deprecated in v1.3.3.",
"Change your code to import from the appropriate `@remix-run/*` package instead.",
"You can run the following codemod to autofix this issue:",
"-> `npx @remix-run/dev@latest codemod replace-remix-magic-imports`",
],
key: importer,
});
Expand Down