You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to incrementally migrate a project to using rush. I don't want to modify the root level of the repo, which itself is an NPM package.
However, I want to add a packages folder and manage packages in there with rush.
When I started using rush in the repo, I didn't do anything with the root, I added the packages folder and started managing things in there with rush, one at time. It worked great! For example, rush add ... && rush update && rush build works great inside of packages in the packages folder.
So far, so good, with only rush-managed packages inside packages/. Loving how it works!
Then I decided to add the root-level as a package, to also manage that with rush (and without having to completely change the repo structure just yet).
I ran rush update and at this point it ignored the other two projects, only setting up node_modules for the root-level project (with symlinks to common/temp/node_modules as expected). It did not set up node_modules for the other two projects (but I didn't realize this yet).
Then I ran rush build and it did try to build the sub-folder projects in packages/. The console output does successfully show X of 3 messages, indicating that it will try to build all three projects (note the build process of the root-level project does not touch any files in the sub-folder projects). However the build failed due obviously to the missing node_modules in the sub-folder projects.
I also tried running rush add ... inside a sub-folder dependency, but this added the dependency to the root-level project instead of in the sub-folder project.
What is the expected behavior?
That it would be able to handle the case of having the root of the repo (where rush.json is located) as a rush project itself, along with rush projects in sub-folders of the top-level rush project.
Solution?
I'm not sure if there's any other changes needed, but so far it looks like rush build can be updated so that it will still handle installing node_modules for the sub-folder projects, and then after this rush build will work as expected.
The rush add command would need to realize that we're in a sub-folder project (or, any project for that matter, it can check against rush.json), and thus operate on the current project rather than moving up to the higher-up project.
Use cases
This would be useful for existing projects to be able to manage packages in sub-folders (for example split some common code from the root-level project into separate new packages to publish on NPM) without having to modify the file-system structure of the root project (this can cause conflicts with other people's work, etc, and is generally not ideal if it can be avoided). EDIT: to workaround this I can move rush files (rush.json, common/, etc) into a parent folder, and make the root project (which is a git repo) a sub-folder of the folder that has only rush stuff, and now move out the other projects into the new common parent so that the previously-root project no longer contains sub-folders with rush projects.
This would help people incrementally adopt rush, so they can simply add a folder and get going. They would be able to rush init in the root-level and rush would add common/ and rush.json there, then they can simply place packages in sub-folders.
As a coincidence, this will allow a tree of rush projects (rush projects that manage rush projects that manage rush projects) to be possible, as in #1699. rush would traverse up to find the nearest rush.json.
If this is a bug, please provide the tool version, Node.js version, and OS.
Tool: rush
Tool Version: 5.17
Node Version: 12.13
OS: macOS
The text was updated successfully, but these errors were encountered:
trusktr
changed the title
root-level package causes rush to semi-ignore sub-folder projects in the root-level package.
[rush] root-level package causes rush to semi-ignore sub-folder projects in the root-level package.
Jan 21, 2020
trusktr
changed the title
[rush] root-level package causes rush to semi-ignore sub-folder projects in the root-level package.
[rush] making the monorepo a "project" causes rush to ignore sub-projects in the monorepo.
Jan 25, 2020
Is this a feature or a bug?
I'm trying to incrementally migrate a project to using
rush
. I don't want to modify the root level of the repo, which itself is an NPM package.However, I want to add a
packages
folder and manage packages in there withrush
.When I started using
rush
in the repo, I didn't do anything with the root, I added thepackages
folder and started managing things in there withrush
, one at time. It worked great! For example,rush add ... && rush update && rush build
works great inside of packages in thepackages
folder.rush.json
contains this:So far, so good, with only rush-managed packages inside
packages/
. Loving how it works!Then I decided to add the root-level as a package, to also manage that with
rush
(and without having to completely change the repo structure just yet).So then I changed
projects
inrush.json
to this:Please describe the actual behavior.
I ran
rush update
and at this point it ignored the other two projects, only setting upnode_modules
for the root-level project (with symlinks tocommon/temp/node_modules
as expected). It did not set upnode_modules
for the other two projects (but I didn't realize this yet).Then I ran
rush build
and it did try to build the sub-folder projects inpackages/
. The console output does successfully showX of 3
messages, indicating that it will try to build all three projects (note the build process of the root-level project does not touch any files in the sub-folder projects). However the build failed due obviously to the missing node_modules in the sub-folder projects.I also tried running
rush add ...
inside a sub-folder dependency, but this added the dependency to the root-level project instead of in the sub-folder project.What is the expected behavior?
That it would be able to handle the case of having the root of the repo (where
rush.json
is located) as a rush project itself, along with rush projects in sub-folders of the top-level rush project.Solution?
I'm not sure if there's any other changes needed, but so far it looks like
rush build
can be updated so that it will still handle installingnode_modules
for the sub-folder projects, and then after thisrush build
will work as expected.The
rush add
command would need to realize that we're in a sub-folder project (or, any project for that matter, it can check againstrush.json
), and thus operate on the current project rather than moving up to the higher-up project.Use cases
This would be useful for existing projects to be able to manage packages in sub-folders (for example split some common code from the root-level project into separate new packages to publish on NPM) without having to modify the file-system structure of the root project (this can cause conflicts with other people's work, etc, and is generally not ideal if it can be avoided). EDIT: to workaround this I can move rush files (rush.json, common/, etc) into a parent folder, and make the root project (which is a git repo) a sub-folder of the folder that has only rush stuff, and now move out the other projects into the new common parent so that the previously-root project no longer contains sub-folders with rush projects.
This would help people incrementally adopt
rush
, so they can simply add a folder and get going. They would be able torush init
in the root-level and rush would addcommon/
andrush.json
there, then they can simply place packages in sub-folders.As a coincidence, this will allow a tree of rush projects (rush projects that manage rush projects that manage rush projects) to be possible, as in #1699.
rush
would traverse up to find the nearestrush.json
.If this is a bug, please provide the tool version, Node.js version, and OS.
The text was updated successfully, but these errors were encountered: