I want to deploy my angular project i generated dist file in my src folder like this
ng build
Before deploying I decided to add some functionality to my page :
Question Is it posible to update dist files by doing like this?
ng serve update /dist dir
if false I want to delete the dist file and create another one so that it can be update with all folders, this is what I wanna do
ng serve remove /dist dir
Is this the right way of removing dist files ?
Simplest solution on Windows
rd /s dist
and on Linux
rm -r dist
Since you are using package.json AND to be operating system safe I recommend rimraf. It's not only about Windows vs Linux. Also about Linux Distribution vs Linux Distribution, changing access rights, etc. You are safe with this extra layer of abstraction.
Install:
npm install rimraf
In your scripts section of package.json add it as first command and append what ever you want to do after the &&
:
"scripts": {
"ng": "rimraf /dist && ng build"
}
Invoke the build/serve:
npm run ng
ng
is what you defined as your script execution identifier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With