Nx: schematic @nrwl/workspace:move deleted all sources

Created on 5 Aug 2020  路  4Comments  路  Source: nrwl/nx

Current Behavior

I created a lib in the monorepo (in a shared folder), then wanted to move it to another location.
While coping a lib from a folder to another, the command crashed, and the sources from the lib disappeared entirely. (And I feel stupid because i didn't commit my changes first)
See screen capture below:
image

Expected Behavior

It should have been successful, since the dry run was.
If it fails, it should restore/keep the source code as it was.

Steps to Reproduce

Not 100% sure but:

  • create a lib "test" under libs/shared/test
  • (optional?) add a bunch of files inside, and keep some of those open in VSCode (open but all saved)
  • use nx g @nrwl/workspace:move shared-test shared/other
    => your sources are likely to disappear

Failure Logs

Just the error on the terminal:

ENOTEMPTY: directory not empty, rmdir 'D:\git-workspace\flo-monorepo\libs\shared\jira'

Environment

@nrwl/angular : Not Found
@nrwl/cli : 9.4.5
@nrwl/cypress : 9.4.5
@nrwl/eslint-plugin-nx : 9.4.5
@nrwl/express : Not Found
@nrwl/jest : 9.4.5
@nrwl/linter : 9.4.5
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.4.5
@nrwl/web : 9.4.5
@nrwl/workspace : 9.4.5
typescript : 3.9.5

I'm also using VSCode, on a Windows 10 machine

misc bug

Most helpful comment

Same behavior here trying to move the entire app to another folder. --dry-run displays correctly the affected files but the process crash due to sub folders

All 4 comments

Same behavior here trying to move the entire app to another folder. --dry-run displays correctly the affected files but the process crash due to sub folders

I have the same issue! It's already almost October and no one is on this issue??
This is such a BIG pain right now...
Renaming is a very basic and sometimes crucial functionality, I don't want to rule out this development tool because of a bug like this.

I found a workaround. I closed VSCode and tried to run the command in my terminal and it worked fine. May be related to the folder be open somewhere.

Can confirm using WebStorm aswell. Dry run looked good, running showed an error like "subfolder aren't empty", executing again deletes all sources. I believe this happend because i still had the folders opened in WebStorm. So: Commit your changes before using this generator

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SWGeekPD picture SWGeekPD  路  3Comments

IonFoXx picture IonFoXx  路  3Comments

ZempTime picture ZempTime  路  3Comments

vimalraj-a picture vimalraj-a  路  3Comments

MichaelWarneke picture MichaelWarneke  路  3Comments