From 33e509e6266aa333d09a7385ce328b1fd1e005e8 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 30 Apr 2018 13:02:51 -0700 Subject: [PATCH] docs: add multiple projects Replaces the multiple apps doc. --- docs/documentation/stories.md | 2 +- docs/documentation/stories/multiple-apps.md | 66 ------------------- .../stories/multiple-projects.md | 18 +++++ 3 files changed, 19 insertions(+), 67 deletions(-) delete mode 100644 docs/documentation/stories/multiple-apps.md create mode 100644 docs/documentation/stories/multiple-projects.md diff --git a/docs/documentation/stories.md b/docs/documentation/stories.md index 7b5d3f6703d0..b83ea8e1a51d 100644 --- a/docs/documentation/stories.md +++ b/docs/documentation/stories.md @@ -29,6 +29,6 @@ - [Autoprefixer Configuration](stories/autoprefixer) - [Deploy to GitHub Pages](stories/github-pages) - [Linked Library](stories/linked-library) - - [Multiple apps](stories/multiple-apps) + - [Multiple projects](stories/multiple-projects) - [Continuous Integration](stories/continuous-integration) - [Universal Rendering](stories/universal-rendering) diff --git a/docs/documentation/stories/multiple-apps.md b/docs/documentation/stories/multiple-apps.md deleted file mode 100644 index c62331b245cb..000000000000 --- a/docs/documentation/stories/multiple-apps.md +++ /dev/null @@ -1,66 +0,0 @@ -# Multiple Apps integration - -Angular CLI supports multiple applications within one project. -You use the `apps` array in `.angular-cli.json` to list files and folders you want to use for different apps. - -By default one app is created when then new project is created and `apps` array looks like: -``` -"apps": [ - { - "root": "src", - ... - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - ... - } -], -``` - -To create another app you can copy the app object and then change the values for the options you want to change. eg. If I want to create another app with different `main`, `polyfills`, `test` and `prefix` and keep other configurations such as `assets`, `styles`, `environment` etc. same. I can add it to apps array as below. -``` -"apps": [ - { - "root": "src", - ... - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app", - ... - }, - { - "root": "src", - ... - "main": "main2.ts", - "polyfills": "polyfills2.ts", - "test": "test2.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "app2", - ... - } -], -``` -Now we can `serve`, `build` etc. both the apps by passing the app index with the commands. By default, it will pick the first app only. - -To serve the first app: `ng serve --app=0` or `ng serve --app 0` - -To serve the second app: `ng serve --app=1` or `ng serve --app 1` - -You can also add the `name` property to the app object in `apps` array and then pass it to commands to distinguish between different applications. -``` -"apps": [ - { - "name": "app1", - "root": "src", - "outDir": "dist", -.... -``` -To serve application by name `ng serve --app=app1` or `ng serve --app app1`. - diff --git a/docs/documentation/stories/multiple-projects.md b/docs/documentation/stories/multiple-projects.md new file mode 100644 index 000000000000..d1a49bce61e4 --- /dev/null +++ b/docs/documentation/stories/multiple-projects.md @@ -0,0 +1,18 @@ +# Multiple Projects + +Angular CLI supports multiple applications within one workspace. + +To create another app you can use the following command: +```sh +ng generate application my-other-app +``` + +The new application will be generated inside `projects/my-other-app`. + +Now we can `serve`, `build` etc. both the apps by passing the project name with the commands: + +```sh +ng serve my-other-app +``` + +You can also create libraries, which is detailed in [Create a library](stories/create-library). \ No newline at end of file