From 8b641dc0c183c2d9e1986e0ec85124c5e48b106b Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 22 Oct 2016 15:52:45 +0100 Subject: [PATCH 01/11] chore(tests): update webpack app compiler-cli (#2832) --- tests/e2e/assets/webpack/test-app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/assets/webpack/test-app/package.json b/tests/e2e/assets/webpack/test-app/package.json index ce591fa78450..3c53508c260d 100644 --- a/tests/e2e/assets/webpack/test-app/package.json +++ b/tests/e2e/assets/webpack/test-app/package.json @@ -4,7 +4,7 @@ "dependencies": { "@angular/common": "~2.1.0", "@angular/compiler": "~2.1.0", - "@angular/compiler-cli": "0.6.2", + "@angular/compiler-cli": "~2.1.0", "@angular/core": "~2.1.0", "@angular/http": "~2.1.0", "@angular/platform-browser": "~2.1.0", From eb63fda79c58a2637bc01ce4c0d954a87e6f0edc Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Sat, 22 Oct 2016 17:25:34 +0100 Subject: [PATCH 02/11] chore: fix editorconfig linefeeds on windows (#2829) Fix #2716 --- .editorconfig | 1 - packages/angular-cli/blueprints/ng2/files/.editorconfig | 1 - 2 files changed, 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index f1cc3ad329c5..e0f1dae3a7d9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,7 +6,6 @@ root = true charset = utf-8 indent_style = space indent_size = 2 -end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true diff --git a/packages/angular-cli/blueprints/ng2/files/.editorconfig b/packages/angular-cli/blueprints/ng2/files/.editorconfig index f3526162d642..06dde115f57e 100644 --- a/packages/angular-cli/blueprints/ng2/files/.editorconfig +++ b/packages/angular-cli/blueprints/ng2/files/.editorconfig @@ -5,7 +5,6 @@ root = true charset = utf-8 indent_style = space indent_size = 2 -end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true From ea7c039cbf99a5c74fe8066f1b84579081336a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Liz=C3=A1rraga?= Date: Mon, 24 Oct 2016 00:42:31 +0200 Subject: [PATCH 03/11] Fixed dev dependencies badge link url (#2847) Added the 'type=dev' parameter will point the link to the Dev Dependencies tab in david-dm.org site. Removed the part of the url which is not needed anymore. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1956aee2b8e..d6d0cad1c12f 100644 --- a/README.md +++ b/README.md @@ -470,6 +470,6 @@ MIT [david-badge]: https://david-dm.org/angular/angular-cli.svg [david-badge-url]: https://david-dm.org/angular/angular-cli [david-dev-badge]: https://david-dm.org/angular/angular-cli/dev-status.svg -[david-dev-badge-url]: https://david-dm.org/angular/angular-cli#info=devDependencies +[david-dev-badge-url]: https://david-dm.org/angular/angular-cli?type=dev [npm-badge]: https://img.shields.io/npm/v/angular-cli.svg [npm-badge-url]: https://www.npmjs.com/package/angular-cli From 8944d0469f6863b7fd8ad287a9f172af0a9f920c Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 24 Oct 2016 13:44:48 +0100 Subject: [PATCH 04/11] feat(test): make code coverage and lint optional (#2840) Heavily inspired by @abner's work on #1799. Partially address #1980 Close #1799 --- .../blueprints/ng2/files/karma.conf.js | 4 +- packages/angular-cli/commands/test.ts | 2 + .../angular-cli/models/webpack-build-test.js | 71 ++++++++++--------- packages/angular-cli/plugins/karma.js | 11 +-- packages/angular-cli/tasks/test.ts | 5 ++ tests/e2e/tests/misc/coverage.ts | 2 +- 6 files changed, 57 insertions(+), 38 deletions(-) diff --git a/packages/angular-cli/blueprints/ng2/files/karma.conf.js b/packages/angular-cli/blueprints/ng2/files/karma.conf.js index 5c349bd00abd..1ed9667c0dc6 100644 --- a/packages/angular-cli/blueprints/ng2/files/karma.conf.js +++ b/packages/angular-cli/blueprints/ng2/files/karma.conf.js @@ -27,7 +27,9 @@ module.exports = function (config) { config: './angular-cli.json', environment: 'dev' }, - reporters: ['progress', 'karma-remap-istanbul'], + reporters: config.angularCli && config.angularCli.codeCoverage + ? ['progress', 'karma-remap-istanbul'] + : ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, diff --git a/packages/angular-cli/commands/test.ts b/packages/angular-cli/commands/test.ts index 74049b943c1c..2ac4f304d9c7 100644 --- a/packages/angular-cli/commands/test.ts +++ b/packages/angular-cli/commands/test.ts @@ -5,6 +5,8 @@ import {CliConfig} from '../models/config'; const NgCliTestCommand = TestCommand.extend({ availableOptions: [ { name: 'watch', type: Boolean, default: true, aliases: ['w'] }, + { name: 'code-coverage', type: Boolean, default: false, aliases: ['cc'] }, + { name: 'lint', type: Boolean, default: false, aliases: ['l'] }, { name: 'browsers', type: String }, { name: 'colors', type: Boolean }, { name: 'log-level', type: String }, diff --git a/packages/angular-cli/models/webpack-build-test.js b/packages/angular-cli/models/webpack-build-test.js index 9d3262f30138..c23801c3c3f0 100644 --- a/packages/angular-cli/models/webpack-build-test.js +++ b/packages/angular-cli/models/webpack-build-test.js @@ -4,9 +4,43 @@ const path = require('path'); const webpack = require('webpack'); const atl = require('awesome-typescript-loader'); -const getWebpackTestConfig = function (projectRoot, environment, appConfig) { +const getWebpackTestConfig = function (projectRoot, environment, appConfig, testConfig) { const appRoot = path.resolve(projectRoot, appConfig.root); + const extraRules = []; + const extraPlugins = []; + + if (testConfig.codeCoverage) { + extraRules.push({ + test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader', + enforce: 'post', + exclude: [ + /\.(e2e|spec)\.ts$/, + /node_modules/ + ], + query: { 'force-sourcemap': true } + }); + } + + if (testConfig.lint) { + extraRules.push({ + test: /\.ts$/, + enforce: 'pre', + loader: 'tslint-loader', + exclude: [ + path.resolve(projectRoot, 'node_modules') + ] + }); + extraPlugins.push(new webpack.LoaderOptionsPlugin({ + options: { + tslint: { + emitErrors: false, + failOnHint: false, + resourcePath: `./${appConfig.root}` + } + } + })) + } return { devtool: 'inline-source-map', @@ -28,21 +62,12 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { }, module: { rules: [ - { - test: /\.ts$/, - enforce: 'pre', - loader: 'tslint-loader', - exclude: [ - path.resolve(projectRoot, 'node_modules') - ] - }, { test: /\.js$/, enforce: 'pre', loader: 'source-map-loader', exclude: [ - path.resolve(projectRoot, 'node_modules/rxjs'), - path.resolve(projectRoot, 'node_modules/@angular') + /node_modules/ ] }, { @@ -63,23 +88,14 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { ], exclude: [/\.e2e\.ts$/] }, - { - test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader', - enforce: 'post', - exclude: [ - /\.(e2e|spec)\.ts$/, - /node_modules/ - ], - query: { 'force-sourcemap': true } - }, { test: /\.json$/, loader: 'json-loader' }, - { test: /\.css$/, loaders: ['raw-loader', 'postcss-loader'] }, + { test: /\.css$/, loaders: ['raw-loader', 'postcss-loader'] }, { test: /\.styl$/, loaders: ['raw-loader', 'postcss-loader', 'stylus-loader'] }, { test: /\.less$/, loaders: ['raw-loader', 'postcss-loader', 'less-loader'] }, { test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] }, { test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' }, { test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] } - ] + ].concat(extraRules) }, plugins: [ new webpack.SourceMapDevToolPlugin({ @@ -94,20 +110,11 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { .replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')), path.resolve(appRoot, appConfig.environments[environment]) ), - new webpack.LoaderOptionsPlugin({ - options: { - tslint: { - emitErrors: false, - failOnHint: false, - resourcePath: `./${appConfig.root}` - } - } - }), new webpack.ContextReplacementPlugin( /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, appRoot ) - ], + ].concat(extraPlugins), node: { fs: 'empty', global: true, diff --git a/packages/angular-cli/plugins/karma.js b/packages/angular-cli/plugins/karma.js index 69bf559031be..983157f3fdca 100644 --- a/packages/angular-cli/plugins/karma.js +++ b/packages/angular-cli/plugins/karma.js @@ -3,7 +3,6 @@ const getWebpackTestConfig = require('../models/webpack-build-test').getWebpackT const CliConfig = require('../models/config').CliConfig; const init = (config) => { - // load Angular CLI config if (!config.angularCli || !config.angularCli.config) { throw new Error('Missing \'angularCli.config\' entry in Karma config'); @@ -11,9 +10,13 @@ const init = (config) => { const angularCliConfig = require(path.join(config.basePath, config.angularCli.config)); const appConfig = angularCliConfig.apps[0]; const environment = config.angularCli.environment || 'dev'; + const testConfig = { + codeCoverage: config.angularCli.codeCoverage || false, + lint: config.angularCli.lint || false + } // add webpack config - const webpackConfig = getWebpackTestConfig(config.basePath, environment, appConfig); + const webpackConfig = getWebpackTestConfig(config.basePath, environment, appConfig, testConfig); const webpackMiddlewareConfig = { noInfo: true, // Hide webpack output because its noisy. stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors. @@ -40,11 +43,11 @@ const init = (config) => { .map((arr) => arr.splice(arr.indexOf('angular-cli'), 1, 'webpack', 'sourcemap')); } -init.$inject = ['config'] +init.$inject = ['config']; // dummy preprocessor, just to keep karma from showing a warning const preprocessor = () => (content, file, done) => done(null, content); -preprocessor.$inject = [] +preprocessor.$inject = []; // also export karma-webpack and karma-sourcemap-loader module.exports = Object.assign({ diff --git a/packages/angular-cli/tasks/test.ts b/packages/angular-cli/tasks/test.ts index d406df43e0c3..e539c075199a 100644 --- a/packages/angular-cli/tasks/test.ts +++ b/packages/angular-cli/tasks/test.ts @@ -20,6 +20,11 @@ export default Task.extend({ options.browsers = options.browsers.split(','); } + options.angularCli = { + codeCoverage: options.codeCoverage, + lint: options.lint, + }; + // Assign additional karmaConfig options to the local ngapp config options.configFile = karmaConfig; diff --git a/tests/e2e/tests/misc/coverage.ts b/tests/e2e/tests/misc/coverage.ts index 42d4f6e1d805..11af7537a7fb 100644 --- a/tests/e2e/tests/misc/coverage.ts +++ b/tests/e2e/tests/misc/coverage.ts @@ -3,7 +3,7 @@ import {ng} from '../../utils/process'; export default function() { - return ng('test', '--watch=false') + return ng('test', '--watch=false', '--code-coverage') .then(() => expectFileToExist('coverage/src/app')) .then(() => expectFileToExist('coverage/coverage.lcov')); } From bc0ae68524541bc11a7fe0879aead8204c14b419 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 24 Oct 2016 15:21:19 +0100 Subject: [PATCH 05/11] Revert "chore(build): use cheap-module-source-map for dev" (#2857) --- packages/angular-cli/models/webpack-build-development.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/angular-cli/models/webpack-build-development.ts b/packages/angular-cli/models/webpack-build-development.ts index ed5305df709f..f1bfd7ff6b24 100644 --- a/packages/angular-cli/models/webpack-build-development.ts +++ b/packages/angular-cli/models/webpack-build-development.ts @@ -2,7 +2,7 @@ const path = require('path'); export const getWebpackDevConfigPartial = function(projectRoot: string, appConfig: any) { return { - devtool: 'cheap-module-source-map', + devtool: 'source-map', output: { path: path.resolve(projectRoot, appConfig.outDir), filename: '[name].bundle.js', From 2b17b46482cd927f8ccd2b4a1ef4bcb6bce6e05e Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 24 Oct 2016 19:23:17 +0100 Subject: [PATCH 06/11] fix(appveyor): add workaround for webdriver bug (#2862) See https://github.com/angular/webdriver-manager/issues/107 for context. Should be reverted once issue is fixed. --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6d3c82f53721..0ba8da0abd7e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,7 +7,7 @@ matrix: fast_finish: true install: - - ps: Install-Product node $env:nodejs_version + - ps: Install-Product node $env:nodejs_version x64 - npm install -g npm - npm install From de0329a7520943dfeda16262faa96f2f07f60a41 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Tue, 25 Oct 2016 10:04:24 +0100 Subject: [PATCH 07/11] Revert "fix(appveyor): add workaround for webdriver bug" (#2869) --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0ba8da0abd7e..6d3c82f53721 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,7 +7,7 @@ matrix: fast_finish: true install: - - ps: Install-Product node $env:nodejs_version x64 + - ps: Install-Product node $env:nodejs_version - npm install -g npm - npm install From 86021a0910495e61ec8bc539001b3755e928173d Mon Sep 17 00:00:00 2001 From: Mike Brocchi Date: Tue, 25 Oct 2016 11:05:28 -0400 Subject: [PATCH 08/11] bug(generate): fix import path for directives & pipes when importing into a module (#2883) Fixes #2762 --- packages/angular-cli/blueprints/directive/index.js | 6 ++++-- packages/angular-cli/blueprints/pipe/index.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/angular-cli/blueprints/directive/index.js b/packages/angular-cli/blueprints/directive/index.js index 790c34890acf..ba53e7e95442 100644 --- a/packages/angular-cli/blueprints/directive/index.js +++ b/packages/angular-cli/blueprints/directive/index.js @@ -85,8 +85,10 @@ module.exports = { const returns = []; const className = stringUtils.classify(`${options.entity.name}Directive`); const fileName = stringUtils.dasherize(`${options.entity.name}.directive`); - const componentDir = path.relative(this.dynamicPath.appRoot, this.generatePath); - const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; + const fullGeneratePath = path.join(this.project.root, this.generatePath); + const moduleDir = path.parse(this.pathToModule).dir; + const relativeDir = path.relative(moduleDir, fullGeneratePath); + const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options['skip-import']) { returns.push( diff --git a/packages/angular-cli/blueprints/pipe/index.js b/packages/angular-cli/blueprints/pipe/index.js index d4a65b158641..12f957add718 100644 --- a/packages/angular-cli/blueprints/pipe/index.js +++ b/packages/angular-cli/blueprints/pipe/index.js @@ -73,8 +73,10 @@ module.exports = { const returns = []; const className = stringUtils.classify(`${options.entity.name}Pipe`); const fileName = stringUtils.dasherize(`${options.entity.name}.pipe`); - const componentDir = path.relative(this.dynamicPath.appRoot, this.generatePath); - const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; + const fullGeneratePath = path.join(this.project.root, this.generatePath); + const moduleDir = path.parse(this.pathToModule).dir; + const relativeDir = path.relative(moduleDir, fullGeneratePath); + const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options['skip-import']) { returns.push( From b62b996668b0f70fdd47c99f46741302bd54382f Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 27 Oct 2016 16:06:12 +0100 Subject: [PATCH 09/11] fix(e2e): fix travis e2e (#2914) --- packages/angular-cli/blueprints/ng2/files/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/angular-cli/blueprints/ng2/files/package.json b/packages/angular-cli/blueprints/ng2/files/package.json index 0dc640bdc147..211607633967 100644 --- a/packages/angular-cli/blueprints/ng2/files/package.json +++ b/packages/angular-cli/blueprints/ng2/files/package.json @@ -47,6 +47,7 @@ "protractor": "4.0.9", "ts-node": "1.2.1", "tslint": "3.13.0", - "typescript": "~2.0.3" + "typescript": "~2.0.3", + "webdriver-manager": "10.2.5" } } From b50c12197e09222908b8cd29bcb8b2c68c5a3445 Mon Sep 17 00:00:00 2001 From: Rob Wormald Date: Fri, 28 Oct 2016 09:48:26 -0400 Subject: [PATCH 10/11] fix(compiler): update codegen API (#2919) Fixes #2917. --- packages/webpack/src/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webpack/src/plugin.ts b/packages/webpack/src/plugin.ts index f01ae0fe7952..ed6f78c849c9 100644 --- a/packages/webpack/src/plugin.ts +++ b/packages/webpack/src/plugin.ts @@ -207,7 +207,7 @@ export class AotPlugin { // We need to temporarily patch the CodeGenerator until either it's patched or allows us // to pass in our own ReflectorHost. patchReflectorHost(codeGenerator); - this._donePromise = codeGenerator.codegen() + this._donePromise = codeGenerator.codegen({transitiveModules: true}) .then(() => { // Create a new Program, based on the old one. This will trigger a resolution of all // transitive modules, which include files that might just have been generated. @@ -239,7 +239,7 @@ export class AotPlugin { return lazyRoutes; }, {}); }) - .then(() => cb(), (err) => cb(err)); + .then(() => cb(), (err: any) => cb(err)); } private _resolveModule(module: ModuleRoute, containingFile: string) { From 23a6cc658aa6c342b0e2558730c3576eda4ced57 Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Fri, 28 Oct 2016 17:33:13 +0200 Subject: [PATCH 11/11] v1.0.0-beta.19 --- CHANGELOG.md | 17 +++++++++++++++++ package.json | 2 +- packages/angular-cli/package.json | 2 +- packages/ast-tools/package.json | 2 +- packages/base-href-webpack/package.json | 2 +- packages/webpack/package.json | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e45dc6f5a47..43bf0bbb9fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +# [1.0.0-beta.19](https://github.com/angular/angular-cli/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2016-10-28) + + +### Bug Fixes + +* **appveyor:** add workaround for webdriver bug ([#2862](https://github.com/angular/angular-cli/issues/2862)) ([2b17b46](https://github.com/angular/angular-cli/commit/2b17b46)) +* **compiler:** update codegen API ([#2919](https://github.com/angular/angular-cli/issues/2919)) ([b50c121](https://github.com/angular/angular-cli/commit/b50c121)), closes [#2917](https://github.com/angular/angular-cli/issues/2917) +* **e2e:** fix travis e2e ([#2914](https://github.com/angular/angular-cli/issues/2914)) ([b62b996](https://github.com/angular/angular-cli/commit/b62b996)) + + +### Features + +* **test:** make code coverage and lint optional ([#2840](https://github.com/angular/angular-cli/issues/2840)) ([8944d04](https://github.com/angular/angular-cli/commit/8944d04)), closes [#1799](https://github.com/angular/angular-cli/issues/1799) + + + # [1.0.0-beta.18](https://github.com/angular/angular-cli/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2016-10-20) diff --git a/package.json b/package.json index e64eaf95eb4a..2b7e390c35fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-cli", - "version": "1.0.0-beta.18", + "version": "1.0.0-beta.19", "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 2389600d7f14..ec0688fd3532 100644 --- a/packages/angular-cli/package.json +++ b/packages/angular-cli/package.json @@ -1,6 +1,6 @@ { "name": "angular-cli", - "version": "1.0.0-beta.18", + "version": "1.0.0-beta.19", "description": "CLI tool for Angular", "main": "lib/cli/index.js", "trackingCode": "UA-8594346-19", diff --git a/packages/ast-tools/package.json b/packages/ast-tools/package.json index 6396f0275feb..87c6a22cac04 100644 --- a/packages/ast-tools/package.json +++ b/packages/ast-tools/package.json @@ -1,6 +1,6 @@ { "name": "@angular-cli/ast-tools", - "version": "1.0.5", + "version": "1.0.6", "description": "CLI tool for Angular", "main": "./src/index.js", "keywords": [ diff --git a/packages/base-href-webpack/package.json b/packages/base-href-webpack/package.json index 89cb40dee0ab..f946b1b9456f 100644 --- a/packages/base-href-webpack/package.json +++ b/packages/base-href-webpack/package.json @@ -1,6 +1,6 @@ { "name": "@angular-cli/base-href-webpack", - "version": "1.0.4", + "version": "1.0.5", "description": "Base HREF Webpack plugin", "main": "./src/index.js", "keywords": [ diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 9043f98a3b89..27d4b5dae042 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@ngtools/webpack", - "version": "1.1.2", + "version": "1.1.3", "description": "", "main": "./src/index.js", "repository": {