-
Notifications
You must be signed in to change notification settings - Fork 38
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
Workspaces typescript fixes #3
Workspaces typescript fixes #3
Conversation
A leaf package may have a workspaces property (e.g. for nohoist). Prevent from considering that package to be a workspace root.
This is required for some 3rd party dependencies to work.
Wow, this is fantastic! Thanks. I will look into this on Monday. |
const filterDeps = deps => | ||
Reflect.ownKeys(deps).filter(dep => Reflect.has(depsTable, dep)); | ||
|
||
const filterDepsTable = () => { |
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.
Wondering why you thought to remove this?
My best guess is that you didn't see it doing anything for your project, and that you were thinking it was not needed?
Hopefully it was not breaking anything for you in Typescript?
The reason I added, this was so the dev-server does not lint workspace dependencies that were not added to the package.json
file of the app that is being launched. I think you'll find that without these lines, all of your worspaces with main:src
in the package.json
will be linted when launching your React app from the dev-server, even if the dependencies never get used by the app.
The way we are using react-workspaces we currently have 7 apps, and 13 suites of components. Linting 13 suites of components for 7 apps takes a couple minutes; but it takes about 10 seconds for one app. As the monorepo grows, linting unused code gets increasingly expensive, so we would like to avoid this cost.
Interested to get your thoughts.
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.
Hi, thanks for explaining the rationale, I think watch and linting are working as expected.
I just removed them because they seem to be currently unused in the in master. I only noticed it because VS Code shows them grayed out.
Reviewing the code again... I'll make my own guess :)
I think the functions were renamed and both versions were kept:
filterDeps -> filterSrcPaths
filterDepsTable -> buildDepsTable
and old versions can be safeley removed.
Does that seem right?
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 I see what you mean. I will double check this. Thanks!
This PR is really mandatory for typescript, especially |
Hi @Driox , this PR has been working for me, but now a hit an issue. I'd like to know if you have any idea on how to solve it. This situation works fine when I start
Now I want to publish I tried:
to no avail. Any idea on how to solve this? |
I think you should split this PR in multiple PR that can be merged independently For instance, I cherry pick this commit and it allows me to copy / paste my existing typescript project without issue I don't know if this project is useful for component that mean to be published. |
Great. It's good that someone else validated the result. @F1LT3R Do you think we can merge this as it is or you'd rather split it? |
This is also how we are using it. |
I will try and look tomorrow and merge. |
Awesome! |
Status update on this? |
I tried this PR and works like charm! Whats plan on it? |
Very nice work here! I have cloned this branch and merged w/ the latest react-scripts upstream. My sample test repo is here: I'm quite happy w/ this. I've also tested w/ typescript in another repo. 👏 My only question is now... what should the "component" project's "build" script be set to? This script will currently give an error (below). Should it be removed since we are setting "main": "src/index.js" and the application package just imports and builds the source of those libraries directly? Eventually, it may be nice to also build those into a
Really appreciate this work here and may contribute updates if I have bandwidth! |
Any progress on this? |
Hi there. I created this PR with some changes for typescript monorepos, it's working fine for me after I add the "main:src" entries in the leaf package.json files.