-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove MobX-State-Tree flag for non-demo projects #2647
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
Conversation
frankcalise
left a comment
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.
First pass, it's taking shape nice work!
| // TODO: full dryRun support | ||
|
|
||
| p() | ||
| p(`Removing MobX-State-Tree code from '${TARGET_DIR}'${dryRun ? " (dry run)" : ""}`) |
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.
What about a try/catch here and if running into any issues, let's warn the user the automated removal could not be completed and refer them to the recipe to do so manually?
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.
A suggestion: if we want to refer people to document officially, I think that document should be docs in Ignite, and not a cookbook recipe.
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.
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.
The main reason I say documentation and not a cookbook recipe was that the original intention of cookbook was it to have less obligation to keep it perfect and/or up-to-date (and therefore encourage contributions).
Linking to things officially from here makes it seem more like documentation, to me, which also implies it should continue to be tested with Ignite updates and stay accurate. Drawing a clear line on what we want to keep up-to-date and what's "this worked at one point" seems valuable to me.
Medium GAFO on this, definitely open to disagreement, but that's the thinking behind it.
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 going to leave as a Cookbook link for now for simplicity, but if we find that the cookbook recipe falls out of date or if we want to integrate the MobX Removal instructions into official Ignite docs in the future, we can make those changes separately
* feat: cng ftw * fix(babel-config): simplify plugins with SDK 50 * fix(boilerplate): remove unused eslint pkgs * fix(cli): reword workflow question * fix(cli): remove unnecessary warning
|
@Jpoliachik can you target this against |
* feat(boilerplate): mmkv in over async storage * fix(cli): remove async storage new arch specifics * test(boilerplate): mmkv clean up * fix(boilerplate): storage.load with just a string * test(boilerplate): storage test types
|
@frankcalise sure thing, I'll work on this early next week 👍 |
# Conflicts: # boilerplate/app/devtools/ReactotronConfig.ts # src/commands/new.ts
| // reactotron integration with the MST root store (DEV only) | ||
| if (__DEV__) { | ||
| // @ts-ignore | ||
| console.tron.trackMstNode(rootStore) |
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.
not sure why this wasn't needed before, but I was getting typescript errors without.
| result = sanitize(result) | ||
| } else { | ||
| result = updateFile(result, markupPrefix) | ||
| result = sanitize(result) |
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 don't know if this extra sanitize() was happening before - what behavior do we want here, I assumed we'd always want to get rid of all the markup regardless
# Conflicts: # boilerplate/app/devtools/ReactotronConfig.ts # boilerplate/package.json # src/commands/new.ts
src/commands/help.ts
Outdated
| ) | ||
| p() | ||
| command( | ||
| "remove-mst-markup (rmstm)", |
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.
From what I can tell, removal of MST, and removal of MST markup can only be done when generating a new project, since either way the markup won't exist after generation, right?
If that's the case, should we consider these commands "internal" and not document them here, since they can't be used by end users? Or at least add that information in to the docs for context.
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 good point - I was copying the pattern for removeDemo, but I suppose both cases wouldn't ever be usable outside of the new flow.
I'll remove the mst & mst-markup help commands - can you think of any reason to keep remove-demo and remove-demo-markup still? (maybe out of scope)
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 can't think of any reason, no, @frankcalise ?
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 think the reasoning was if you had an existing project where the markup wasn't removed (for the demo markup that is). We didn't always remove the markup out of the box.
That was probably around v8 though and fixed in or around some patch of 9 - we could probably look to remove it as never leaving mark up is what's current.
If we want to address the demo one as a separate PR that's fine
| // TODO: full dryRun support | ||
|
|
||
| p() | ||
| p(`Removing MobX-State-Tree code from '${TARGET_DIR}'${dryRun ? " (dry run)" : ""}`) |
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.
A suggestion: if we want to refer people to document officially, I think that document should be docs in Ignite, and not a cookbook recipe.
|
This is ready for additional review. As far as CLI documentation, I added the |
lindboe
left a comment
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.
LGTM, just a small conflict now after the v10 branch has been updated
Thanks for this! 🌟 🥳
# Conflicts: # boilerplate/app/app.tsx
# [10.0.0](v9.10.1...v10.0.0) (2024-10-14) ### Bug Fixes * **boilerplate:** expo-router initialize i18n ([#2791](#2791) by [@frankcalise](https://github.com/frankcalise)) ([a00113e](a00113e)) * **boilerplate:** Make icon default color explicit, and respond to dark mode ([#2795](#2795) by [@lindboe](https://github.com/lindboe)) ([b82398d](b82398d)) * **cli:** improper MST removal when using CLI prompt, new arch compat ([#2785](#2785) by [@frankcalise](https://github.com/frankcalise)) ([3956652](3956652)) * remove snackify command and references ([#2763](#2763) by [@frankcalise](https://github.com/frankcalise)) ([09671e8](09671e8)) ### Features * Ignite X with Expo 51 ([005ef05](005ef05)) * **boilerplate:** Toggle component refactored to Checkbox, Radio and Switch ([#2667](#2667) by [@frankcalise](https://github.com/frankcalise)) ([54f5208](54f5208)) * **cli:** expo-router option ([#2727](#2727) by [@frankcalise](https://github.com/frankcalise)) ([8bea1f9](8bea1f9)), closes [#2731](#2731) * **cli:** generator options --dir and --case ([#2726](#2726) by [@frankcalise](https://github.com/frankcalise)) ([dff3d24](dff3d24)) * **Theming:** Adds theming support with documentation. ([#2636](#2636)) ([a1ae047](a1ae047)) * **v10:** cng default ([#2641](#2641)) ([c7d998d](c7d998d)) * **v10:** Remove MobX-State-Tree flag for non-demo projects ([#2647](#2647) by @Jpoliachik) ([a738243](a738243)) * add MMKV for v10 ([#2660](#2660) by [@frankcalise](https://github.com/frankcalise)) ([9164e5e](9164e5e)) ### BREAKING CHANGES * Ignite X is out now! This update adds: * Expo Prebuild as default * Dark mode support * Static routing with Expo Router * Flexible generator directory support * Option to remove mobx-state-tree * AsyncStorage->MMKV * New i18n configuration with react-i18next * Lint configuration updates * Toggle component → Checkbox, Radio, and Switch * Improved keyboard avoidance * Component test example configuration Read all about it in our blog article! https://shift.infinite.red/what-is-ignite-x-9ecde0b34d75
|
🎉 This PR is included in version 10.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR adds support for removing MobX-State-Tree code from a non-demo project.
Retargeted to v10 branch.
Changes:
// @mstinline comments, similar to how demo code removal worksdemo.tsremoval logic into more genericmarkup.tsto be shared with@mstcomment types too, and make it easy to add additional other types in the future too.replace-next-linemarkup command type, to help swap out lines of code easily without hot patching in scripts (keeps code replacements inline next to other code)The option shows up --removeDemo=true is set
