Why dryRun command in Angular CLI is used? Actually, it is mentioned "Run through without making any changes" when i give help command what is the meaning of that sentence.
ng serve is a great command to use when developing your application locally. It starts up a local development server, which will serve your application while you are developing it. It is not meant to be used for a production environment.
The ng new command creates an Angular workspace folder and generates a new application skeleton. A workspace can contain multiple applications and libraries. The initial application created by the ng new command is at the top level of the workspace.
It does exactly what you stated.
"Run through without making any changes"
The command will stop the CLI from making any changes to the file system. So if you are unsure about what some command does, you can test it with --dry-run
and not worry it will break something in your application.
Here is the real example of how it's used:
ng g component test-component --dry-run
CREATE src/app/components/test-component/test-component.component.html (29 bytes)
CREATE src/app/components/test-component/test-component.component.spec.ts (678 bytes)
CREATE src/app/components/test-component/test-component.component.ts (301 bytes)
CREATE src/app/components/test-component/test-component.component.scss (0 bytes)
UPDATE src/app/app.module.ts (3181 bytes)
NOTE: The "dryRun" flag means no changes were made.
As you can see I've ran a command which generates a new component. How ever since I added a --dry-run
flag to it, it only gave me the output of what would happen if I ran that command without --dry-run
. My test-component
was not actually created in my project. The last line of the output pretty much explains everything:
NOTE: The "dryRun" flag means no changes were made.
You have to append --dry-run with angular cli commands.
Ex -
ng new sample --dry-run
ng new example --dry-
Simply it just shows (in your cli) what a command does, before it actually does something. It will stop the CLI from making any changes to the file system and it prints everything it would do to your project when you run the command.
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