-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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/migrate): add convert-to-javascript
migration
#3150
feat(remix-dev/cli/migrate): add convert-to-javascript
migration
#3150
Conversation
packages/remix-dev/cli/migrate/migrations/convert-to-javascript/index.ts
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/convert-to-javascript/index.ts
Show resolved
Hide resolved
7e02d37
to
6832f06
Compare
packages/remix-dev/cli/migrate/migrations/convert-to-javascript/index.ts
Outdated
Show resolved
Hide resolved
6832f06
to
b1d17a0
Compare
b1d17a0
to
83e4006
Compare
83e4006
to
7fdc365
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 looking good!
packages/remix-dev/__tests__/migrations/fixtures/indie-stack/.gitpod.yml
Outdated
Show resolved
Hide resolved
packages/remix-dev/cli/migrate/migrations/convert-to-javascript/index.ts
Outdated
Show resolved
Hide resolved
7fdc365
to
f82a697
Compare
d0160db
to
5c04ce1
Compare
I think we want to remove as much as possible without reducing the level of confidence that the feature works. I should write a blog post about this, but it's related to what I talk about here: https://kcd.im/aha-testing. Most of those routes don't need to be there for example. Let's reduce it down to as little as possible please. Thanks! |
5c04ce1
to
c35e39f
Compare
Kept the index route from the templates in |
c35e39f
to
312da08
Compare
@MichaelDeBoey : Organizationally, this doesn't fit into But |
@pcattori I can't think of another/better name tbh. I wouldn't say migrations are only for updating The idea came from a codemod kind of view and because we were doing more than only changing code, it made sense to rename it to |
71cf6f8
to
1356691
Compare
I've asked @chaance to work on moving stuff out of the CLI this week (including the migrations stuff). We'll still keep the option, but we're going to move the code into a separate package (which the CLI would basically run I think this could probably go into that package when he's gotten that set up. I'll ping Chance about this so he's aware that the package he's working on may be for more than just "migrations." It's more for "one-time-scripts" generally. Maybe it could be called |
Once the refactor is finished, I'm happy to rebase my PR & move files accordingly. On the naming part: |
FWIW, there's Also, people won't be interfacing with |
24afe9e
to
300b65a
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.
I'm not super familiar (or at all 🙈 actually) with jscodeshift, but this LGTM
8e7765f
to
61d4aff
Compare
I'm sorry I haven't had a chance to review this PR yet. We're going to need to hold off for a little while longer while we decide some stuff on the scripts package. |
61d4aff
to
341d238
Compare
341d238
to
1013c25
Compare
We decided to wait on the scripts package. Reviewing now. |
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 looks good to me 👍 Thank you for working on this!
@chaance, when the next release goes out, let's add this to the release notes for this one:
|
@kentcdodds I think you meant "not to wait..."? 🙈
This is not correct though. The move in the CLI will happen in a follow-up PR, as I didn't want to clutter this PR to much and really keep it focussed on the migration itself. |
Correct on both counts 😅 thanks @MichaelDeBoey |
@kentcdodds This migration will be internally used once #3529 is merged |
🤖 Hello there, We just published version Thanks! |
When working on supporting the
isTypeScript
variable inremix.init
in our default stacks (see remix-run/indie-stack#63, remix-run/blues-stack#57 & remix-run/grunge-stack#50), I needed a way to transform all import statements in files outside theapp
folder fromto
As discussed with @kentcdodds & @mcansh, it would be a good idea to do this transform for all stacks, so we came to the conclusion that we should have something inside the
@remix-run/dev
package for that.We're currently already have a
convertTemplateToJavaScript
function, that's used in ourcreate
commandremix/packages/remix-dev/cli/create.ts
Lines 206 to 208 in 4675aef
but as it's name says, that's only converting all files from TS to JS (which in practice is just removing all type-related things and leave the rest of the code as-is).
remix/packages/remix-dev/cli/convert-to-javascript.ts
Lines 16 to 23 in 4675aef
This PR will add the necessary changes to the import statements in all files outside the
app
folder.I took the liberty to also include @mcansh's changes to
convertTemplateToJavaScript
from #3012, as these are also some changes that all stacks could benefit from.To see how this transform works, you can watch it on AST explorer.
I'll create a follow-up PR to remove the
convertTemplateToJavaScript
function from thecreate
command & replace it by this new migration.