Skip to content
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

fix(misc): fix moving a project into a subfolder #14988

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Feb 14, 2023

Current Behavior

The move generator doesn't work correctly when moving a project to a new destination that's a subfolder of its current root path. This happens because the project configuration is created in the new destination before moving the rest of the files. Because of that, when moving the files, it collects the new project configuration as a child and moves it to another nested level, which is wrong.

Expected Behavior

The move generator should work correctly when moving a project to a new destination that's a subfolder of its current root path.

Related Issue(s)

Fixes #13910

@leosvelperez leosvelperez self-assigned this Feb 14, 2023
@vercel
Copy link

vercel bot commented Feb 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 15, 2023 at 9:51AM (UTC)

@leosvelperez leosvelperez merged commit 3bb87ea into nrwl:master Feb 15, 2023
@leosvelperez leosvelperez deleted the misc/fix-move-into-subfolder branch February 15, 2023 16:05
FrozenPandaz pushed a commit that referenced this pull request Feb 15, 2023
@DmitryEfimenko
Copy link

DmitryEfimenko commented Feb 26, 2023

Since this PR is merged, I assume this fix should have made it at least into the latest beta.

I got @nrwl/workspace@15.8.0-beta.7 and tried moving a project into a subfolder. Got an error:

Cannot read properties of null (reading 'replace')

To reproduce:

  1. clone this repo
  2. run npm install @nrwl/workspace@15.8.0-beta.7
  3. run: nx g @nrwl/workspace:move --project ng-superclass --destination ./ng-superclass/package --dry-run

@leosvelperez
Copy link
Member Author

leosvelperez commented Feb 27, 2023

hey @DmitryEfimenko!

A couple of things based on your reproduction steps:

  • Based on what you mention, it would look like you're manually updating only the @nrwl/workspace package version. That's not correct. All @nrwl/* and nx packages versions should be aligned. Also, it's strongly recommended to update them by running migrations nx migrate next.
  • It looks like you're moving an Angular library (the name starts with ng-). If so, you must use the @nrwl/angular:move generator instead.

Please note the above points are solely based on the steps description. I can't access the repo you linked (is it private?). So, I was not able to reproduce the issue.

If the above points are irrelevant or don't solve the issue, could you open an issue with those details and an accessible repro? The error is different than what this PR addressed. It could still be an issue caused by this PR or a follow up change, but better to create a proper issue and track it separately.

@DmitryEfimenko
Copy link

@leosvelperez My bad, I specified the wrong repo link. Fixed it.

I also tried your suggestions and still got an error. It looks like it's only for angular projects. Created a issue here

@github-actions
Copy link

github-actions bot commented Mar 5, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@nrwl/angular:move broken for moving a library in a subfolder
4 participants