From 29855bf54e83f1a80e4bcc85392d698cfca43af2 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 14 Oct 2024 17:11:12 +0000 Subject: [PATCH] docs: improve README files generated by Angular schematics --- .../angular/library/files/README.md.template | 59 +++++++++++++++---- .../workspace/files/README.md.template | 50 +++++++++++++--- 2 files changed, 90 insertions(+), 19 deletions(-) diff --git a/packages/schematics/angular/library/files/README.md.template b/packages/schematics/angular/library/files/README.md.template index f5270851993f..be0574115b94 100644 --- a/packages/schematics/angular/library/files/README.md.template +++ b/packages/schematics/angular/library/files/README.md.template @@ -1,24 +1,63 @@ # <%= classify(name) %> -This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>. +This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= angularLatestVersion %>. ## Code scaffolding -Run `ng generate component component-name --project <%= name %>` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project <%= name %>`. -> Note: Don't forget to add `--project <%= name %>` or else it will be added to the default project in your `angular.json` file. +Angular CLI includes powerful code scaffolding tools. To generate a new component, run: -## Build +```bash +ng generate component component-name +``` -Run `ng build <%= name %>` to build the project. The build artifacts will be stored in the `dist/` directory. +For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: -## Publishing +```bash +ng generate --help +``` -After building your library with `ng build <%= name %>`, go to the dist folder `cd dist/<%= dasherize(name) %>` and run `npm publish`. +## Building + +To build the library, run: + +```bash +ng build <%= name %> +``` + +This command will compile your project, and the build artifacts will be placed in the `dist/` directory. + +### Publishing the Library + +Once the project is built, you can publish your library by following these steps: + +1. Navigate to the `dist` directory: + ```bash + cd dist/<%= dasherize(name) %> + ``` + +2. Run the `npm publish` command to publish your library to the npm registry: + ```bash + npm publish + ``` ## Running unit tests -Run `ng test <%= name %>` to execute the unit tests via [Karma](https://karma-runner.github.io). +To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: + +```bash +ng test +``` + +## Running end-to-end tests + +For end-to-end (e2e) testing, run: + +```bash +ng e2e +``` + +Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. -## Further help +## Additional Resources -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. +For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. diff --git a/packages/schematics/angular/workspace/files/README.md.template b/packages/schematics/angular/workspace/files/README.md.template index 423821bd5487..85cba41ab1ea 100644 --- a/packages/schematics/angular/workspace/files/README.md.template +++ b/packages/schematics/angular/workspace/files/README.md.template @@ -1,27 +1,59 @@ # <%= utils.classify(name) %> -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>. +This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version <%= version %>. ## Development server -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. +To start a local development server, run: + +```bash +ng serve +``` + +Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files. ## Code scaffolding -Run `ng generate component component-name` to generate a new component. You can also use `ng generate --help` to see all the available schematics you can generate. +Angular CLI includes powerful code scaffolding tools. To generate a new component, run: + +```bash +ng generate component component-name +``` + +For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: + +```bash +ng generate --help +``` -## Build +## Building -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. +To build the project run: + +```bash +ng build +``` + +This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. ## Running unit tests -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). +To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: + +```bash +ng test +``` ## Running end-to-end tests -Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. +For end-to-end (e2e) testing, run: + +```bash +ng e2e +``` + +Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. -## Further help +## Additional Resources -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. +For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.