-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(remix-dev/cli): add DX improvements for migrate
command & replace-remix-imports
migration
#2670
Conversation
migrate
command and replace-remix-imports
migration
migrate
command and replace-remix-imports
migrationmigrate
command & replace-remix-imports
migration
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
25560fb
to
65067c9
Compare
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
1829eb3
to
58267dc
Compare
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/getTransformOptions.ts
Outdated
Show resolved
Hide resolved
I ran it on a couple apps, works great! |
6d93edd
to
db33d4b
Compare
I added types for Blocked on this^ |
@pcattori I had the same problem when I was first using I created DefinitelyTyped/DefinitelyTyped#59806, so this PR isn't blocked anymore and we can investigate the root cause later. |
@MichaelDeBoey I've incorporated the feedback from your PR into this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Just a few small things.
@@ -0,0 +1,205 @@ | |||
name: 🚀 Deploy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove unnecessary files from the fixtures? I worry that including them will cause confusion and issues in the future when people are doing a big find/replace sort of thing in the codebase and they come across files like this and spend extra time to make sure they make proper changes when it actually doesn't even matter.
So let's include only the files that can justify their existence in the fixture (which is to say that most of the files here should probably be deleted or, at the very least, drastically simplified).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed a ton of files. Let me know if you think there's still too much cruft left in here.
}; | ||
|
||
describe("`replace-remix-imports` migration", () => { | ||
it("runs successfully", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a couple assertions in here that look for the text from "remix"
and ensures it no longer exists in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And perhaps we could run the build
script in the fixture after the migration to make sure imports can be resolved properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added checks that from "remix"
is purged from the app post-migration.
As for running build
, adding npm install
and npm run build
to the test makes the test go from sub-second to more than 1 minute on my machine (M1 Max) and becomes network dependent. I think I prefer leaving out the build
check and keeping this test lean. What do you think @kentcdodds ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, definitely don't want it to be network dependent 👍 We could probably simplify the app further (remove all the deps and stuff and make remix reference the local remix), but that's more work than it's worth. This is enough 👍
packages/remix-dev/cli/migrate/migrations/replace-remix-imports/index.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…ts in transformations by design, transformations have a default export for compatibility with jscodeshift. but we also want to share code from transforms, necessitating named exports.
…hem to do post-migration steps also, improved DX by clearly delineating separate migration sections
…emix-imports` migration
…ce-remix-imports`
… migration inputs
… blog tutorial example
once DefinitelyTyped/DefinitelyTyped#59806 is merged, we can install `@types/@npmcli/package-json` instead
… a dev dependency
…ansform because jscodeshift does not have full typescript support for transforms
213415d
to
6963bcb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Lots here that should hopefully help in future code transformations we will inevitably need to make 👍 Thanks!
}; | ||
|
||
describe("`replace-remix-imports` migration", () => { | ||
it("runs successfully", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, definitely don't want it to be network dependent 👍 We could probably simplify the app further (remove all the deps and stuff and make remix reference the local remix), but that's more work than it's worth. This is enough 👍
Migration should guide the user through 3 steps:
remix
package with@remix-run/*
packages.remix setup
from thepostinstall
scriptimport {...} from "remix"
withimport {...} from "@remix-run/{some package}"
Try it!
git fetch origin # or whatever you call remix-run/remix git checkout pedro/fix-migrate yarn build node ./build/node_modules/@remix-run/dev/cli.js migrate
Example