From ab9a369325ef96c9ceb5b01482bfc393a8ed2477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Exbrayat?= Date: Fri, 3 Mar 2017 15:50:08 +0100 Subject: [PATCH 01/47] docs(@angular/cli): update rc update guide (#5200) Make it still relevant for the current rc.1 release and future ones. --- README.md | 4 ++-- docs/documentation/stories.md | 2 +- .../stories/{rc.0-update.md => rc-update.md} | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) rename docs/documentation/stories/{rc.0-update.md => rc-update.md} (99%) diff --git a/README.md b/README.md index 784ae23dc072..799874f7e763 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ CLI for Angular applications based on the [ember-cli](http://www.ember-cli.com/) ## Note The CLI is now in Release Candidate (RC). -If you are updating from a beta version, check out our [RC.0 Update Guide] -(https://github.com/angular/angular-cli/wiki/stories-rc.0-update). +If you are updating from a beta version, check out our [RC Update Guide] +(https://github.com/angular/angular-cli/wiki/stories-rc-update). If you wish to collaborate, check out [our issue list](https://github.com/angular/angular-cli/issues). diff --git a/docs/documentation/stories.md b/docs/documentation/stories.md index 05314e28bc06..f208483c30ff 100644 --- a/docs/documentation/stories.md +++ b/docs/documentation/stories.md @@ -2,7 +2,7 @@ # Stories describing how to do more with the CLI - - [RC.0 Update](stories/rc.0-update) + - [RC Update](stories/rc-update) - [Asset Configuration](stories/asset-configuration) - [Autocompletion](stories/autocompletion) - [CSS Preprocessors](stories/css-preprocessors) diff --git a/docs/documentation/stories/rc.0-update.md b/docs/documentation/stories/rc-update.md similarity index 99% rename from docs/documentation/stories/rc.0-update.md rename to docs/documentation/stories/rc-update.md index 19c6d2c6b0c3..cfb5ec2345c6 100644 --- a/docs/documentation/stories/rc.0-update.md +++ b/docs/documentation/stories/rc-update.md @@ -1,4 +1,4 @@ -# Angular CLI RC.0 migration guide +# Angular CLI RC migration guide In this migration guide we'll be looking at some of the major changes to CLI projects in the last two months. @@ -19,7 +19,7 @@ The new [Stories](https://github.com/angular/angular-cli/wiki/stories) section c scenarios, so be sure to have a look! Below are the changes between a project generated two months ago, with `1.0.0-beta.24` and -a `1.0.0-rc.0` project. +a `1.0.0-rc.1` project. If you kept your project up to date you might have a lot of these already. You can find more details about changes between versions in [CHANGELOG.md](https://github.com/angular/angular-cli/blob/master/CHANGELOG.md). @@ -272,8 +272,10 @@ There is an additional root-level `tsconfig.json` that is used for IDE integrati "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, + "target": "es5", "lib": [ - "es2016" + "es2016", + "dom" ] } } @@ -455,5 +457,3 @@ Add these new rules: ``` Update `no-inferrable-types` to `"no-inferrable-types": [true, "ignore-params"]`. - - From 48324d11cbc5f17abbdd459e7b5a13cb440b354a Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 3 Mar 2017 15:24:28 +0000 Subject: [PATCH 02/47] test: fix commit message test for branches (#5004) For travis runs on branches, local master never exists there's no branch tracking origin/master. This causes `git fetch origin master` to fetch into `FETCH_HEAD` instead of master. This PR will explicitely fetch origin master into local master, and use that for the log comparison. --- scripts/test-commit-messages.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test-commit-messages.js b/scripts/test-commit-messages.js index 6408b82672bb..97c121077e24 100644 --- a/scripts/test-commit-messages.js +++ b/scripts/test-commit-messages.js @@ -32,7 +32,7 @@ logger // Note: This is based on the gulp task found in the angular/angular repository exec( - 'git fetch origin master && git log --reverse --format=%s origin/master.. --no-merges', + 'git fetch origin master:master && git log --reverse --format=%s master.. --no-merges', (error, stdout, stderr) => { if (error) { logger.fatal(stderr); From 3b3984351365518a928467a932a54b079edb099c Mon Sep 17 00:00:00 2001 From: Meligy Date: Fri, 24 Feb 2017 01:20:59 +1100 Subject: [PATCH 03/47] fix(@angular/cli): fix e2e after eject Start webpack-dev-server with e2e & sync its port with protractor default config port. Close #4957 --- packages/@angular/cli/tasks/eject.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/@angular/cli/tasks/eject.ts b/packages/@angular/cli/tasks/eject.ts index 4292a55fb96a..5fdbed83a72f 100644 --- a/packages/@angular/cli/tasks/eject.ts +++ b/packages/@angular/cli/tasks/eject.ts @@ -439,6 +439,12 @@ export default Task.extend({ Your package.json scripts needs to not contain a start script as it will be overwritten. `); } + if (scripts['pree2e'] && scripts['prepree2e'] !== 'npm start' && !force) { + throw new SilentError(oneLine` + Your package.json scripts needs to not contain a prepree2e script as it will be + overwritten. + `); + } if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript && !force) { throw new SilentError(oneLine` Your package.json scripts needs to not contain a pree2e script as it will be @@ -457,8 +463,9 @@ export default Task.extend({ } packageJson['scripts']['build'] = 'webpack'; - packageJson['scripts']['start'] = 'webpack-dev-server'; + packageJson['scripts']['start'] = 'webpack-dev-server --port=4200'; packageJson['scripts']['test'] = 'karma start ./karma.conf.js'; + packageJson['scripts']['prepree2e'] = 'npm start'; packageJson['scripts']['pree2e'] = pree2eNpmScript; packageJson['scripts']['e2e'] = 'protractor ./protractor.conf.js'; From e31413558ff8c5773cb103ff2b2c1cdab570f062 Mon Sep 17 00:00:00 2001 From: John Papa Date: Sat, 25 Feb 2017 09:35:58 -0500 Subject: [PATCH 04/47] fix(@angular/cli): rephrased warning message Rephrasing the warning message to read more fluently "needs to not contain" ---> "must not contain" Close #5006 --- packages/@angular/cli/tasks/eject.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@angular/cli/tasks/eject.ts b/packages/@angular/cli/tasks/eject.ts index 5fdbed83a72f..ee24ec85da10 100644 --- a/packages/@angular/cli/tasks/eject.ts +++ b/packages/@angular/cli/tasks/eject.ts @@ -431,12 +431,12 @@ export default Task.extend({ const scripts = packageJson['scripts']; if (scripts['build'] && scripts['build'] !== 'ng build' && !force) { throw new SilentError(oneLine` - Your package.json scripts needs to not contain a build script as it will be overwritten. + Your package.json scripts must not contain a build script as it will be overwritten. `); } if (scripts['start'] && scripts['start'] !== 'ng serve' && !force) { throw new SilentError(oneLine` - Your package.json scripts needs to not contain a start script as it will be overwritten. + Your package.json scripts must not contain a start script as it will be overwritten. `); } if (scripts['pree2e'] && scripts['prepree2e'] !== 'npm start' && !force) { @@ -447,18 +447,18 @@ export default Task.extend({ } if (scripts['pree2e'] && scripts['pree2e'] !== pree2eNpmScript && !force) { throw new SilentError(oneLine` - Your package.json scripts needs to not contain a pree2e script as it will be + Your package.json scripts must not contain a pree2e script as it will be overwritten. `); } if (scripts['e2e'] && scripts['e2e'] !== 'ng e2e' && !force) { throw new SilentError(oneLine` - Your package.json scripts needs to not contain a e2e script as it will be overwritten. + Your package.json scripts must not contain a e2e script as it will be overwritten. `); } if (scripts['test'] && scripts['test'] !== 'ng test' && !force) { throw new SilentError(oneLine` - Your package.json scripts needs to not contain a test script as it will be overwritten. + Your package.json scripts must not contain a test script as it will be overwritten. `); } From 07e93c0210c7629de03c7f812c32f72eddcb716b Mon Sep 17 00:00:00 2001 From: Thomas Kruse Date: Sat, 25 Feb 2017 22:59:48 +0100 Subject: [PATCH 05/47] fix(@angular/cli): enforce loglevel warn for npm-install The npm call uses the node exec() call which has a default limit of 200kb after which the process is terminated. When the user has set the info loglevel ng new terminates without any helpful error message. When using --quiet the loglevel is set to warning in any case resulting in a successful build. This is especially important for users of docker since the current node base image sets the loglevel to info. Close #5010 --- packages/@angular/cli/tasks/npm-install.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@angular/cli/tasks/npm-install.ts b/packages/@angular/cli/tasks/npm-install.ts index 923432c96249..e362b2a65d4d 100644 --- a/packages/@angular/cli/tasks/npm-install.ts +++ b/packages/@angular/cli/tasks/npm-install.ts @@ -13,7 +13,7 @@ export default Task.extend({ return new Promise(function(resolve, reject) { ui.writeLine(chalk.green(`Installing packages for tooling via ${packageManager}.`)); - exec(`${packageManager} install`, + exec(`${packageManager} --quiet install`, (err: NodeJS.ErrnoException, _stdout: string, stderr: string) => { if (err) { ui.writeLine(stderr); From 455dbb5dc4a09f68fa17d500ade09df56fbfb89c Mon Sep 17 00:00:00 2001 From: Ricardo Varanda Date: Tue, 28 Feb 2017 09:38:15 +0000 Subject: [PATCH 06/47] docs: fix typo in story list Close #5095 --- docs/documentation/stories.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/stories.md b/docs/documentation/stories.md index f208483c30ff..d3faa8d93447 100644 --- a/docs/documentation/stories.md +++ b/docs/documentation/stories.md @@ -15,7 +15,7 @@ - [Bootstrap](stories/include-bootstrap) - [Font Awesome](stories/include-font-awesome) - [Moving Into the CLI](stories/moving-into-the-cli) - - [Movine Out of the CLI](stories/moving-out-of-the-cli) + - [Moving Out of the CLI](stories/moving-out-of-the-cli) - [Proxy](stories/proxy) - [Routing](stories/routing) - [3rd Party Lib](stories/third-party-lib) From 7c3ce6ba2c84de2829e65cda2ceebed7e25b13a8 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Tue, 28 Feb 2017 17:15:52 +0100 Subject: [PATCH 07/47] fix(@angular/cli): use inheritance for ng4 Close #5111 --- .../cli/blueprints/ng/files/__path__/tsconfig.app.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.app.json b/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.app.json index 493162c0438c..f40bd2db7ea3 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.app.json +++ b/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.app.json @@ -1,22 +1,18 @@ {<% if (ng4) { %> "extends": "<%= relativeRootPath %>/tsconfig.json", - "compilerOptions": { - "lib": [ - "es2016", - "dom" - ],<% } else { %> + "compilerOptions": {<% } else { %> "compilerOptions": { "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, + "target": "es5", "lib": [ "es2016", "dom" ],<% } %> "outDir": "<%= relativeRootPath %>/out-tsc/app", - "target": "es5", "module": "es2015", "baseUrl": "", "types": [] From 34c33b9be26de6d82576703070a20cc274986841 Mon Sep 17 00:00:00 2001 From: Ricardo Varanda Date: Fri, 3 Mar 2017 16:06:25 +0000 Subject: [PATCH 08/47] docs: fix flex module import in user stories --- docs/documentation/stories/include-angular-flex.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/documentation/stories/include-angular-flex.md b/docs/documentation/stories/include-angular-flex.md index 77e256c08ffe..25a0aaf5c1d6 100644 --- a/docs/documentation/stories/include-angular-flex.md +++ b/docs/documentation/stories/include-angular-flex.md @@ -17,7 +17,7 @@ import { FlexLayoutModule } from '@angular/flex-layout'; @NgModule({ imports: [ ... - FlexLayoutModule.forRoot() + FlexLayoutModule ], ... }) @@ -74,4 +74,4 @@ Among what you should see are - a light yellow header that is the entire width o - [Installation](https://github.com/angular/flex-layout#installation) - [API Overview](https://github.com/angular/flex-layout/wiki/API-Overview) - - [Demo](https://tburleson-layouts-demos.firebaseapp.com/#/docs) \ No newline at end of file + - [Demo](https://tburleson-layouts-demos.firebaseapp.com/#/docs) From 8c3a7b86dc368d71bbdf34aefb8999584a600385 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Mon, 6 Mar 2017 13:47:11 -0500 Subject: [PATCH 09/47] docs(@angular/cli): Adding more details to documentation (#4960) --- docs/documentation/build.md | 42 +++++++++++------- docs/documentation/config.md | 18 +++++++- docs/documentation/doc.md | 2 +- docs/documentation/e2e.md | 12 ++---- docs/documentation/generate/class.md | 4 +- docs/documentation/generate/component.md | 22 +++++----- docs/documentation/generate/directive.md | 14 +++--- docs/documentation/generate/enum.md | 3 ++ docs/documentation/generate/guard.md | 8 ++-- docs/documentation/generate/interface.md | 5 ++- docs/documentation/generate/module.md | 7 +-- docs/documentation/generate/pipe.md | 12 +++--- docs/documentation/generate/service.md | 8 ++-- docs/documentation/lint.md | 6 +-- docs/documentation/new.md | 30 ++++++++----- docs/documentation/serve.md | 54 +++++------------------- docs/documentation/test.md | 28 ++++++++---- 17 files changed, 151 insertions(+), 124 deletions(-) diff --git a/docs/documentation/build.md b/docs/documentation/build.md index fdf4a7335883..67f0ac7c8f80 100644 --- a/docs/documentation/build.md +++ b/docs/documentation/build.md @@ -65,36 +65,46 @@ All builds make use of bundling, and using the `--prod` flag in `ng build --pro or `ng serve --prod` will also make use of uglifying and tree-shaking functionality. ## Options -`--watch` (`-w`) rebuild when files change +`--aot` Build using Ahead of Time compilation. -`--target` (`-t`) define the build target +`--app` Specifies app name or index to use. -`--environment` (`-e`) defines the build environment +`--base-href` (`-bh`) Base url for the application being built. -`--prod` flag to set build target and environment to production +`--deploy-url` (`-d`) URL where files will be deployed. -`--dev` flag to set build target and environment to development +`--dev` Build target and environment to development. `--output-path` (`-op`) path where output will be placed -`--aot` flag whether to build using Ahead of Time compilation +`--environment` (`-e`) Defines the build environment. -`--sourcemap` (`-sm`) output sourcemaps +`--extract-css` (`-ec`) Extract css from global styles onto css files instead of js ones. -`--vendor-chunk` (`-vb`) use a separate bundle containing only vendor libraries +`--i18n-file` Localization file to use for i18n. -`--base-href` (`-bh`) base url for the application being built +`--i18n-format` Format of the localization file specified with --i18n-file. -`--deploy-url` (`-d`) url where files will be deployed +`--locale` Locale to use for i18n. -`--verbose` (`-v`) adds more details to output logging +`--output-hashing` Define the output filename cache-busting hashing mode. -`--progress` (`-pr`) log progress to the console while building +`--output-path` (`-op`) Path where output will be placed. -`--extract-css` (`-ec`) extract css from global styles onto css files instead of js ones +`--poll` Enable and define the file watching poll time period (milliseconds). -`--output-hashing` define the output filename cache-busting hashing mode +`--prod` Build target and environment to production. -`--stats-json` generates a `stats.json` file which can be analyzed using tools such as: `webpack-bundle-analyzer` or https://webpack.github.io/analyse +`--progress` (`-pr`) Log progress to the console while building. -`--poll` enable and define the file watching poll time period (milliseconds) +`--sourcemap` (`-sm`) Output sourcemaps. + +`--stats-json` Generates a `stats.json` file which can be analyzed using tools such as: `webpack-bundle-analyzer` or https://webpack.github.io/analyse. + +`--target` (`-t`) Defines the build target. + +`--vendor-chunk` (`-vb`) Use a separate bundle containing only vendor libraries. + +`--verbose` (`-v`) Adds more details to output logging. + +`--watch` (`-w`) Run build when files change. \ No newline at end of file diff --git a/docs/documentation/config.md b/docs/documentation/config.md index 892021cf7c8f..ec7b6b3d3591 100644 --- a/docs/documentation/config.md +++ b/docs/documentation/config.md @@ -1,4 +1,18 @@ -`ng get` -`ng set` +# ng get + +## Overview +`ng get [key]` Get a value from the configuration. + +## Options +`--global` Get the value in the global configuration (in your home directory). + + +# ng set + +## Overview +`ng set [key]=[value]` Set a value in the configuration. + +## Options +`--global` Set the value in the global configuration rather than in your project's. \ No newline at end of file diff --git a/docs/documentation/doc.md b/docs/documentation/doc.md index 11f92a220a05..44c3f2927a95 100644 --- a/docs/documentation/doc.md +++ b/docs/documentation/doc.md @@ -3,4 +3,4 @@ # ng doc ## Overview -`ng doc [search term]` searches documentation on [angular.io](https://angular.io) +`ng doc [search term]` Opens the official Angular documentation for a given keyword on [angular.io](https://angular.io). diff --git a/docs/documentation/e2e.md b/docs/documentation/e2e.md index 48a0446f6663..58fefdbf0153 100644 --- a/docs/documentation/e2e.md +++ b/docs/documentation/e2e.md @@ -16,14 +16,10 @@ End-to-end tests are run via [Protractor](https://angular.github.io/protractor/) ## Options `--config` (`-c`) use a specific config file. Defaults to the protractor config file in `.angular-cli.json`. -`--specs` (`-sp`) override specs in the protractor config. -Can send in multiple specs by repeating flag (`ng e2e --specs=spec1.ts --specs=spec2.ts`). +`--element-explorer` (`-ee`) Start Protractor's [Element Explorer](https://github.com/angular/protractor/blob/master/docs/debugging.md#testing-out-protractor-interactively) for debugging. -`--element-explorer` (`-ee`) start Protractor's -[Element Explorer](https://github.com/angular/protractor/blob/master/docs/debugging.md#testing-out-protractor-interactively) -for debugging. +`--serve` Compile and Serve the app. All serve options are also available. The live-reload option defaults to false, and the default port will be random. -`--webdriver-update` (`-wu`) try to update webdriver. +`--specs` Override specs in the protractor config. Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts). -`--serve` (`-s`) compile and serve the app. -All non-reload related serve options are also available (e.g. `--port=4400`). \ No newline at end of file +`--webdriver-update` (`-wu`) (Default: true) Try to update webdriver. \ No newline at end of file diff --git a/docs/documentation/generate/class.md b/docs/documentation/generate/class.md index 6dc57ad014ba..e63471f033bb 100644 --- a/docs/documentation/generate/class.md +++ b/docs/documentation/generate/class.md @@ -6,4 +6,6 @@ `ng generate class [name]` generates a class ## Options -`--spec` specifies if a spec file is generated +`--app` Specifies app name or index to use. + +`--spec` Specifies if a spec file is generated. diff --git a/docs/documentation/generate/component.md b/docs/documentation/generate/component.md index 5898a3db40e7..5a53bcd0acef 100644 --- a/docs/documentation/generate/component.md +++ b/docs/documentation/generate/component.md @@ -6,22 +6,24 @@ `ng generate component [name]` generates a component ## Options -`--flat` flag to indicate if a dir is created +`--app` Specifies app name or index to use. -`--inline-template` (`-it`) specifies if the template will be in the ts file +`--change-detection` (`-cd`) Specifies the change detection strategy. -`--inline-style` (`-is`) specifies if the style will be in the ts file +`--flat` Flag to indicate if a dir is created. -`--prefix` specifies whether to use the prefix +`--export` Specifies if declaring module exports the component. -`--spec` specifies if a spec file is generated +`--inline-style` (`-is`) Specifies if the style will be in the ts file. -`--view-encapsulation` (`-ve`) specifies the view encapsulation strategy +`--inline-template` (`-it`) Specifies if the template will be in the ts file. -`--change-detection` (`-cd`) specifies the change detection strategy +`--module` (`-m`) Allows specification of the declaring module. -`--skip-import` allows for skipping the module import +`--prefix` Specifies whether to use the prefix. -`--module` (`-m`) allows specification of the declaring module +`--skip-import` Allows for skipping the module import. -`--export` specifies if declaring module exports the component +`--spec` Specifies if a spec file is generated. + +`--view-encapsulation` (`-ve`) Specifies the view encapsulation strategy. \ No newline at end of file diff --git a/docs/documentation/generate/directive.md b/docs/documentation/generate/directive.md index 8ad626b3066f..b63ac06391c9 100644 --- a/docs/documentation/generate/directive.md +++ b/docs/documentation/generate/directive.md @@ -6,14 +6,16 @@ `ng generate directive [name]` generates a directive ## Options -`--flat` flag to indicate if a dir is created +`--app` Specifies app name or index to use. -`--prefix` specifies whether to use the prefix +`--export` Specifies if declaring module exports the component. -`--spec` specifies if a spec file is generated +`--flat` Flag to indicate if a dir is created. -`--skip-import` allows for skipping the module import +`--module` (`-m`) Allows specification of the declaring module. -`--module` (`-m`) allows specification of the declaring module +`--prefix` Specifies whether to use the prefix. -`--export` specifies if declaring module exports the directive +`--skip-import` Allows for skipping the module import. + +`--spec` Specifies if a spec file is generated. diff --git a/docs/documentation/generate/enum.md b/docs/documentation/generate/enum.md index 3542a4681960..8102cdbb1c9d 100644 --- a/docs/documentation/generate/enum.md +++ b/docs/documentation/generate/enum.md @@ -4,3 +4,6 @@ ## Overview `ng generate enum [name]` generates an enumeration + +## Options +`--app` Specifies app name or index to use. diff --git a/docs/documentation/generate/guard.md b/docs/documentation/generate/guard.md index 192efbd0f424..3a78fbcb7ef1 100644 --- a/docs/documentation/generate/guard.md +++ b/docs/documentation/generate/guard.md @@ -4,8 +4,10 @@ `ng generate guard [name]` generates a guard ## Options -`--flat` flag to indicate if a dir is created +`--app` Specifies app name or index to use. -`--spec` specifies if a spec file is generated +`--flat` Indicate if a dir is created. -`--module` (`-m`) allows specification of the declaring module +`--module` (`-m`) Allows specification of the declaring module. + +`--spec` Specifies if a spec file is generated. \ No newline at end of file diff --git a/docs/documentation/generate/interface.md b/docs/documentation/generate/interface.md index e88ed5325b06..7884e716e428 100644 --- a/docs/documentation/generate/interface.md +++ b/docs/documentation/generate/interface.md @@ -5,6 +5,7 @@ ## Overview `ng generate interface [name] ` generates an interface -## Arguments +## Options +`--app` Specifies app name or index to use. -`type` optional string to specify the type of interface +`type` Pptional String to specify the type of interface. diff --git a/docs/documentation/generate/module.md b/docs/documentation/generate/module.md index 763d52e3d59f..18be4219556d 100644 --- a/docs/documentation/generate/module.md +++ b/docs/documentation/generate/module.md @@ -6,9 +6,10 @@ `ng generate module [name]` generates an NgModule ## Options +`--app` Specifies app name or index to use. -`--flat` flag to indicate if a dir is created +`--flat` Flag to indicate if a dir is created. -`--spec` specifies if a spec file is generated +`--spec` Specifies if a spec file is generated. -`--routing` specifies if a routing module file should be generated +`--routing` Specifies if a routing module file should be generated. diff --git a/docs/documentation/generate/pipe.md b/docs/documentation/generate/pipe.md index b576743cb372..7446b069522e 100644 --- a/docs/documentation/generate/pipe.md +++ b/docs/documentation/generate/pipe.md @@ -6,12 +6,14 @@ `ng generate pipe [name]` generates a pipe ## Options -`--flat` flag to indicate if a dir is created +`--app` Specifies app name or index to use. -`--spec` specifies if a spec file is generated +`--export` Specifies if declaring module exports the pipe. -`--skip-import` allows for skipping the module import +`--flat` Flag to indicate if a dir is created. -`--module` (`-m`) allows specification of the declaring module +`--module` (`-m`) Allows specification of the declaring module. -`--export` specifies if declaring module exports the pipe +`--skip-import` Allows for skipping the module import. + +`--spec` Specifies if a spec file is generated. \ No newline at end of file diff --git a/docs/documentation/generate/service.md b/docs/documentation/generate/service.md index 28a9d848abb4..5bdad34d299e 100644 --- a/docs/documentation/generate/service.md +++ b/docs/documentation/generate/service.md @@ -6,8 +6,10 @@ `ng generate service [name]` generates a service ## Options -`--flat` flag to indicate if a dir is created +`--app` Specifies app name or index to use. -`--spec` specifies if a spec file is generated +`--flat` Flag to indicate if a dir is created. -`--module` (`-m`) allows specification of the declaring module +`--module` (`-m`) Allows specification of the declaring module. + +`--spec` Specifies if a spec file is generated. \ No newline at end of file diff --git a/docs/documentation/lint.md b/docs/documentation/lint.md index 16ee05dd9dc2..7d1cd8729f83 100644 --- a/docs/documentation/lint.md +++ b/docs/documentation/lint.md @@ -7,8 +7,8 @@ ## Options -`--fix` will attempt to fix lint errors +`--fix` Fixes linting errors (may overwrite linted files). -`--force` will always return error code 0 even with lint errors +`--force` Succeeds even if there was linting errors. -`--format` (`-t`) the output formatter to use +`--format` (`-t`) Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist). diff --git a/docs/documentation/new.md b/docs/documentation/new.md index 3f4d5361e63e..616908532988 100644 --- a/docs/documentation/new.md +++ b/docs/documentation/new.md @@ -8,22 +8,32 @@ Default applications are created in a directory of the same name, with an initialized Angular application. ## Options -`--dry-run` (`-d`) run through without making any changes +`--directory` (`-dir`) The directory name to create the app in. -`--skip-install` (`-si`) skip installing packages +`--dry-run` (`-d`) Run through without making any changes. -`--skip-git` (`-sg`) skip initializing a git repository +`--inline-style` (`is`) Should have an inline style. -`--directory` (`-dir`) the directory name to create the app in +`--inline-template` (`it`) Should have an inline template. -`--source-dir` (`-sd`) the name of the source directory +`--link-cli` Automatically link the `@angular/cli` package. -`--style` the style file default extension +`--ng4` Create a project with Angular 4 in the template. -`--prefix` (`p`) the prefix to use for all component selectors +`--prefix` (`p`) The prefix to use for all component selectors. -`--routing` flag to indicate whether to generate a routing module +`--routing` Generate a routing module. -`--inline-style` (`is`) flag to indicate if the app component should have an inline style +`--skip-commit` Skip committing the first commit to git. -`--inline-template` (`it`) flag to indicate if the app component should have an inline template +`--skip-git` (`-sg`) Skip initializing a git repository. + +`--skip-install` (`-si`) Skip installing packages. + +`--skip-tests` Skip creating spec files. + +`--source-dir` (`-sd`) The name of the source directory. + +`--style` The style file default extension. + +`--verbose` Adds more details to output logging. \ No newline at end of file diff --git a/docs/documentation/serve.md b/docs/documentation/serve.md index b0a3665798cf..253a6af29c27 100644 --- a/docs/documentation/serve.md +++ b/docs/documentation/serve.md @@ -5,55 +5,23 @@ ## Overview `ng serve` builds the application and starts a web server -## Options -`--watch` (`-w`) rebuild when files change - -`--port` (`-p`) port to serve the application on - -`--host` (`-H`) host where to listen - -`--proxy-config` (`-pc`) proxy configuration file - -`--live-reload` (`-lr`) flag to turn off live reloading - -`--live-reload-client` specify the URL that the live reload browser client will use - -`--ssl` flag to turn on SSL - -`--ssl-key` path to the SSL key - -`--ssl-cert` path to the SSL cert +All the build Options are available in serve below are the additional options. -`--open` (`-o`) opens the app in the default browser - -`--hmr` use hot module reload - -`--target` (`-t`) define the build target - -`--environment` (`-e`) defines the build environment - -`--prod` flag to set build target and environment to production - -`--dev` flag to set build target and environment to development - -`--output-path` (`-po`) path where output will be placed - -`--aot` flag whether to build using Ahead of Time compilation - -`--sourcemap` (`-sm`) output sourcemaps +## Options +`--host` (`-H`) Listens only on localhost by default. -`--vendor-chunk` (`-vb`) use a separate bundle containing only vendor libraries +`--hmr` Enable hot module replacement. -`--base-href` (`-bh`) base url for the application being built +`--live-reload` (`-lr`) Whether to reload the page on change, using live-reload. -`--deploy-url` (`-d`) url where files will be deployed +`--live-reload-client` Specify the URL that the live reload browser client will use. -`--verbose` (`-v`) adds more details to output logging +`--open` (`-o`) Opens the url in default browser. -`--progress` (`-pr`) log progress to the console while building +`--port` (`-p`) Port to listen to for serving. -`--extract-css` (`-ec`) extract css from global styles onto css files instead of js ones +`--ssl` Serve using HTTPS. -`--output-hashing` define the output filename cache-busting hashing mode +`--ssl-cert` SSL certificate to use for serving HTTPS. -`--poll` enable and define the file watching poll time period (milliseconds) +`--ssl-key` SSL key to use for serving HTTPS. \ No newline at end of file diff --git a/docs/documentation/test.md b/docs/documentation/test.md index edebf772c59b..f3bb95c2a396 100644 --- a/docs/documentation/test.md +++ b/docs/documentation/test.md @@ -16,18 +16,30 @@ Tests will execute after a build is executed via [Karma](http://karma-runner.git You can run tests with coverage via `--code-coverage`. The coverage report will be in the `coverage/` directory. ## Options -`--watch` (`-w`) flag to run builds when files change +`--app` Specifies app name or index to use. -`--browsers` override which browsers tests are run against +`--browsers` Override which browsers tests are run against. -`--colors` enable or disable colors in the output (reporters and logs) +`--build` Build prior to running tests. -`--log-level` level of logging +`--code-coverage` Coverage report will be in the coverage/ directory. -`--port` port where the web server will be listening +`--colors` Enable or disable colors in the output (reporters and logs). -`--reporters` list of reporters to use +`--config` Use a specific config file. Defaults to the protractor config file in angular-cli.json. -`--build` flag to build prior to running tests +`--log-level` Level of logging. -`--poll` enable and define the file watching poll time period (milliseconds) +`--poll` Enable and define the file watching poll time period (milliseconds). + +`--port` Port where the web server will be listening. + +`--progress` Log progress to the console while in progress. + +`--reporters` List of reporters to use. + +`--single-run` Run tests a single time. + +`--sourcemap` Output sourcemaps. + +`--watch` (`-w`) Run build when files change. \ No newline at end of file From e0aeccbfab6632475cd1c66673c87ece91da799a Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Mon, 6 Mar 2017 16:23:31 -0500 Subject: [PATCH 10/47] test(@angular/cli): output test compilation to es5 (#5255) Fixes #5185 --- .../cli/blueprints/ng/files/__path__/tsconfig.spec.json | 2 +- packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.spec.json b/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.spec.json index dfbeeb249854..5dc8eeb57474 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.spec.json +++ b/packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.spec.json @@ -12,7 +12,7 @@ ],<% } %> "outDir": "<%= relativeRootPath %>/out-tsc/spec", "module": "commonjs", - "target": "es6", + "target": "es5", "baseUrl": "", "types": [ "jasmine", diff --git a/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json b/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json index 7697b8b04eb4..ff0fdbcff9a2 100644 --- a/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json +++ b/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json @@ -12,7 +12,7 @@ ],<% } %> "outDir": "../dist/out-tsc-e2e", "module": "commonjs", - "target": "es6", + "target": "es5", "types":[ "jasmine", "node" From c2a85694e13f8acb8e49a0da51c88545486b8535 Mon Sep 17 00:00:00 2001 From: Roy Ling Date: Tue, 7 Mar 2017 10:32:03 +0800 Subject: [PATCH 11/47] fix(@angular/cli): karma config is default for test command (#5263) `ng help test` says _protractor_ config is used by default, but it should be karma config instead. --- packages/@angular/cli/commands/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@angular/cli/commands/test.ts b/packages/@angular/cli/commands/test.ts index 6c95597b1eb6..22c1f745dc02 100644 --- a/packages/@angular/cli/commands/test.ts +++ b/packages/@angular/cli/commands/test.ts @@ -45,7 +45,7 @@ const TestCommand = EmberTestCommand.extend({ type: String, aliases: ['c'], description: oneLine`Use a specific config file. - Defaults to the protractor config file in angular-cli.json.` + Defaults to the karma config file in .angular-cli.json.` }, { name: 'single-run', From 1c2f361e8e2c170c90fc5b6a4f68af3be55ee9b5 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 7 Mar 2017 14:08:18 +0000 Subject: [PATCH 12/47] fix(@angular/cli): fix TS2.1 typeroots (#5251) TS-Node with TypeScript 2.1+ does not infer `typeRoots`, so we need to list them explicitely in the root tsconfig. Issue for TS-Node: https://github.com/TypeStrong/ts-node/issues/283 Fix #5082 --- docs/documentation/stories/rc-update.md | 3 +++ packages/@angular/cli/blueprints/ng/files/tsconfig.json | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/documentation/stories/rc-update.md b/docs/documentation/stories/rc-update.md index cfb5ec2345c6..c366384e8360 100644 --- a/docs/documentation/stories/rc-update.md +++ b/docs/documentation/stories/rc-update.md @@ -273,6 +273,9 @@ There is an additional root-level `tsconfig.json` that is used for IDE integrati "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], "lib": [ "es2016", "dom" diff --git a/packages/@angular/cli/blueprints/ng/files/tsconfig.json b/packages/@angular/cli/blueprints/ng/files/tsconfig.json index 7a9d9e8c58ab..1f9b55851bec 100644 --- a/packages/@angular/cli/blueprints/ng/files/tsconfig.json +++ b/packages/@angular/cli/blueprints/ng/files/tsconfig.json @@ -8,6 +8,9 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], "lib": [ "es2016", "dom" From 5c9c653f79432871a01247bd222bfefcc8ce8e85 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 7 Mar 2017 21:59:06 +0000 Subject: [PATCH 13/47] feat(@angular/cli): use standard stackTraceLimit (#5284) Sometime very long ago we set infinite stack traces and never took them out. This PR sets infinite stack traces only on dev setups. --- lib/bootstrap-local.js | 2 ++ packages/@angular/cli/lib/cli/index.js | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/bootstrap-local.js b/lib/bootstrap-local.js index a4043c34437f..645c540267e9 100644 --- a/lib/bootstrap-local.js +++ b/lib/bootstrap-local.js @@ -6,6 +6,8 @@ const path = require('path'); const ts = require('typescript'); +Error.stackTraceLimit = Infinity; + global.angularCliIsLocal = true; global.angularCliPackages = require('./packages'); diff --git a/packages/@angular/cli/lib/cli/index.js b/packages/@angular/cli/lib/cli/index.js index 10952734a829..3e0f3c056be9 100644 --- a/packages/@angular/cli/lib/cli/index.js +++ b/packages/@angular/cli/lib/cli/index.js @@ -12,7 +12,6 @@ const UI = require('../../ember-cli/lib/ui'); const Watcher = require('../../ember-cli/lib/models/watcher'); const path = require('path'); -Error.stackTraceLimit = Infinity; module.exports = function(options) { From 3515c3b4725cb83300a85d8fb2d22b7e99d4e2d5 Mon Sep 17 00:00:00 2001 From: Stephen Cavaliere Date: Tue, 7 Mar 2017 22:12:18 -0500 Subject: [PATCH 14/47] fix(@angular/cli): fix issue with console prompt bailing early (#5218) * fix(@angular/cli): fix issue with console prompt bailing early fixes #4614 * fix(@angular/cli): fix declarable types not finding closest module fixes #5127 --- packages/@angular/cli/blueprints/component/index.ts | 3 +-- packages/@angular/cli/blueprints/directive/index.ts | 3 +-- packages/@angular/cli/blueprints/pipe/index.ts | 3 +-- packages/@angular/cli/ember-cli/lib/ui/index.js | 8 +++----- .../@angular/cli/utilities/find-parent-module.ts | 4 ++++ .../component/component-in-existing-module-dir.ts | 12 ++++++++++++ .../directive/directive-in-existing-module-dir.ts | 12 ++++++++++++ .../generate/pipe/pipe-in-existing-module-dir.ts | 12 ++++++++++++ 8 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 tests/e2e/tests/generate/component/component-in-existing-module-dir.ts create mode 100644 tests/e2e/tests/generate/directive/directive-in-existing-module-dir.ts create mode 100644 tests/e2e/tests/generate/pipe/pipe-in-existing-module-dir.ts diff --git a/packages/@angular/cli/blueprints/component/index.ts b/packages/@angular/cli/blueprints/component/index.ts index ef5d9bcbd45c..2ef24c7c102e 100644 --- a/packages/@angular/cli/blueprints/component/index.ts +++ b/packages/@angular/cli/blueprints/component/index.ts @@ -95,8 +95,7 @@ export default Blueprint.extend({ } } else { try { - this.pathToModule = findParentModule( - this.project.root, appConfig.root, this.dynamicPath.dir); + this.pathToModule = findParentModule(this.project.root, appConfig.root, this.generatePath); } catch (e) { if (!options.skipImport) { throw `Error locating module for declaration\n\t${e}`; diff --git a/packages/@angular/cli/blueprints/directive/index.ts b/packages/@angular/cli/blueprints/directive/index.ts index d5b02d81d22e..50ddaf00c0d7 100644 --- a/packages/@angular/cli/blueprints/directive/index.ts +++ b/packages/@angular/cli/blueprints/directive/index.ts @@ -70,8 +70,7 @@ export default Blueprint.extend({ } } else { try { - this.pathToModule = findParentModule - (this.project.root, appConfig.root, this.dynamicPath.dir); + this.pathToModule = findParentModule(this.project.root, appConfig.root, this.generatePath); } catch (e) { if (!options.skipImport) { throw `Error locating module for declaration\n\t${e}`; diff --git a/packages/@angular/cli/blueprints/pipe/index.ts b/packages/@angular/cli/blueprints/pipe/index.ts index 9cf81773a420..99c50281a8fe 100644 --- a/packages/@angular/cli/blueprints/pipe/index.ts +++ b/packages/@angular/cli/blueprints/pipe/index.ts @@ -65,8 +65,7 @@ export default Blueprint.extend({ } } else { try { - this.pathToModule = findParentModule - (this.project.root, appConfig.root, this.dynamicPath.dir); + this.pathToModule = findParentModule(this.project.root, appConfig.root, this.generatePath); } catch (e) { if (!options.skipImport) { throw `Error locating module for declaration\n\t${e}`; diff --git a/packages/@angular/cli/ember-cli/lib/ui/index.js b/packages/@angular/cli/ember-cli/lib/ui/index.js index 7837f04e0f52..3e749d1a0166 100644 --- a/packages/@angular/cli/ember-cli/lib/ui/index.js +++ b/packages/@angular/cli/ember-cli/lib/ui/index.js @@ -174,12 +174,10 @@ UI.prototype.prompt = function(questions, callback) { // If no callback was provided, automatically return a promise if (callback) { - inquirer.prompt(questions, callback); - } else { - return new Promise(function(resolve) { - inquirer.prompt(questions, resolve); - }); + return inquirer.prompt(questions, callback); } + + return inquirer.prompt(questions); }; /** diff --git a/packages/@angular/cli/utilities/find-parent-module.ts b/packages/@angular/cli/utilities/find-parent-module.ts index 3236167121cf..61be86780b5e 100644 --- a/packages/@angular/cli/utilities/find-parent-module.ts +++ b/packages/@angular/cli/utilities/find-parent-module.ts @@ -13,6 +13,10 @@ export default function findParentModule( let pathToCheck = path.join(sourceRoot, currentDir); while (pathToCheck.length >= sourceRoot.length) { + if (!fs.existsSync(pathToCheck)) { + pathToCheck = path.dirname(pathToCheck); + continue; + } // TODO: refactor to not be based upon file name const files = fs.readdirSync(pathToCheck) .filter(fileName => !fileName.endsWith('routing.module.ts')) diff --git a/tests/e2e/tests/generate/component/component-in-existing-module-dir.ts b/tests/e2e/tests/generate/component/component-in-existing-module-dir.ts new file mode 100644 index 000000000000..bb98447bb4a1 --- /dev/null +++ b/tests/e2e/tests/generate/component/component-in-existing-module-dir.ts @@ -0,0 +1,12 @@ +import { join } from 'path'; +import { ng } from '../../../utils/process'; +import { expectFileToMatch } from '../../../utils/fs'; + +export default function () { + const modulePath = join('src', 'app', 'foo', 'foo.module.ts'); + + return Promise.resolve() + .then(() => ng('generate', 'module', 'foo')) + .then(() => ng('generate', 'component', 'foo')) + .then(() => expectFileToMatch(modulePath, /import { FooComponent } from '.\/foo.component'/)); +} diff --git a/tests/e2e/tests/generate/directive/directive-in-existing-module-dir.ts b/tests/e2e/tests/generate/directive/directive-in-existing-module-dir.ts new file mode 100644 index 000000000000..7dd270fe81a1 --- /dev/null +++ b/tests/e2e/tests/generate/directive/directive-in-existing-module-dir.ts @@ -0,0 +1,12 @@ +import { join } from 'path'; +import { ng } from '../../../utils/process'; +import { expectFileToMatch } from '../../../utils/fs'; + +export default function () { + const modulePath = join('src', 'app', 'foo', 'foo.module.ts'); + + return Promise.resolve() + .then(() => ng('generate', 'module', 'foo')) + .then(() => ng('generate', 'directive', 'foo', '--no-flat')) + .then(() => expectFileToMatch(modulePath, /import { FooDirective } from '.\/foo.directive'/)); +} diff --git a/tests/e2e/tests/generate/pipe/pipe-in-existing-module-dir.ts b/tests/e2e/tests/generate/pipe/pipe-in-existing-module-dir.ts new file mode 100644 index 000000000000..2055643a1b5b --- /dev/null +++ b/tests/e2e/tests/generate/pipe/pipe-in-existing-module-dir.ts @@ -0,0 +1,12 @@ +import { join } from 'path'; +import { ng } from '../../../utils/process'; +import { expectFileToMatch } from '../../../utils/fs'; + +export default function () { + const modulePath = join('src', 'app', 'foo', 'foo.module.ts'); + + return Promise.resolve() + .then(() => ng('generate', 'module', 'foo')) + .then(() => ng('generate', 'pipe', 'foo', '--no-flat')) + .then(() => expectFileToMatch(modulePath, /import { FooPipe } from '.\/foo.pipe'/)); +} From 5e54a01e28ba762601a7466fe71ec292edc6a203 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Wed, 8 Mar 2017 15:45:46 -0500 Subject: [PATCH 15/47] fix(@angular/cli): yarn install does not support --quiet (#5310) --- packages/@angular/cli/tasks/npm-install.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@angular/cli/tasks/npm-install.ts b/packages/@angular/cli/tasks/npm-install.ts index e362b2a65d4d..c7a846590cb7 100644 --- a/packages/@angular/cli/tasks/npm-install.ts +++ b/packages/@angular/cli/tasks/npm-install.ts @@ -13,7 +13,11 @@ export default Task.extend({ return new Promise(function(resolve, reject) { ui.writeLine(chalk.green(`Installing packages for tooling via ${packageManager}.`)); - exec(`${packageManager} --quiet install`, + let installCommand = `${packageManager} --quiet install`; + if (packageManager === 'yarn') { + installCommand = `${packageManager} install`; + } + exec(installCommand, (err: NodeJS.ErrnoException, _stdout: string, stderr: string) => { if (err) { ui.writeLine(stderr); From cf14a15299e0b7e22d4c5596d79aede48965f2f0 Mon Sep 17 00:00:00 2001 From: Takatsugu Shigeta Date: Fri, 24 Feb 2017 09:20:28 +0900 Subject: [PATCH 16/47] fix(@angular/cli): Fix filtering files on completion Fix #4664 Close #4972 --- packages/@angular/cli/commands/completion.ts | 2 +- tests/e2e/tests/commands/completion/completion.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/e2e/tests/commands/completion/completion.ts diff --git a/packages/@angular/cli/commands/completion.ts b/packages/@angular/cli/commands/completion.ts index 1147c7e48f6b..b755ab49ee0d 100644 --- a/packages/@angular/cli/commands/completion.ts +++ b/packages/@angular/cli/commands/completion.ts @@ -78,7 +78,7 @@ const CompletionCommand = Command.extend({ commandOptions.all = !commandOptions.bash && !commandOptions.zsh; const commandFiles = fs.readdirSync(__dirname) - .filter(file => file.match(/\.ts$/) && !file.match(/\.run.ts$/)) + .filter(file => file.match(/\.(j|t)s$/) && !file.match(/\.d.ts$/)) .map(file => path.parse(file).name) .filter(file => { return commandsToIgnore.indexOf(file) < 0; diff --git a/tests/e2e/tests/commands/completion/completion.ts b/tests/e2e/tests/commands/completion/completion.ts new file mode 100644 index 000000000000..b88821e8c3ab --- /dev/null +++ b/tests/e2e/tests/commands/completion/completion.ts @@ -0,0 +1,9 @@ +import {silentNg} from '../../../utils/process'; + + +export default function() { + return Promise.resolve() + .then(() => silentNg('completion')) + .then(() => process.chdir('/')) + .then(() => silentNg('completion')); +} From e4683ce40911bc6e13325356402099d98503dc52 Mon Sep 17 00:00:00 2001 From: Rob Mullins Date: Fri, 3 Mar 2017 11:47:51 -0700 Subject: [PATCH 17/47] docs: correct rc migration guide fix test runner dependency and other corrections Closes #5039 Close #5041 --- docs/documentation/stories/rc-update.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/documentation/stories/rc-update.md b/docs/documentation/stories/rc-update.md index c366384e8360..697f2e016def 100644 --- a/docs/documentation/stories/rc-update.md +++ b/docs/documentation/stories/rc-update.md @@ -320,16 +320,17 @@ Packages in `dependencies`: - `@angular/*` packages now have a `^2.4.0` minimum (`^3.4.0` for router) - `core-js` remains unchanged at `^2.4.1` - `rxjs` to `^5.1.0` +- `ts-helpers` was **removed** - `zone.js` to `^0.7.6` -Packages in `dependencies`: +Packages in `devDependencies`: - `@angular/cli` at `1.0.0-rc.0` replaces `angular-cli` - `@angular/compiler-cli` is also at `^2.4.0` - `@types/jasmine` remains unchanged and pinned at `2.5.38` - `@types/node` was updated to `~6.0.60` - `codelyzer` was updated to `~2.0.0` - `jasmine-core` was updated to `~2.5.2` -- `jasmine-spec-reporter` was **removed** +- `jasmine-spec-reporter` was updated to `~3.2.0` - `karma` was updated to `~1.4.1` - `karma-chrome-launcher` was updated to `~2.0.0` - `karma-cli` was updated to `~1.0.1` @@ -353,6 +354,7 @@ We also updated the scripts section to make it more simple: "scripts": { "ng": "ng", "start": "ng serve", + "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" From d74d9139eb494ce7633cbb24fc748dd09fd9338f Mon Sep 17 00:00:00 2001 From: saverett Date: Mon, 27 Feb 2017 10:08:05 -0700 Subject: [PATCH 18/47] docs: add directory removal options in README for update on Windows Add required Windows `rmdir` options for `Windows Command Prompt` and `rm` options for `Windows PowerShell` in Angular CLI README update instructions to match `bash` `rm -rf` command. Close #5068 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 799874f7e763..e1cc0d9cac89 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ npm install -g @angular/cli@latest Local project package: ```bash -rm -rf node_modules dist # use rmdir on Windows +rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell npm install --save-dev @angular/cli@latest npm install ``` From 5339e4a6b6b04b639d4f6155baabf8b13560baff Mon Sep 17 00:00:00 2001 From: Benjamin Cabanes Date: Mon, 27 Feb 2017 12:17:27 -0500 Subject: [PATCH 19/47] docs: add Guard generator option in README Add the Guard param on the options table of the generator in the README. It was implemented by #4055. Close #5069 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e1cc0d9cac89..0407cb933763 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Directive | `ng g directive my-new-directive` Pipe | `ng g pipe my-new-pipe` Service | `ng g service my-new-service` Class | `ng g class my-new-class` +Guard | `ng g guard my-new-guard` Interface | `ng g interface my-new-interface` Enum | `ng g enum my-new-enum` Module | `ng g module my-module` From a78a7279b6964840929be68183378373fe0956b1 Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Tue, 28 Feb 2017 10:46:46 +0100 Subject: [PATCH 20/47] feat(@angular/cli): bump to tslint 4.5.0 Close #5099 --- packages/@angular/cli/blueprints/ng/files/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@angular/cli/blueprints/ng/files/package.json b/packages/@angular/cli/blueprints/ng/files/package.json index f35a9e6c93a6..fc2f3609964d 100644 --- a/packages/@angular/cli/blueprints/ng/files/package.json +++ b/packages/@angular/cli/blueprints/ng/files/package.json @@ -40,7 +40,7 @@ "karma-coverage-istanbul-reporter": "^0.2.0", "protractor": "~5.1.0", "ts-node": "~2.0.0", - "tslint": "~4.4.2", + "tslint": "~4.5.0", "typescript": "<%= ng4 ? '~2.1.0' : '~2.0.0' %>" } } From e22aaa4b56d58543df8136c5afb58af9b405b8a2 Mon Sep 17 00:00:00 2001 From: Ricardo Varanda Date: Wed, 1 Mar 2017 15:57:15 +0000 Subject: [PATCH 21/47] docs: fix material module import in user stories Close #5140 --- docs/documentation/stories/include-angular-material.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/stories/include-angular-material.md b/docs/documentation/stories/include-angular-material.md index d2e30afe514b..83ab16131cf1 100644 --- a/docs/documentation/stories/include-angular-material.md +++ b/docs/documentation/stories/include-angular-material.md @@ -24,7 +24,7 @@ import { MaterialModule } from '@angular/material'; @NgModule({ imports: [ ... - MaterialModule.forRoot() + MaterialModule ], ... }) From 7671bb400866735f6ccefbcaa2b3cf3063bbdb62 Mon Sep 17 00:00:00 2001 From: jortiz Date: Wed, 1 Mar 2017 12:50:51 -0500 Subject: [PATCH 22/47] docs: fix spelling of the word application Close #5149 --- docs/documentation/home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/home.md b/docs/documentation/home.md index c56fee1226b4..9eff31bf00e8 100644 --- a/docs/documentation/home.md +++ b/docs/documentation/home.md @@ -55,4 +55,4 @@ End-to-end tests are run via [Protractor](https://angular.github.io/protractor/) ### Additional Information There are several [stories](stories) which will walk you through setting up -additional aspects of Angular applciations. +additional aspects of Angular applications. From e9372d3c11af622f026d391088e173eb5c66bda9 Mon Sep 17 00:00:00 2001 From: John Papa Date: Tue, 7 Mar 2017 09:13:54 -0500 Subject: [PATCH 23/47] fix(@angular/cli): Align tsconfig output dir to out-tsc. Add out-tsc to .gitignore Added /out-tsc to the .gitignore blueprint. If someone runs tsc -p src/tsconfig.spec.json it outputs to the ../out-tsc folder. These should be ignored. Also changed https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json#L13 to ../out-tsc/e2e so that they all match. cc @filipesilva fixing due to issue with CLA from #5062 Close #5220 --- packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json | 2 +- packages/@angular/cli/blueprints/ng/files/gitignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json b/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json index ff0fdbcff9a2..674dd643c913 100644 --- a/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json +++ b/packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json @@ -10,7 +10,7 @@ "lib": [ "es2016" ],<% } %> - "outDir": "../dist/out-tsc-e2e", + "outDir": "../out-tsc/e2e", "module": "commonjs", "target": "es5", "types":[ diff --git a/packages/@angular/cli/blueprints/ng/files/gitignore b/packages/@angular/cli/blueprints/ng/files/gitignore index 8ce873857363..2171ced556d5 100755 --- a/packages/@angular/cli/blueprints/ng/files/gitignore +++ b/packages/@angular/cli/blueprints/ng/files/gitignore @@ -3,6 +3,7 @@ # compiled output /dist /tmp +/out-tsc # dependencies /node_modules From a54115c2800f07dee28d14843a343b61d151aa40 Mon Sep 17 00:00:00 2001 From: Carles Galan Cladera Date: Sat, 4 Mar 2017 11:00:21 +0100 Subject: [PATCH 24/47] fix(@angular/cli): Log xi18n errors Log i18n extraction errors Fixes #5129 Close #5223 --- packages/@angular/cli/tasks/extract-i18n.ts | 1 - packages/@ngtools/webpack/src/extract_i18n_plugin.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/@angular/cli/tasks/extract-i18n.ts b/packages/@angular/cli/tasks/extract-i18n.ts index 278223162a35..eac76cb69b56 100644 --- a/packages/@angular/cli/tasks/extract-i18n.ts +++ b/packages/@angular/cli/tasks/extract-i18n.ts @@ -54,7 +54,6 @@ export const Extracti18nTask = Task.extend({ this.ui.writeError('\nAn error occured during the i18n extraction:\n' + ((err && err.stack) || err)); } - throw err; }); } }); diff --git a/packages/@ngtools/webpack/src/extract_i18n_plugin.ts b/packages/@ngtools/webpack/src/extract_i18n_plugin.ts index 10a087343abd..06168b9b3f24 100644 --- a/packages/@ngtools/webpack/src/extract_i18n_plugin.ts +++ b/packages/@ngtools/webpack/src/extract_i18n_plugin.ts @@ -181,8 +181,8 @@ export class ExtractI18nPlugin implements Tapable { }); }) .then(() => cb(), (err: any) => { - compilation.errors.push(err); - cb(); + this._compilation.errors.push(err); + cb(err); }); } From c99cf96e4971d52a7a1fa6c2330b4a9c139ebbae Mon Sep 17 00:00:00 2001 From: Charles Lyding Date: Sat, 4 Mar 2017 09:54:06 -0500 Subject: [PATCH 25/47] fix(@angular/cli): ensure lint generates well-formed machine output For machine readable output formats, ng lint was concatenating multiple documents into a single file. This resulted in invalid JSON, XML, etc. The lint results are now aggregated and one full output is generated. Fix #5259 Close #5224 --- packages/@angular/cli/tasks/lint.ts | 39 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/packages/@angular/cli/tasks/lint.ts b/packages/@angular/cli/tasks/lint.ts index ef63b2dc3d4e..12cf4c4c9725 100644 --- a/packages/@angular/cli/tasks/lint.ts +++ b/packages/@angular/cli/tasks/lint.ts @@ -33,11 +33,8 @@ export default Task.extend({ const Linter = tslint.Linter; const Configuration = tslint.Configuration; - let errors = 0; - let results = ''; - - lintConfigs - .forEach((config) => { + const result = lintConfigs + .map((config) => { const program: ts.Program = Linter.createProgram(config.project); const files = getFilesToLint(program, config, Linter); @@ -56,19 +53,37 @@ export default Task.extend({ linter.lint(file, fileContents, configLoad.results); }); - const result = linter.getResult(); - errors += result.failureCount; - results = results.concat(result.output.trim().concat('\n')); + return linter.getResult(); + }) + .reduce((total, current) => { + const failures = current.failures + .filter((cf: any) => !total.failures.some((ef: any) => ef.equals(cf))); + total.failures = total.failures.concat(...failures); + + if (current.fixes) { + total.fixes = (total.fixes || []).concat(...current.fixes); + } + return total; + }, { + failures: [], + fixes: undefined }); + const Formatter = tslint.findFormatter(commandOptions.format); + const formatter = new Formatter(); + + const output = formatter.format(result.failures, result.fixes); + if (output) { + ui.writeLine(output); + } + // print formatter output directly for non human-readable formats if (['prose', 'verbose', 'stylish'].indexOf(commandOptions.format) == -1) { - ui.writeLine(results.trim()); - return (errors == 0 || commandOptions.force) ? Promise.resolve(0) : Promise.resolve(2); + return (result.failures.length == 0 || commandOptions.force) + ? Promise.resolve(0) : Promise.resolve(2); } - if (errors > 0) { - ui.writeLine(results.trim()); + if (result.failures.length > 0) { ui.writeLine(chalk.red('Lint errors found in the listed files.')); return commandOptions.force ? Promise.resolve(0) : Promise.resolve(2); } From 1834fc16ffcf3c96e4284670e0e4c0a47c2cfbb0 Mon Sep 17 00:00:00 2001 From: Charles Lyding Date: Sat, 4 Mar 2017 10:04:53 -0500 Subject: [PATCH 26/47] docs: remove mention of outdated live reload option Close #5225 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0407cb933763..d8069cd4d5a6 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,10 @@ ng serve ``` Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. -You can configure the default HTTP port and the one used by the LiveReload server with two command-line options : +You can configure the default HTTP host and port used by the development server with two command-line options : ```bash -ng serve --host 0.0.0.0 --port 4201 --live-reload-port 49153 +ng serve --host 0.0.0.0 --port 4201 ``` ### Generating Components, Directives, Pipes and Services From fcb1f35424b039919e0052a617b6cf8ec5b44704 Mon Sep 17 00:00:00 2001 From: Charles Lyding Date: Sun, 5 Mar 2017 13:21:03 -0500 Subject: [PATCH 27/47] fix(@angular/cli): remove outdated test command option `--build` Close #5235 --- docs/documentation/test.md | 2 -- packages/@angular/cli/commands/test.ts | 7 ------- 2 files changed, 9 deletions(-) diff --git a/docs/documentation/test.md b/docs/documentation/test.md index f3bb95c2a396..18c3c633b282 100644 --- a/docs/documentation/test.md +++ b/docs/documentation/test.md @@ -20,8 +20,6 @@ You can run tests with coverage via `--code-coverage`. The coverage report will `--browsers` Override which browsers tests are run against. -`--build` Build prior to running tests. - `--code-coverage` Coverage report will be in the coverage/ directory. `--colors` Enable or disable colors in the output (reporters and logs). diff --git a/packages/@angular/cli/commands/test.ts b/packages/@angular/cli/commands/test.ts index 22c1f745dc02..655612009d3a 100644 --- a/packages/@angular/cli/commands/test.ts +++ b/packages/@angular/cli/commands/test.ts @@ -15,7 +15,6 @@ export interface TestOptions { log?: string; port?: number; reporters?: string; - build?: boolean; sourcemap?: boolean; progress?: boolean; config: string; @@ -85,12 +84,6 @@ const TestCommand = EmberTestCommand.extend({ type: String, description: 'List of reporters to use.' }, - { - name: 'build', - type: Boolean, - default: true, - description: 'Build prior to running tests.' - }, { name: 'sourcemap', type: Boolean, From 1e7d519d045127921e7ab3d4b1d6e94afd122a3f Mon Sep 17 00:00:00 2001 From: Charles Lyding Date: Sun, 5 Mar 2017 14:01:30 -0500 Subject: [PATCH 28/47] fix(@angular/cli): only adjust root relative stylesheet urls Close #5238 --- packages/@angular/cli/models/webpack-configs/styles.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/models/webpack-configs/styles.ts b/packages/@angular/cli/models/webpack-configs/styles.ts index fa53e3165b85..f3666c8b7545 100644 --- a/packages/@angular/cli/models/webpack-configs/styles.ts +++ b/packages/@angular/cli/models/webpack-configs/styles.ts @@ -48,8 +48,8 @@ export function getStylesConfig(wco: WebpackConfigOptions) { const deployUrl = wco.buildOptions.deployUrl; const postcssUrlOptions = { url: (URL: string) => { - // Only convert absolute URLs, which CSS-Loader won't process into require(). - if (!URL.startsWith('/')) { + // Only convert root relative URLs, which CSS-Loader won't process into require(). + if (!URL.startsWith('/') || URL.startsWith('//')) { return URL; } // Join together base-href, deploy-url and the original URL. From 2828ab4bcc04b3c55ada5776a9505600ba2ffe0d Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Tue, 7 Mar 2017 17:10:14 +0100 Subject: [PATCH 29/47] docs(@angular/cli): fix typos in options documentation Close #5283 --- docs/documentation/build.md | 4 ++-- docs/documentation/generate/interface.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/documentation/build.md b/docs/documentation/build.md index 67f0ac7c8f80..31f41dd2a9f0 100644 --- a/docs/documentation/build.md +++ b/docs/documentation/build.md @@ -103,8 +103,8 @@ or `ng serve --prod` will also make use of uglifying and tree-shaking functional `--target` (`-t`) Defines the build target. -`--vendor-chunk` (`-vb`) Use a separate bundle containing only vendor libraries. +`--vendor-chunk` (`-vc`) Use a separate bundle containing only vendor libraries. `--verbose` (`-v`) Adds more details to output logging. -`--watch` (`-w`) Run build when files change. \ No newline at end of file +`--watch` (`-w`) Run build when files change. diff --git a/docs/documentation/generate/interface.md b/docs/documentation/generate/interface.md index 7884e716e428..57a798de5d74 100644 --- a/docs/documentation/generate/interface.md +++ b/docs/documentation/generate/interface.md @@ -8,4 +8,4 @@ ## Options `--app` Specifies app name or index to use. -`type` Pptional String to specify the type of interface. +`type` Optional String to specify the type of interface. From afbddfe348e532c48d272cf9b4273b9ef7af06c7 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Wed, 8 Mar 2017 13:42:11 -0500 Subject: [PATCH 30/47] docs(@angular/cli): document serving the app from disk Closes #4290 Close #5308 --- docs/documentation/serve.md | 5 ++++- docs/documentation/stories.md | 1 + docs/documentation/stories/disk-serve.md | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 docs/documentation/stories/disk-serve.md diff --git a/docs/documentation/serve.md b/docs/documentation/serve.md index 253a6af29c27..057921ffc773 100644 --- a/docs/documentation/serve.md +++ b/docs/documentation/serve.md @@ -24,4 +24,7 @@ All the build Options are available in serve below are the additional options. `--ssl-cert` SSL certificate to use for serving HTTPS. -`--ssl-key` SSL key to use for serving HTTPS. \ No newline at end of file +`--ssl-key` SSL key to use for serving HTTPS. + +## Note +When running `ng serve`, the compiled output is served from memory, not from disk. This means that the application being served is not located on disk in the `dist` folder. \ No newline at end of file diff --git a/docs/documentation/stories.md b/docs/documentation/stories.md index d3faa8d93447..0b605d98afe1 100644 --- a/docs/documentation/stories.md +++ b/docs/documentation/stories.md @@ -20,3 +20,4 @@ - [Routing](stories/routing) - [3rd Party Lib](stories/third-party-lib) - [Corporate Proxy](stories/using-corporate-proxy) + - [Serve from Disk](stories/disk-serve) diff --git a/docs/documentation/stories/disk-serve.md b/docs/documentation/stories/disk-serve.md new file mode 100644 index 000000000000..b3f4663b630b --- /dev/null +++ b/docs/documentation/stories/disk-serve.md @@ -0,0 +1,23 @@ +# Serve from Disk + +The CLI supports running a live browser reload experience to users by running `ng serve`. This will compile the application upon file saves and reload the browser with the newly compiled application. This is done by hosting the application in memory and serving it via [webpack-dev-server](https://webpack.js.org/guides/development/#webpack-dev-server). + +If you wish to get a similar experience with the application output to disk please use the steps below. This practice will allow you to ensure that serving the contents of your `dist` dir will be closer to how your application will behave when it is deployed. + +## Environment Setup +### Install a web server +You will not be using webpack-dev-server, so you will need to install a web server for the browser to request the application. There are many to choose from but a good one to try is [lite-server](https://github.com/johnpapa/lite-server) as it will auto-reload your browser when new files are output. + +## Usage +You will need two terminals to get the live-reload experience. The first will run the build in a watch mode to compile the application to the `dist` folder. The second will run the web server against the `dist` folder. The combination of these two processes will mimic the same behavior of ng serve. + +### 1st terminal - Start the build +```bash +ng build --watch +``` + +### 2nd terminal - Start the web server +```bash +lite-server --baseDir="dist" +``` +When using `lite-server` the default browser will open to the appropriate URL. From 1f8363a95a19ab70bd99769aed904983d8878bfa Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Thu, 9 Mar 2017 11:42:58 -0500 Subject: [PATCH 31/47] fix(@angular/cli): Fixing set prefix issue (#5301) --- packages/@angular/cli/commands/set.ts | 10 +++++++++- .../json-schema/src/schema-class-factory.ts | 8 +++++++- tests/e2e/tests/commands/get/get.ts | 13 +++++++++++++ tests/e2e/tests/commands/set/set.ts | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/tests/commands/get/get.ts create mode 100644 tests/e2e/tests/commands/set/set.ts diff --git a/packages/@angular/cli/commands/set.ts b/packages/@angular/cli/commands/set.ts index f5de2ba9f056..f916aaf60615 100644 --- a/packages/@angular/cli/commands/set.ts +++ b/packages/@angular/cli/commands/set.ts @@ -64,7 +64,7 @@ const SetCommand = Command.extend({ case 'number': value = this.asNumber(rawValue); break; case 'string': value = rawValue; break; - default: value = JSON.parse(rawValue); + default: value = parseValue(rawValue, jsonPath); } config.set(jsonPath, value); @@ -74,4 +74,12 @@ const SetCommand = Command.extend({ } }); +function parseValue(rawValue: string, path: string) { + try { + return JSON.parse(rawValue); + } catch (error) { + throw new SilentError(`No node found at path ${path}`); + } +} + export default SetCommand; diff --git a/packages/@ngtools/json-schema/src/schema-class-factory.ts b/packages/@ngtools/json-schema/src/schema-class-factory.ts index eebde99abf8c..effe0b0ab903 100644 --- a/packages/@ngtools/json-schema/src/schema-class-factory.ts +++ b/packages/@ngtools/json-schema/src/schema-class-factory.ts @@ -51,7 +51,13 @@ function _getSchemaNodeForPath(rootMetaData: SchemaTreeNode, let fragments = _parseJsonPath(path); // TODO: make this work with union (oneOf) schemas return fragments.reduce((md: SchemaTreeNode, current: string) => { - return md && md.children && md.children[current]; + if (md && md.children) { + return md.children[current]; + } else if (md && md.items) { + return md.items[parseInt(current, 10)]; + } else { + return md; + } }, rootMetaData); } diff --git a/tests/e2e/tests/commands/get/get.ts b/tests/e2e/tests/commands/get/get.ts new file mode 100644 index 000000000000..b66fb2e9ceb1 --- /dev/null +++ b/tests/e2e/tests/commands/get/get.ts @@ -0,0 +1,13 @@ +import {ng} from '../../../utils/process'; +import {expectToFail} from '../../../utils/utils'; + +export default function() { + return Promise.resolve() + .then(() => expectToFail(() => ng('get', 'apps.zzz.prefix'))) + .then(() => ng('get', 'apps.0.prefix')) + .then(({ stdout }) => { + if (!stdout.match(/app/)) { + throw new Error(`Expected "app", received "${JSON.stringify(stdout)}".`); + } + }); +} diff --git a/tests/e2e/tests/commands/set/set.ts b/tests/e2e/tests/commands/set/set.ts new file mode 100644 index 000000000000..da82c129e46b --- /dev/null +++ b/tests/e2e/tests/commands/set/set.ts @@ -0,0 +1,14 @@ +import {ng} from '../../../utils/process'; +import {expectToFail} from '../../../utils/utils'; + +export default function() { + return Promise.resolve() + .then(() => expectToFail(() => ng('set', 'apps.zzz.prefix'))) + .then(() => ng('set', 'apps.0.prefix' , 'new-prefix')) + .then(() => ng('get', 'apps.0.prefix')) + .then(({ stdout }) => { + if (!stdout.match(/new-prefix/)) { + throw new Error(`Expected "new-prefix", received "${JSON.stringify(stdout)}".`); + } + }); +} From 9b70fda0b2a7b60069cb5775a2a087d61c95058f Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Thu, 9 Mar 2017 17:00:04 -0500 Subject: [PATCH 32/47] fix(@angular/cli): add missing alias for guard blueprint (#5339) Fixes #5336 --- packages/@angular/cli/commands/generate.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@angular/cli/commands/generate.ts b/packages/@angular/cli/commands/generate.ts index 830a93a2d35d..ac3f3208d7b4 100644 --- a/packages/@angular/cli/commands/generate.ts +++ b/packages/@angular/cli/commands/generate.ts @@ -57,6 +57,7 @@ const aliasMap: { [alias: string]: string } = { 'c': 'component', 'd': 'directive', 'e': 'enum', + 'g': 'guard', 'i': 'interface', 'm': 'module', 'p': 'pipe', From c8e5359733badf6f057d9a743453684b066faa25 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Fri, 10 Mar 2017 06:31:10 -0500 Subject: [PATCH 33/47] fix(@angular/cli): remove providers from routing modules (#5349) --- .../module/files/__path__/__name__-routing.module.ts | 3 +-- .../cli/blueprints/ng/files/__path__/app/app-routing.module.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/@angular/cli/blueprints/module/files/__path__/__name__-routing.module.ts b/packages/@angular/cli/blueprints/module/files/__path__/__name__-routing.module.ts index 2d4459211035..9d822650edbb 100644 --- a/packages/@angular/cli/blueprints/module/files/__path__/__name__-routing.module.ts +++ b/packages/@angular/cli/blueprints/module/files/__path__/__name__-routing.module.ts @@ -5,7 +5,6 @@ const routes: Routes = []; @NgModule({ imports: [RouterModule.forChild(routes)], - exports: [RouterModule], - providers: [] + exports: [RouterModule] }) export class <%= classifiedModuleName %>RoutingModule { } diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/app/app-routing.module.ts b/packages/@angular/cli/blueprints/ng/files/__path__/app/app-routing.module.ts index 03f6daa60bec..5b7d25b9a403 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/app/app-routing.module.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/app/app-routing.module.ts @@ -10,7 +10,6 @@ const routes: Routes = [ @NgModule({ imports: [RouterModule.forRoot(routes)], - exports: [RouterModule], - providers: [] + exports: [RouterModule] }) export class AppRoutingModule { } From 8d8ddfced9e47003834ce8250e393cfe05b3e8e7 Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Sun, 12 Mar 2017 00:07:20 -0500 Subject: [PATCH 34/47] fix(@angular/cli): make flag values case insensitive (#5355) Fixes #5344 --- .../cli/blueprints/component/index.ts | 23 +++++++++++++++++++ .../generate/component/component-flag-case.ts | 15 ++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/e2e/tests/generate/component/component-flag-case.ts diff --git a/packages/@angular/cli/blueprints/component/index.ts b/packages/@angular/cli/blueprints/component/index.ts index 2ef24c7c102e..1cef6aa80120 100644 --- a/packages/@angular/cli/blueprints/component/index.ts +++ b/packages/@angular/cli/blueprints/component/index.ts @@ -12,6 +12,27 @@ const getFiles = Blueprint.prototype.files; const stringUtils = require('ember-cli-string-utils'); const astUtils = require('../../utilities/ast-utils'); +const viewEncapsulationMap: any = { + 'emulated': 'Emulated', + 'native': 'Native', + 'none': 'None' +}; + +const changeDetectionMap: any = { + 'default': 'Default', + 'onpush': 'OnPush' +}; + +function correctCase(options: any) { + if (options.viewEncapsulation) { + options.viewEncapsulation = viewEncapsulationMap[options.viewEncapsulation.toLowerCase()]; + } + + if (options.changeDetection) { + options.changeDetection = changeDetectionMap[options.changeDetection.toLowerCase()]; + } +} + export default Blueprint.extend({ description: '', @@ -146,6 +167,8 @@ export default Blueprint.extend({ options.changeDetection = options.changeDetection !== undefined ? options.changeDetection : CliConfig.getValue('defaults.component.changeDetection'); + correctCase(options); + return { dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''), flat: options.flat, diff --git a/tests/e2e/tests/generate/component/component-flag-case.ts b/tests/e2e/tests/generate/component/component-flag-case.ts new file mode 100644 index 000000000000..dbbee3525756 --- /dev/null +++ b/tests/e2e/tests/generate/component/component-flag-case.ts @@ -0,0 +1,15 @@ +import {join} from 'path'; +import {ng} from '../../../utils/process'; +import {expectFileToMatch} from '../../../utils/fs'; + + +export default function() { + const compDir = join('src', 'app', 'test'); + + return Promise.resolve() + .then(() => ng('generate', 'component', 'test', '-cd', 'onpush', '-ve', 'emulated')) + .then(() => expectFileToMatch(join(compDir, 'test.component.ts'), + /changeDetection: ChangeDetectionStrategy.OnPush/)) + .then(() => expectFileToMatch(join(compDir, 'test.component.ts'), + /encapsulation: ViewEncapsulation.Emulated/)); +} From 042a62629bd3ab23df69ca284a1f64e83326a5ec Mon Sep 17 00:00:00 2001 From: John Papa Date: Sat, 11 Mar 2017 12:18:43 -0500 Subject: [PATCH 35/47] docs(@angular/cli): fixing broken ng doc link in wiki ng docs --> ng doc --- docs/documentation/home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/documentation/home.md b/docs/documentation/home.md index 9eff31bf00e8..ac127dc9d9d3 100644 --- a/docs/documentation/home.md +++ b/docs/documentation/home.md @@ -50,7 +50,7 @@ End-to-end tests are run via [Protractor](https://angular.github.io/protractor/) * [ng e2e](e2e) * [ng build](build) * [ng get/ng set](config) -* [ng docs](docs) +* [ng doc](doc) * [ng eject](eject) ### Additional Information From df89180f79460eb2284189f85e5e32028c278ec8 Mon Sep 17 00:00:00 2001 From: Christophe Vidal Date: Mon, 13 Mar 2017 11:07:30 +0700 Subject: [PATCH 36/47] style: blueprint consistency (#5392) --- packages/@angular/cli/blueprints/ng/files/README.md | 1 + packages/@angular/cli/blueprints/ng/files/gitignore | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@angular/cli/blueprints/ng/files/README.md b/packages/@angular/cli/blueprints/ng/files/README.md index 69fb9c4a7b2b..2280408509ad 100755 --- a/packages/@angular/cli/blueprints/ng/files/README.md +++ b/packages/@angular/cli/blueprints/ng/files/README.md @@ -3,6 +3,7 @@ This project was generated with [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 app will automatically reload if you change any of the source files. ## Code scaffolding diff --git a/packages/@angular/cli/blueprints/ng/files/gitignore b/packages/@angular/cli/blueprints/ng/files/gitignore index 2171ced556d5..6708ebc05606 100755 --- a/packages/@angular/cli/blueprints/ng/files/gitignore +++ b/packages/@angular/cli/blueprints/ng/files/gitignore @@ -37,6 +37,6 @@ testem.log /e2e/*.js /e2e/*.map -#System Files +# System Files .DS_Store Thumbs.db From 00fe4cc84b480f5a727a66b825b7122a79217a45 Mon Sep 17 00:00:00 2001 From: John Papa Date: Fri, 10 Mar 2017 15:45:26 -0500 Subject: [PATCH 37/47] docs(@angular/cli): services are provided, not declared docs(@angular/cli): services are provided, not declared --- docs/documentation/generate/service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/documentation/generate/service.md b/docs/documentation/generate/service.md index 5bdad34d299e..9d7d3a02af85 100644 --- a/docs/documentation/generate/service.md +++ b/docs/documentation/generate/service.md @@ -10,6 +10,6 @@ `--flat` Flag to indicate if a dir is created. -`--module` (`-m`) Allows specification of the declaring module. +`--module` (`-m`) Allows you to specify the module where the service should be provided -`--spec` Specifies if a spec file is generated. \ No newline at end of file +`--spec` Specifies if a spec file is generated. From 7461528b5f550059bebfa5a0663aa8cb3bc4c4e2 Mon Sep 17 00:00:00 2001 From: Hans Date: Sun, 12 Mar 2017 15:15:38 -0700 Subject: [PATCH 38/47] fix(@angular/cli): eject command removes EOF Notably `package.json` and `tsconfig.json`. Fixed #5387. --- packages/@angular/cli/tasks/eject.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/tasks/eject.ts b/packages/@angular/cli/tasks/eject.ts index ee24ec85da10..d1fe967b56af 100644 --- a/packages/@angular/cli/tasks/eject.ts +++ b/packages/@angular/cli/tasks/eject.ts @@ -501,7 +501,7 @@ export default Task.extend({ packageJson['devDependencies'][packageName] = ourPackageJson['dependencies'][packageName]; }); - return writeFile('package.json', JSON.stringify(packageJson, null, 2)); + return writeFile('package.json', JSON.stringify(packageJson, null, 2) + '\n'); }) .then(() => JSON.parse(ts.sys.readFile(tsConfigPath))) .then((tsConfigJson: any) => { @@ -512,7 +512,7 @@ export default Task.extend({ '**/*.spec.ts' ]; } - return writeFile(tsConfigPath, JSON.stringify(tsConfigJson, null, 2)); + return writeFile(tsConfigPath, JSON.stringify(tsConfigJson, null, 2) + '\n'); }) // Output the webpack.config.js. .then(() => writeFile('webpack.config.js', webpackConfigStr)) From 5b1668f9ba39175e0f57fe23df6672ec40c3b745 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 10 Mar 2017 10:27:11 +0000 Subject: [PATCH 39/47] docs: add style include paths docs This feature was introduce in #4003 but never documented. --- docs/documentation/stories/global-styles.md | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/documentation/stories/global-styles.md b/docs/documentation/stories/global-styles.md index c6ca901bdd42..b5313fcb82cc 100644 --- a/docs/documentation/stories/global-styles.md +++ b/docs/documentation/stories/global-styles.md @@ -26,3 +26,27 @@ You can also rename the output and lazy load it by using the object format: { "input": "pre-rename-style.scss", "output": "renamed-style" }, ], ``` + +In Sass and Stylus you can also make use of the `includePaths` functionality for both component and +global styles, which allows you to add extra base paths that will be checked for imports. + +To add paths, use the `stylePreprocessorOptions` entry in angular-cli.json `app` object: + +``` +"stylePreprocessorOptions": { + "includePaths": [ + "style-paths" + ] +}, +``` + +Files in that folder, e.g. `src/style-paths/_variables.scss`, can be imported from anywhere in your +project without the need for a relative path: + +``` +// src/app/app.component.scss +// A relative path works +@import '../style-paths/variables'; +// But now this works as well +@import 'variables'; +``` \ No newline at end of file From 501e97438462216d84447ef76f5ec7276d66e845 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 10 Mar 2017 18:22:22 +0000 Subject: [PATCH 40/47] fix(@angular/cli): don't break deployUrl with scheme Fix #5254 --- .../cli/models/webpack-configs/styles.ts | 16 +++++++++++----- tests/e2e/tests/build/css-urls.ts | 9 ++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/@angular/cli/models/webpack-configs/styles.ts b/packages/@angular/cli/models/webpack-configs/styles.ts index f3666c8b7545..c4722e60e566 100644 --- a/packages/@angular/cli/models/webpack-configs/styles.ts +++ b/packages/@angular/cli/models/webpack-configs/styles.ts @@ -44,17 +44,23 @@ export function getStylesConfig(wco: WebpackConfigOptions) { const cssnanoPlugin = cssnano({ safe: true, autoprefixer: false }); // Convert absolute resource URLs to account for base-href and deploy-url. - const baseHref = wco.buildOptions.baseHref; - const deployUrl = wco.buildOptions.deployUrl; + const baseHref = wco.buildOptions.baseHref || ''; + const deployUrl = wco.buildOptions.deployUrl || ''; const postcssUrlOptions = { url: (URL: string) => { // Only convert root relative URLs, which CSS-Loader won't process into require(). if (!URL.startsWith('/') || URL.startsWith('//')) { return URL; } - // Join together base-href, deploy-url and the original URL. - // Also dedupe multiple slashes into single ones. - return `/${baseHref || ''}/${deployUrl || ''}/${URL}`.replace(/\/\/+/g, '/'); + + if (deployUrl.match(/:\/\//)) { + // If deployUrl contains a scheme, ignore baseHref use deployUrl as is. + return `${deployUrl.replace(/\/$/, '')}${URL}`; + } else { + // Join together base-href, deploy-url and the original URL. + // Also dedupe multiple slashes into single ones. + return `/${baseHref}/${deployUrl}/${URL}`.replace(/\/\/+/g, '/'); + } } }; const urlPlugin = postcssUrl(postcssUrlOptions); diff --git a/tests/e2e/tests/build/css-urls.ts b/tests/e2e/tests/build/css-urls.ts index 4248769cfc48..80a49862f662 100644 --- a/tests/e2e/tests/build/css-urls.ts +++ b/tests/e2e/tests/build/css-urls.ts @@ -47,7 +47,14 @@ export default function () { .then(() => expectToFail(() => expectFileToExist('dist/component-img-absolute.svg'))) .then(() => expectFileMatchToExist('./dist', /global-img-relative\.[0-9a-f]{20}\.svg/)) .then(() => expectFileMatchToExist('./dist', /component-img-relative\.[0-9a-f]{20}\.svg/)) - // Also check with base-href and deploy-url flags. + // Check urls with scheme are used as is. + .then(() => ng('build', '--base-href=/base/', '--deploy-url=http://deploy.url/', + '--extract-css')) + .then(() => expectFileToMatch('dist/styles.bundle.css', + /url\(\'http:\/\/deploy\.url\/assets\/global-img-absolute\.svg\'\)/)) + .then(() => expectFileToMatch('dist/main.bundle.js', + /url\(\'http:\/\/deploy\.url\/assets\/component-img-absolute\.svg\'\)/)) + // Check with base-href and deploy-url flags. .then(() => ng('build', '--base-href=/base/', '--deploy-url=deploy/', '--extract-css', '--aot')) .then(() => expectFileToMatch('dist/styles.bundle.css', From 8a1b1f979be52cf5ffe2582ce27d0bc9f4e14611 Mon Sep 17 00:00:00 2001 From: Dominic Watson Date: Thu, 9 Mar 2017 20:51:15 +0100 Subject: [PATCH 41/47] fix(@angular/cli): fix ide import errors --- packages/@angular/cli/blueprints/ng/files/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@angular/cli/blueprints/ng/files/tsconfig.json b/packages/@angular/cli/blueprints/ng/files/tsconfig.json index 1f9b55851bec..a35a8ee3a40d 100644 --- a/packages/@angular/cli/blueprints/ng/files/tsconfig.json +++ b/packages/@angular/cli/blueprints/ng/files/tsconfig.json @@ -2,6 +2,7 @@ "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", + "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", From 7f0333a19aed097a141538fa6e3c1fbb6f1a678b Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Thu, 9 Mar 2017 11:01:41 -0500 Subject: [PATCH 42/47] fix(@angular/cli): Fixing generate help command fix --- packages/@angular/cli/commands/generate.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@angular/cli/commands/generate.ts b/packages/@angular/cli/commands/generate.ts index ac3f3208d7b4..c0581c46c526 100644 --- a/packages/@angular/cli/commands/generate.ts +++ b/packages/@angular/cli/commands/generate.ts @@ -26,13 +26,13 @@ const GenerateCommand = EmberGenerateCommand.extend({ // map the blueprint name to allow for aliases rawArgs[0] = mapBlueprintName(rawArgs[0]); - if (rawArgs[0] !== '--help' && - !fs.existsSync(path.join(__dirname, '..', 'blueprints', rawArgs[0]))) { + const isHelp: boolean = ['--help', '-h'].indexOf(rawArgs[0]) > -1; + if (!isHelp && !fs.existsSync(path.join(__dirname, '..', 'blueprints', rawArgs[0]))) { SilentError.debugOrThrow('@angular/cli/commands/generate', `Invalid blueprint: ${rawArgs[0]}`); } - if (!rawArgs[1]) { + if (!isHelp && !rawArgs[1]) { SilentError.debugOrThrow('@angular/cli/commands/generate', `The \`ng generate ${rawArgs[0]}\` command requires a name to be specified.`); } From b6cc79c42063c7a3b37be8474a1b57ff0cc86492 Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Thu, 9 Mar 2017 11:33:06 -0500 Subject: [PATCH 43/47] fix(@angular/cli): Fixing aliases for blueprint help --- packages/@angular/cli/blueprints/class/index.ts | 1 + packages/@angular/cli/blueprints/component/index.ts | 1 + packages/@angular/cli/blueprints/directive/index.ts | 1 + packages/@angular/cli/blueprints/enum/index.ts | 1 + packages/@angular/cli/blueprints/guard/index.ts | 1 + packages/@angular/cli/blueprints/interface/index.ts | 1 + packages/@angular/cli/blueprints/module/index.ts | 1 + packages/@angular/cli/blueprints/pipe/index.ts | 1 + packages/@angular/cli/blueprints/service/index.ts | 1 + .../@angular/cli/ember-cli/lib/utilities/printable-properties.js | 1 + 10 files changed, 10 insertions(+) diff --git a/packages/@angular/cli/blueprints/class/index.ts b/packages/@angular/cli/blueprints/class/index.ts index 0b4ffe85eeb7..72486aa0ba0f 100644 --- a/packages/@angular/cli/blueprints/class/index.ts +++ b/packages/@angular/cli/blueprints/class/index.ts @@ -8,6 +8,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['cl'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/component/index.ts b/packages/@angular/cli/blueprints/component/index.ts index 1cef6aa80120..45fc2f41d514 100644 --- a/packages/@angular/cli/blueprints/component/index.ts +++ b/packages/@angular/cli/blueprints/component/index.ts @@ -35,6 +35,7 @@ function correctCase(options: any) { export default Blueprint.extend({ description: '', + aliases: ['c'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/directive/index.ts b/packages/@angular/cli/blueprints/directive/index.ts index 50ddaf00c0d7..691dbd0876b5 100644 --- a/packages/@angular/cli/blueprints/directive/index.ts +++ b/packages/@angular/cli/blueprints/directive/index.ts @@ -14,6 +14,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['d'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/enum/index.ts b/packages/@angular/cli/blueprints/enum/index.ts index 94ddb8d5f4ab..eb0475fcd299 100644 --- a/packages/@angular/cli/blueprints/enum/index.ts +++ b/packages/@angular/cli/blueprints/enum/index.ts @@ -6,6 +6,7 @@ const Blueprint = require('../../ember-cli/lib/models/blueprint'); export default Blueprint.extend({ description: '', + aliases: ['e'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/guard/index.ts b/packages/@angular/cli/blueprints/guard/index.ts index 52652086ff09..04ab6977b5d0 100644 --- a/packages/@angular/cli/blueprints/guard/index.ts +++ b/packages/@angular/cli/blueprints/guard/index.ts @@ -14,6 +14,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['g'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/interface/index.ts b/packages/@angular/cli/blueprints/interface/index.ts index 46f73c7cba7b..2c6cea3bba55 100644 --- a/packages/@angular/cli/blueprints/interface/index.ts +++ b/packages/@angular/cli/blueprints/interface/index.ts @@ -7,6 +7,7 @@ const Blueprint = require('../../ember-cli/lib/models/blueprint'); export default Blueprint.extend({ description: '', + aliases: ['i'], anonymousOptions: [ '' diff --git a/packages/@angular/cli/blueprints/module/index.ts b/packages/@angular/cli/blueprints/module/index.ts index 3332033cc503..0fd1326fa591 100644 --- a/packages/@angular/cli/blueprints/module/index.ts +++ b/packages/@angular/cli/blueprints/module/index.ts @@ -8,6 +8,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['m'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/pipe/index.ts b/packages/@angular/cli/blueprints/pipe/index.ts index 99c50281a8fe..95676266a57d 100644 --- a/packages/@angular/cli/blueprints/pipe/index.ts +++ b/packages/@angular/cli/blueprints/pipe/index.ts @@ -14,6 +14,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['p'], availableOptions: [ { diff --git a/packages/@angular/cli/blueprints/service/index.ts b/packages/@angular/cli/blueprints/service/index.ts index bb41938f3532..5443238603e1 100644 --- a/packages/@angular/cli/blueprints/service/index.ts +++ b/packages/@angular/cli/blueprints/service/index.ts @@ -14,6 +14,7 @@ const getFiles = Blueprint.prototype.files; export default Blueprint.extend({ description: '', + aliases: ['s'], availableOptions: [ { diff --git a/packages/@angular/cli/ember-cli/lib/utilities/printable-properties.js b/packages/@angular/cli/ember-cli/lib/utilities/printable-properties.js index 21b6b5b63f07..2fe13f045493 100644 --- a/packages/@angular/cli/ember-cli/lib/utilities/printable-properties.js +++ b/packages/@angular/cli/ember-cli/lib/utilities/printable-properties.js @@ -10,6 +10,7 @@ var commandProperties = [ ]; var blueprintProperties = [ 'name', + 'aliases', 'description', 'availableOptions', 'anonymousOptions', From 7e2c04f4e647e778c8f8ccc3ea2407857946a33d Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Thu, 9 Mar 2017 15:49:29 -0500 Subject: [PATCH 44/47] fix(@angular/cli): Fixing setting enums --- packages/@angular/cli/lib/config/schema.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/lib/config/schema.json b/packages/@angular/cli/lib/config/schema.json index 2b7515cb56a7..1f0d464a59f2 100644 --- a/packages/@angular/cli/lib/config/schema.json +++ b/packages/@angular/cli/lib/config/schema.json @@ -337,11 +337,13 @@ }, "viewEncapsulation": { "description": "Specifies the view encapsulation strategy.", - "enum": ["Emulated", "Native", "None"] + "enum": ["Emulated", "Native", "None"], + "type": "string" }, "changeDetection": { "description": "Specifies the change detection strategy.", - "enum": ["Default", "OnPush"] + "enum": ["Default", "OnPush"], + "type": "string" } } }, From 6cb3a5fd15e41e23b3276b3fff4bcdbc640be57d Mon Sep 17 00:00:00 2001 From: Olivier Combe Date: Mon, 13 Mar 2017 09:50:09 +0100 Subject: [PATCH 45/47] docs(@angular/cli): add i18n commands and story --- docs/documentation/home.md | 1 + docs/documentation/serve.md | 2 +- docs/documentation/stories.md | 1 + .../stories/internationalization.md | 72 +++++++++++++++++++ docs/documentation/xi18n.md | 21 ++++++ 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 docs/documentation/stories/internationalization.md create mode 100644 docs/documentation/xi18n.md diff --git a/docs/documentation/home.md b/docs/documentation/home.md index ac127dc9d9d3..de912fc3a752 100644 --- a/docs/documentation/home.md +++ b/docs/documentation/home.md @@ -52,6 +52,7 @@ End-to-end tests are run via [Protractor](https://angular.github.io/protractor/) * [ng get/ng set](config) * [ng doc](doc) * [ng eject](eject) +* [ng xi18n](xi18n) ### Additional Information There are several [stories](stories) which will walk you through setting up diff --git a/docs/documentation/serve.md b/docs/documentation/serve.md index 057921ffc773..6d722294bdc7 100644 --- a/docs/documentation/serve.md +++ b/docs/documentation/serve.md @@ -5,7 +5,7 @@ ## Overview `ng serve` builds the application and starts a web server -All the build Options are available in serve below are the additional options. +All the build Options are available in serve, below are the additional options. ## Options `--host` (`-H`) Listens only on localhost by default. diff --git a/docs/documentation/stories.md b/docs/documentation/stories.md index 0b605d98afe1..558df442ccf9 100644 --- a/docs/documentation/stories.md +++ b/docs/documentation/stories.md @@ -20,4 +20,5 @@ - [Routing](stories/routing) - [3rd Party Lib](stories/third-party-lib) - [Corporate Proxy](stories/using-corporate-proxy) + - [Internationalization (i18n)](stories/internationalization) - [Serve from Disk](stories/disk-serve) diff --git a/docs/documentation/stories/internationalization.md b/docs/documentation/stories/internationalization.md new file mode 100644 index 000000000000..259d90d048fd --- /dev/null +++ b/docs/documentation/stories/internationalization.md @@ -0,0 +1,72 @@ +# Internationalization (i18n) + +If you are working on internationalization, the CLI can help you with the following steps: +- extraction +- serve +- build + +The first thing that you have to do is to setup your application to use i18n. +To do that you can follow [the cookbook on angular.io](https://angular.io/docs/ts/latest/cookbook/i18n.html). + +### Extraction +When your app is ready, you can extract the strings to translate from your templates with the +`ng xi18n` command. + +By default it will create a file named `messages.xlf` in your `src` folder. +You can use [parameters from the xi18n command](../xi18n) to change the format, +the name, the location and the source locale of the extracted file. + +For example to create a file in the `src/locale` folder you would use: +```sh +ng xi18n --output-path src/locale +``` + +### Serve +Now that you have generated a messages bundle source file, you can translate it. +Let's say that your file containing the french translations is named `messages.fr.xlf` +and is located in the `src/locale` folder. +If you want to use it when you serve your application you can use the 3 following commands: +- `--i18n-file` Localization file to use for i18n. +- `--i18n-format` Format of the localization file specified with --i18n-file. +- `--locale` Locale to use for i18n. + +In our case we can load the french translations with the following command: +```sh +ng serve --aot --locale fr --i18n-format xlf --i18n-file src/locale/messages.fr.xlf +``` + +Our application is exactly the same but the `LOCALE_ID` has been provided with "fr", +`TRANSLATIONS_FORMAT` with "xlf" and `TRANSLATIONS` with the content of `messages.fr.xlf`. +All the strings flagged for i18n have been replaced with their french translations. + +Note: this only works for AOT, if you want to use i18n in JIT you will have to update +your bootstrap file yourself. + +### Build +To build your application with a specific locale you can use the exact same commands +that you used for `serve`: +```sh +ng build --aot --locale fr --i18n-format xlf --i18n-file src/i18n/messages.fr.xlf +``` + +When you build your application for a specific locale, it is probably a good idea to change +the output path with the command `--output-path` in order to save the files to a different location. + +```sh +ng build --aot --output-path dist/fr --locale fr --i18n-format xlf --i18n-file src/i18n/messages.fr.xlf +``` + +If you end up serving this specific version from a subdirectory, you can also change +the base url used by your application with the command `--base-href`. + +For example if the french version of your application is served from https://myapp.com/fr/ +then you would build the french version like this: + +```sh +ng build --aot --output-path dist/fr --base-href fr --locale fr --i18n-format xlf --i18n-file src/i18n/messages.fr.xlf +``` + +If you need more details about how to create scripts to generate the app in multiple +languages and how to setup Apache 2 to serve them from different subdirectories, +you can read [this great tutorial](https://medium.com/@feloy/deploying-an-i18n-angular-app-with-angular-cli-fc788f17e358#.1xq4iy6fp) +by Philippe Martin. \ No newline at end of file diff --git a/docs/documentation/xi18n.md b/docs/documentation/xi18n.md new file mode 100644 index 000000000000..fa2285d7be78 --- /dev/null +++ b/docs/documentation/xi18n.md @@ -0,0 +1,21 @@ + + +# ng xi18n + +## Overview +`ng xi18n` Extracts i18n messages from the templates. + +## Options +`--i18n-format` (`-f`) Output format for the generated file: either `xmb` or `xlf`. + +`--output-path` (`-op`) Path where output will be placed. + +`--locale` (`-l`) Specifies the source language of the application. + +`--outfile` (`-of`) Name of the file to output. + +`--verbose` Adds more details to output logging. + +`--progress` Log progress to the console while running. + +`--app` (`-a`) Specifies app name to use. \ No newline at end of file From 2a808e582af908d6f02276bf2c16d5c66081e845 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 8 Mar 2017 15:03:54 +0100 Subject: [PATCH 46/47] docs: removed outdated notice --- docs/documentation/stories/routing.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/documentation/stories/routing.md b/docs/documentation/stories/routing.md index 5d5b3b0c7239..504a62e6f07e 100644 --- a/docs/documentation/stories/routing.md +++ b/docs/documentation/stories/routing.md @@ -8,6 +8,4 @@ The CLI supports routing in several ways: The file includes an empty `Routes` object that you can fill with routes to different components and/or modules. - The `--routing` option also generates a default component with the same name as the module. - -- You can use the `--routing` option with `ng new` to create a `app-routing.module.ts` file when you create or initialize a project. \ No newline at end of file +- You can use the `--routing` option with `ng new` to create a `app-routing.module.ts` file when you create or initialize a project. From 1594f104c00b298018605f7791b4ed7b04460eec Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Mon, 13 Mar 2017 16:54:59 -0700 Subject: [PATCH 47/47] v1.0.0-rc.2 --- CHANGELOG.md | 34 ++++++++++++++++++++++ package.json | 2 +- packages/@angular/cli/package.json | 4 +-- packages/@ngtools/json-schema/package.json | 2 +- packages/@ngtools/webpack/package.json | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d84eff3468be..ff9b20b7ae72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ + +# [1.0.0-rc.2](https://github.com/angular/angular-cli/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2017-03-13) + +### Bug Fixes + +* **@angular/cli:** add missing alias for guard blueprint ([#5339](https://github.com/angular/angular-cli/issues/5339)) ([9b70fda](https://github.com/angular/angular-cli/commit/9b70fda)), closes [#5336](https://github.com/angular/angular-cli/issues/5336) +* **@angular/cli:** Align tsconfig output dir to out-tsc. Add out-tsc to .gitignore ([e9372d3](https://github.com/angular/angular-cli/commit/e9372d3)), closes [#5220](https://github.com/angular/angular-cli/issues/5220) +* **@angular/cli:** don't break deployUrl with scheme ([501e974](https://github.com/angular/angular-cli/commit/501e974)), closes [#5254](https://github.com/angular/angular-cli/issues/5254) +* **@angular/cli:** eject command removes EOF ([7461528](https://github.com/angular/angular-cli/commit/7461528)), closes [#5387](https://github.com/angular/angular-cli/issues/5387) +* **@angular/cli:** enforce loglevel warn for npm-install ([07e93c0](https://github.com/angular/angular-cli/commit/07e93c0)), closes [#5010](https://github.com/angular/angular-cli/issues/5010) +* **@angular/cli:** ensure lint generates well-formed machine output ([c99cf96](https://github.com/angular/angular-cli/commit/c99cf96)), closes [#5259](https://github.com/angular/angular-cli/issues/5259) [#5224](https://github.com/angular/angular-cli/issues/5224) +* **@angular/cli:** fix e2e after eject ([3b39843](https://github.com/angular/angular-cli/commit/3b39843)), closes [#4957](https://github.com/angular/angular-cli/issues/4957) +* **@angular/cli:** Fix filtering files on completion ([cf14a15](https://github.com/angular/angular-cli/commit/cf14a15)), closes [#4664](https://github.com/angular/angular-cli/issues/4664) [#4972](https://github.com/angular/angular-cli/issues/4972) +* **@angular/cli:** fix ide import errors ([8a1b1f9](https://github.com/angular/angular-cli/commit/8a1b1f9)) +* **@angular/cli:** fix issue with console prompt bailing early ([#5218](https://github.com/angular/angular-cli/issues/5218)) ([3515c3b](https://github.com/angular/angular-cli/commit/3515c3b)), closes [#4614](https://github.com/angular/angular-cli/issues/4614) [#5127](https://github.com/angular/angular-cli/issues/5127) +* **@angular/cli:** fix TS2.1 typeroots ([#5251](https://github.com/angular/angular-cli/issues/5251)) ([1c2f361](https://github.com/angular/angular-cli/commit/1c2f361)), closes [#5082](https://github.com/angular/angular-cli/issues/5082) +* **@angular/cli:** Fixing aliases for blueprint help ([b6cc79c](https://github.com/angular/angular-cli/commit/b6cc79c)) +* **@angular/cli:** Fixing generate help command fix ([7f0333a](https://github.com/angular/angular-cli/commit/7f0333a)) +* **@angular/cli:** Fixing set prefix issue ([#5301](https://github.com/angular/angular-cli/issues/5301)) ([1f8363a](https://github.com/angular/angular-cli/commit/1f8363a)) +* **@angular/cli:** Fixing setting enums ([7e2c04f](https://github.com/angular/angular-cli/commit/7e2c04f)) +* **@angular/cli:** karma config is default for test command ([#5263](https://github.com/angular/angular-cli/issues/5263)) ([c2a8569](https://github.com/angular/angular-cli/commit/c2a8569)) +* **@angular/cli:** Log xi18n errors ([a54115c](https://github.com/angular/angular-cli/commit/a54115c)), closes [#5129](https://github.com/angular/angular-cli/issues/5129) [#5223](https://github.com/angular/angular-cli/issues/5223) +* **@angular/cli:** make flag values case insensitive ([#5355](https://github.com/angular/angular-cli/issues/5355)) ([8d8ddfc](https://github.com/angular/angular-cli/commit/8d8ddfc)), closes [#5344](https://github.com/angular/angular-cli/issues/5344) +* **@angular/cli:** only adjust root relative stylesheet urls ([1e7d519](https://github.com/angular/angular-cli/commit/1e7d519)), closes [#5238](https://github.com/angular/angular-cli/issues/5238) +* **@angular/cli:** remove outdated test command option `--build` ([fcb1f35](https://github.com/angular/angular-cli/commit/fcb1f35)), closes [#5235](https://github.com/angular/angular-cli/issues/5235) +* **@angular/cli:** remove providers from routing modules ([#5349](https://github.com/angular/angular-cli/issues/5349)) ([c8e5359](https://github.com/angular/angular-cli/commit/c8e5359)) +* **@angular/cli:** rephrased warning message ([e314135](https://github.com/angular/angular-cli/commit/e314135)), closes [#5006](https://github.com/angular/angular-cli/issues/5006) +* **@angular/cli:** use inheritance for ng4 ([7c3ce6b](https://github.com/angular/angular-cli/commit/7c3ce6b)), closes [#5111](https://github.com/angular/angular-cli/issues/5111) +* **@angular/cli:** yarn install does not support --quiet ([#5310](https://github.com/angular/angular-cli/issues/5310)) ([5e54a01](https://github.com/angular/angular-cli/commit/5e54a01)) +* **@angular/cli:** bump to tslint 4.5.0 ([a78a727](https://github.com/angular/angular-cli/commit/a78a727)), closes [#5099](https://github.com/angular/angular-cli/issues/5099) +* **@angular/cli:** use standard stackTraceLimit ([#5284](https://github.com/angular/angular-cli/issues/5284)) ([5c9c653](https://github.com/angular/angular-cli/commit/5c9c653)) + + + # [1.0.0-rc.1](https://github.com/angular/angular-cli/compare/v1.0.0-rc.0...v1.0.0-rc.1) (2017-03-03) diff --git a/package.json b/package.json index ed1f5b972552..ca4f36bba85f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@angular/cli", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "description": "CLI tool for Angular", "main": "packages/@angular/cli/lib/cli/index.js", "trackingCode": "UA-8594346-19", diff --git a/packages/@angular/cli/package.json b/packages/@angular/cli/package.json index c4c545cb90d6..5be43c2c98fa 100644 --- a/packages/@angular/cli/package.json +++ b/packages/@angular/cli/package.json @@ -1,6 +1,6 @@ { "name": "@angular/cli", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "description": "CLI tool for Angular", "main": "lib/cli/index.js", "trackingCode": "UA-8594346-19", @@ -32,7 +32,7 @@ "@angular/core": ">=2.3.1 <5.0.0 || >=4.0.0-beta <5.0.0", "@angular/tsc-wrapped": ">=0.5.0 <5.0.0 || >=4.0.0-beta <5.0.0", "@ngtools/json-schema": "1.0.5", - "@ngtools/webpack": "1.2.12", + "@ngtools/webpack": "1.2.13", "autoprefixer": "^6.5.3", "chalk": "^1.1.3", "common-tags": "^1.3.1", diff --git a/packages/@ngtools/json-schema/package.json b/packages/@ngtools/json-schema/package.json index da3317464c87..24717c22c3a6 100644 --- a/packages/@ngtools/json-schema/package.json +++ b/packages/@ngtools/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@ngtools/json-schema", - "version": "1.0.6", + "version": "1.0.7", "description": "Schema validating and reading for configurations, similar to Angular CLI config.", "main": "./src/index.js", "typings": "src/index.d.ts", diff --git a/packages/@ngtools/webpack/package.json b/packages/@ngtools/webpack/package.json index d06c23942a2f..e04d30bc7c9d 100644 --- a/packages/@ngtools/webpack/package.json +++ b/packages/@ngtools/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@ngtools/webpack", - "version": "1.2.12", + "version": "1.2.13", "description": "Webpack plugin that AoT compiles your Angular components and modules.", "main": "./src/index.js", "typings": "src/index.d.ts",