Comments (19)
Hi @mnajdova,
I am off today but trust that I will try and see what's feasable.
from tss-react.
I don't forget this. I am just having a hard time to feeing up time to work on it.
from tss-react.
Hi @mnajdova,
In the PR of @olee there is a new way of implementing nested selectors that will make it easier to implement the codemod because it is closed to what we where used to in JSS.
I will come back to this issue once this PR lands.
from tss-react.
Hi @ryandagg,
I am waiting for v3 to get peer reviewed then I will tacle this.
from tss-react.
Hi @mnajdova,
I finally got to it.
as I remember it is required to create the utility in the project
Correct but I created an alternative index that allows mui users to import makeStyles
and withStyles
directly like that:
import { makeStyles, withStyles } from "tss-react/mui";
I'll keep you updated.
from tss-react.
@garronej @mnajdova The app I work on has over 500 usages of makeStyles
, so I'm going to start working on the codemod. I'll only be able to devote occasional blocks of time to this, but we are planning to migrate our app to v5 within the next quarter so I should finish it within the next couple months. I'll be focusing on just the patterns that occur within our code, but that will cover enough cases to create a solid foundation to add more cases to.
I haven't used jscodeshift before, but the examples already in https://github.com/mui/material-ui/tree/master/packages/mui-codemod/src/v5.0.0 give me enough to speed my learning along.
You can follow my progress here: #31802
from tss-react.
Hi @mnajdova,
V3 is out. I might be too optimistic but I think we should be able to write a fully automated migration script.
Where should we start? Could tel me more about this codemode package of yours?
Best
from tss-react.
Nice! This is great news!
Regardint he codemod, we use jscodeshift
for the transformation. For v5, we have a set of codemods we are running under one codemod (preset-safe
), but I think the one that is for migrating the makeStyles
can be a standalone codemod, similar to how the jss-to-styled
is implemented. We could probably re-use lots of the logic there, at least for looking up the calls to the makeStyles
, withStyles
API. The transformation should be much simpler in the case of migrating to tss-react
. One thing we should think about is, where would people import the makeStyles
util from. I am saying this because as much as I remember it is required to create the utility in the project, so the import should be coming from a local file (maybe this import path can be specified in the arguments when calling the codemod).
Regarding testing the codemods, you can add an example original file and how the file should look after the transformation. For example see the v5.0.0/jss-to-styled.test
directory. These are then being compared in the jss-to-styled.test.js
.
All codemods related to v5 are in https://github.com/mui-org/material-ui/tree/master/packages/mui-codemod/src/v5.0.0
Feel free to start working in this package directly, and ping me if you have more questions. I will try to help however I can.
from tss-react.
Not trying to put you under any unrealistic pressure :) Just grateful that you are building this and I'm looking forward to it.
If in due time we are actually moving to material ui 5 I'll see if the manual transition makes sense :)
from tss-react.
In my experience it wasn't too much work! It is very doable and the documentation written is pretty nice :)
from tss-react.
@ryancogswell thank you for tackling this.
Let me know if you have any question or doubt about what the expected output should be. I'll make myself available in the best delay.
from tss-react.
Hi @mnajdova,
I am off today but trust that I will try and see what's feasible.
That sounds great, feel free to ping me when you have time to look over this together. We already have a codemod package with most of the things set up, we can test out things there.
from tss-react.
@garronej perfect! I will be following the updates here.
from tss-react.
I would love this codemod. I've spent 2 hours trying to implement it myself and nearly all styles are broken in ways that make no sense.
EDIT: not sure what happened. Stashed changes and re-applied and now barely broken, and in understandable ways. Needed to restart dev server? Not sure.
from tss-react.
Really looking forward to this :) We're waiting to upgrade to material-ui 5 because we want to use this cool library and having to manually convert everything by hand is quite a lot of work.
from tss-react.
Really looking forward to this :) We're waiting to upgrade to material-ui 5 because we want to use this cool library and having to manually convert everything by hand is quite a lot of work.
Hi @paales , I'm trying to make time whenever I can but it could takes time before the codemod is ready.
However, unless the component count of your project is in the thousand the update should be pretty quick, even by hand.
Here you can find examples of before/after.
Best
from tss-react.
I'll close it, at least for now.
I have too much on my plate.
I'll focus on keeping the v4 to v5 migration guide up to date.
Sorry to whoever has been waiting for this.
from tss-react.
Thank you for the nice feedback!
from tss-react.
@ryancogswell sounds perfect, thanks for starting the effort.
from tss-react.
Related Issues (20)
- Mixing multiple classes with nested selectors can lead to undesired output HOT 1
- eslint-plugin-tss-unused-classes detects every class as unused HOT 1
- Missing classname escaping HOT 1
- FOUC when using NextAppDirEmotionCacheProvider with prepend true HOT 8
- How to opt out of RTL transformation? HOT 3
- <GlobalStyles /> don't work properly with next.js app folder HOT 7
- cannot Import multiple makeStyles HOT 1
- Use eslint rule to detect unused classed with imports HOT 2
- React 16.10.0 failed to install @ mui/material HOT 1
- How to use with css and styled apis. HOT 1
- yarn install with pnp mode complains about missing dependency @mui/material HOT 3
- NextJS/MUI/TSS - Cannot read properties of undefined (reading 'classes') HOT 3
- Hard reload after any file change HOT 2
- TssCacheProvider is not working when used with emotion cache and mui 5 HOT 6
- Using with Shadowed Web Components HOT 3
- Next.js: Applying augmentDocumentWithEmotionCache to document breaks AMP pages HOT 2
- The right way typing props when using withStyles HOT 3
- Invalid type for withStyles HOT 4
- Mantine integration
- Using `@import` rule within `<GlobalStyles />` component HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tss-react.