Is there a command to delete app or lib?
No there isn't. If you delete a lib or app 3 things you need to do:
Closing the issue.
Is there any intention to add the ability to delete or remove libs components or apps?
I think deleting a library can be very helpful specially when refactoring code! Like splitting a lib into 2, and then delete the original one.
@Yonet if these steps are deterministic, maybe creating a schematic to do this deletion is not so strange? May we re-open this issue?
Also remember when removing a lib, that dist/.nx-results
should be updated - if you're using any if the affected
commands. Otherwise, the removed ones will keep succeeding/failing depending on their state prior to removal
You need to remove the references in angular.json and nx.json (for anyone who stumbles upon this like I did)
You need to remove the references in angular.json and nx.json (for anyone who stumbles upon this like I did)
The idea is to not have to do this - a command to remove a library that does the necessary cleanup.
@Yonet Pleace update your solution and add
tsconfig.json
nx.json
Shouldn't this be automated? After all, @vsavkin and the gang always advocate for "automating anything you can". Am I missing something?
That's true, delete command should be there
Just adding my two cents here, I would also very much love to have a remove command for apps and libs, which would throw a warning if another app/lib still depends on it and updates the relevant configs (nx.json, workspace.json, tsconfigs, etc.). I really love Nx for the smoothness that the CLI gives me and manually working with the configs dampens that sentiment.
This would be very helpful.
If you are using git, just discard changes
@aclarturocastro Unless, you've realized you need to remove some libs later - after a few commits. 馃槃
@aclarturocastro Unless, you've realized you need to remove some libs later - after a few commits. 馃槃
Of course! 馃槃
Although this issue is closed I'd like to give an update given this is a si much requested feature.
Good news! @jdpearce is actually working on a delete functionality, very much similar to our latest move schematic we have added. So keep an eye on our release log & announcements 馃槈
For anyone looking for the current way of removing app/lib (in a single list). https://github.com/nrwl/nx/issues/333#issuecomment-373235524 and https://github.com/nrwl/nx/issues/333#issuecomment-511418575 combined.
.angular-cli.json
apps array.tsconfig.json
nx.json
@fxck There's an easier way now - just use nx g @nrwl/workspace:rm <project name>
. This was released with version 9.1.3 last week. The docs site hasn't quite caught up yet, but it will soon.
@jdpearce yup works perfectly but, there is a problem if you will create an app by mistake without name it will create the files successfully in the apps folder just do nx g @nrwl/express:app
and hit enter for the name of the app and then the problem will occur again. in my case i need to delete them manually from nx.json
workspace.json
and generated files maybe also proxy.conf.json
in you bind it with --frontendProject
@th3m7J0 That sounds like a problem with the @nrwl/express:app
schematic itself. Can you raise another issue for that, please?
@jdpearce the problem is not only related to @nrwl/express:app
i also tried with @nrwl/react:app
the diffrence between those if the app name is not specified by mistake (hit enter) :
rm
command wont work.I think you need to fix that, because of the probability of being made by several developers is high.
nx g @nrwl/workspace:remove lib-name
Most helpful comment
@fxck There's an easier way now - just use
nx g @nrwl/workspace:rm <project name>
. This was released with version 9.1.3 last week. The docs site hasn't quite caught up yet, but it will soon.