-
Notifications
You must be signed in to change notification settings - Fork 12k
Feature Request: Stop deleting 'dist' directory on 'ng serve' (SILENTLY) #6375
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
Comments
For our workflow we serve the angular-cli app inside an ASP.NET Core web application. The 'dist' directory is a submodule of our angular-cli project and also of the ASP.NET Core web application (in the wwwroot directory). So when we have a new version of the angular code, we do a build, then commit the changes in the submodule (with a tagged version, etc). Then in our ASP.NET Core application we simply update the submodule. We initially did this because angular-cli wouldn't build in Azure when pulling our project from source control. If that has changed we might go back to just including the angular project as a submodule directly, but still deploys would take an extra couple minutes to build the cli project. |
I can tell that you put a lot of thought into writing this issue, but I'm sorry to have to tell you that it's still a dupe of #4366, and what had to be said about this subject has been said there (you even commented there yourself). If you're keeping important things in your |
@filipesilva Ok, you laid down the law. Despite it not being the best option for some people you still want to delete a directory and have no option to avoid this. At the very least you should inform the user when they run 'ng serve' that it is deleting a directory. I don't know how you can say it's a good practice to delete a directory without informing a user. A directory they know was created and populated when they ran 'ng build', or maybe a directory they put non-build related files in themselves when they changed the build output to go to another directory. I don't know how any user wouldn't be surprised when those contents were suddenly gone unless they are reading these issues. The 'ng serve' command has nothing to do with the directory. The 'ng build' command is what populates that directory. Deleting the contents when 'ng serve' is run is a hack because some users mistakenly thought they were getting that directory's contents with 'ng serve', but it isn't well documented and it is counter-intuitive. I've never seen a command before in my life that deletes the contents of a directory that it doesn't normally concern itself with. Since the 'functionality' of the 'ng serve' command won't be changed, I'll open separate tickets for the command line option and adding a message informing the user to make it easier. |
The command line option ( I do agree that it might be unexpected in some setups (like the one you described), but I think that in a lot of setups it's not surprising at all that the output directory for the build system is wholly transient and that there are a lot of commands to wipe/rebuild it. You're quite right that this is poorly documented. I'll add a note to the build command docs. |
Address concerns in angular#4366, angular#6375.
@filipesilva what version did this go in to? |
Running "ng build --output-path='../'" , instead of creating a directory in the parent named "dist", just deleted 12 hours of my work. A little warning, or maybe an error message would have been nice. Instead, AFTER my entire project was deleted, I got a cheery little message saying "Path must be a string. Received null" |
Address concerns in angular#4366, angular#6375.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.0.0-rc.1
node: 6.10.2
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9
Repro steps.
run "ng build" then "ng serve"
Desired functionality.
'ng serve' silently deletes the hard-coded 'dist' directory and should not.
Mention any other details that might be useful.
'ng serve' currently deletes the dist directory contents despite having nothing to do with the 'dist' directory. AND IT DOES THIS SILENTLY. The user might build into a different directory and store important information in the dist directory, which they would lose when calling 'ng serve'. People might use the dist directory for a lot of things. They might WANT to check in their weekly builds, either into the same repository or as a submodule so it can be imported into another project to serve the files. They might have a standard at their company to store things in a dist directory and build into a different directory, then 'ng serve' would delete files it has zero rights to delete.
If this is just done because people mistakenly think that 'ng seve' is serving the contents of the 'dist' directory it is a user education item and should be handled by a message when running 'ng serve' explaining this, not by silently deleting files.
A command line parameter like
ng serve --keep-dist
would be ok. At the very least there should be a message when runningng serve
telling the user that it is deleting the contents of a directory.The text was updated successfully, but these errors were encountered: