diff --git a/CHANGELOG.md b/CHANGELOG.md index 307b7a129f8c..c4c4122865dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,44 @@ + +# [1.0.0-beta.25](https://github.com/angular/angular-cli/compare/v1.0.0-beta.23...v1.0.0-beta.25) (2017-01-12) + + +### Bug Fixes + +* **@ngtools/webpack:** fix tsconfig paths resolver ([#3831](https://github.com/angular/angular-cli/issues/3831)) ([c6d1c99](https://github.com/angular/angular-cli/commit/c6d1c99)), closes [#3586](https://github.com/angular/angular-cli/issues/3586) +* **@ngtools/webpack:** search recursively for entry module ([#3708](https://github.com/angular/angular-cli/issues/3708)) ([bb748f2](https://github.com/angular/angular-cli/commit/bb748f2)) +* **build:** close tags in index.html ([#3743](https://github.com/angular/angular-cli/issues/3743)) ([aaca100](https://github.com/angular/angular-cli/commit/aaca100)), closes [#3217](https://github.com/angular/angular-cli/issues/3217) +* **build:** disable performance hints ([#3808](https://github.com/angular/angular-cli/issues/3808)) ([2a513ca](https://github.com/angular/angular-cli/commit/2a513ca)) +* **build:** fix path error when appConfig has no main ([#3867](https://github.com/angular/angular-cli/issues/3867)) ([7bd165b](https://github.com/angular/angular-cli/commit/7bd165b)) +* **build/serve:** correct check against angular v2.3.1 ([#3785](https://github.com/angular/angular-cli/issues/3785)) ([d0224a5](https://github.com/angular/angular-cli/commit/d0224a5)), closes [#3720](https://github.com/angular/angular-cli/issues/3720) [#3729](https://github.com/angular/angular-cli/issues/3729) +* **config:** allow minimal config for build/serve ([#3835](https://github.com/angular/angular-cli/issues/3835)) ([f616158](https://github.com/angular/angular-cli/commit/f616158)) +* **lint:** remove tslint rule that requires type info ([#3818](https://github.com/angular/angular-cli/issues/3818)) ([1555c2b](https://github.com/angular/angular-cli/commit/1555c2b)) +* **lint:** use noUnusedParameters and noUnusedLocals instead of no-unused-variabl ([#3945](https://github.com/angular/angular-cli/issues/3945)) ([dd378fe](https://github.com/angular/angular-cli/commit/dd378fe)) +* **serve:** communicate that ng serve is not secure. ([#3646](https://github.com/angular/angular-cli/issues/3646)) ([766394d](https://github.com/angular/angular-cli/commit/766394d)) +* **serve:** fallback to config.app[0].index ([#3813](https://github.com/angular/angular-cli/issues/3813)) ([45e2985](https://github.com/angular/angular-cli/commit/45e2985)), closes [#3748](https://github.com/angular/angular-cli/issues/3748) +* **test:** remove webpack size limit warning ([#3974](https://github.com/angular/angular-cli/issues/3974)) ([b25b97d](https://github.com/angular/angular-cli/commit/b25b97d)) +* **tests:** add global scripts in karma plugin ([#3543](https://github.com/angular/angular-cli/issues/3543)) ([1153c92](https://github.com/angular/angular-cli/commit/1153c92)), closes [#2897](https://github.com/angular/angular-cli/issues/2897) + + +### Features + +* **@ngtools/json-schema:** Introduce a separate package for JSON schema. ([#3927](https://github.com/angular/angular-cli/issues/3927)) ([74f7cdd](https://github.com/angular/angular-cli/commit/74f7cdd)) +* **@ngtools/logger:** Implement a reactive logger. ([#3774](https://github.com/angular/angular-cli/issues/3774)) ([e3b48da](https://github.com/angular/angular-cli/commit/e3b48da)) +* **@ngtools/webpack:** convert dashless resource urls ([#3842](https://github.com/angular/angular-cli/issues/3842)) ([4e7b397](https://github.com/angular/angular-cli/commit/4e7b397)) +* **build:** add --extract-css flag ([#3943](https://github.com/angular/angular-cli/issues/3943)) ([87536c8](https://github.com/angular/angular-cli/commit/87536c8)) +* **build:** add publicPath support via command and angular-cli.json ([#3285](https://github.com/angular/angular-cli/issues/3285)) ([0ce64a4](https://github.com/angular/angular-cli/commit/0ce64a4)), closes [#3136](https://github.com/angular/angular-cli/issues/3136) [#2960](https://github.com/angular/angular-cli/issues/2960) [#2276](https://github.com/angular/angular-cli/issues/2276) [#2241](https://github.com/angular/angular-cli/issues/2241) [#3344](https://github.com/angular/angular-cli/issues/3344) +* **build:** allow output hashing to be configured ([#3885](https://github.com/angular/angular-cli/issues/3885)) ([b82fe41](https://github.com/angular/angular-cli/commit/b82fe41)) +* **build:** disable sourcemaps for production ([#3963](https://github.com/angular/angular-cli/issues/3963)) ([da1c197](https://github.com/angular/angular-cli/commit/da1c197)) +* **commands:** lazy load commands ([#3805](https://github.com/angular/angular-cli/issues/3805)) ([59e9e8f](https://github.com/angular/angular-cli/commit/59e9e8f)) +* **deploy:github-pages:** support usage of gh-token for deployment from external env ([#3121](https://github.com/angular/angular-cli/issues/3121)) ([3c82b77](https://github.com/angular/angular-cli/commit/3c82b77)) +* **generate:** add ability to specify module for import ([#3811](https://github.com/angular/angular-cli/issues/3811)) ([e2b051f](https://github.com/angular/angular-cli/commit/e2b051f)), closes [#3806](https://github.com/angular/angular-cli/issues/3806) +* **lint:** now lint e2e ts files as well ([#3941](https://github.com/angular/angular-cli/issues/3941)) ([f84e220](https://github.com/angular/angular-cli/commit/f84e220)) +* **new:** add --skip-tests flag to ng new/init to skip creating spec files ([#3825](https://github.com/angular/angular-cli/issues/3825)) ([4c2f06a](https://github.com/angular/angular-cli/commit/4c2f06a)) +* **new:** add flag to prevent initial git commit ([#3712](https://github.com/angular/angular-cli/issues/3712)) ([2e2377d](https://github.com/angular/angular-cli/commit/2e2377d)) +* **new:** show name of created project in output ([#3795](https://github.com/angular/angular-cli/issues/3795)) ([888beb7](https://github.com/angular/angular-cli/commit/888beb7)) +* **version:** compare local and global version and warn users. ([#3693](https://github.com/angular/angular-cli/issues/3693)) ([8b47a90](https://github.com/angular/angular-cli/commit/8b47a90)) + + + # [1.0.0-beta.24](https://github.com/angular/angular-cli/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2016-12-20) diff --git a/package.json b/package.json index 3c481bf3af3c..1a1ffdbd6cc2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-cli", - "version": "1.0.0-beta.24", + "version": "1.0.0-beta.25", "description": "CLI tool for Angular", "main": "packages/angular-cli/lib/cli/index.js", "trackingCode": "UA-8594346-19", diff --git a/packages/@angular-cli/ast-tools/package.json b/packages/@angular-cli/ast-tools/package.json index f065befb69d9..a06725e5d29c 100644 --- a/packages/@angular-cli/ast-tools/package.json +++ b/packages/@angular-cli/ast-tools/package.json @@ -1,6 +1,6 @@ { "name": "@angular-cli/ast-tools", - "version": "1.0.11", + "version": "1.0.14", "description": "CLI tool for Angular", "main": "./src/index.js", "keywords": [ diff --git a/packages/@angular-cli/base-href-webpack/package.json b/packages/@angular-cli/base-href-webpack/package.json index 6a69d21a485f..7f824985f5b6 100644 --- a/packages/@angular-cli/base-href-webpack/package.json +++ b/packages/@angular-cli/base-href-webpack/package.json @@ -1,6 +1,6 @@ { "name": "@angular-cli/base-href-webpack", - "version": "1.0.10", + "version": "1.0.14", "description": "Base HREF Webpack plugin", "main": "./src/index.js", "keywords": [ diff --git a/packages/@ngtools/json-schema/package.json b/packages/@ngtools/json-schema/package.json index a1bf952ca658..84e0f2c10052 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.2.1", + "version": "1.0.0", "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/logger/package.json b/packages/@ngtools/logger/package.json index 2d8bc2ca1cc5..81df6be29ae0 100644 --- a/packages/@ngtools/logger/package.json +++ b/packages/@ngtools/logger/package.json @@ -1,6 +1,6 @@ { "name": "@ngtools/logger", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "./src/index.js", "license": "MIT", diff --git a/packages/@ngtools/webpack/package.json b/packages/@ngtools/webpack/package.json index 5de8debadece..9a89a9cf3104 100644 --- a/packages/@ngtools/webpack/package.json +++ b/packages/@ngtools/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@ngtools/webpack", - "version": "1.2.1", + "version": "1.2.3", "description": "Webpack plugin that AoT compiles your Angular components and modules.", "main": "./src/index.js", "typings": "src/index.d.ts", diff --git a/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.__styleext__ b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.__styleext__ new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.html b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.html new file mode 100644 index 000000000000..03d27b3e4b1f --- /dev/null +++ b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.html @@ -0,0 +1,14 @@ +
+

<%= dasherizedModuleName %>

+ + + +
+ This is the main container +
+ + + + + +
diff --git a/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.spec.ts b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.spec.ts new file mode 100644 index 000000000000..87c13788850e --- /dev/null +++ b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.spec.ts @@ -0,0 +1,28 @@ +/* tslint:disable:no-unused-variable */ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +import { <%= classifiedModuleName %>Dialog } from './<%= dasherizedModuleName %>.dialog'; + +describe('<%= classifiedModuleName %>Dialog', () => { + let component: <%= classifiedModuleName %>Dialog; + let fixture: ComponentFixture<<%= classifiedModuleName %>Dialog>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ <%= classifiedModuleName %>Dialog ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(<%= classifiedModuleName %>Dialog); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect( component ).toBeTruthy(); + }); +}); diff --git a/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.ts b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.ts new file mode 100644 index 000000000000..8cc2e8333f8c --- /dev/null +++ b/packages/angular-cli/blueprints/dialog/files/__path__/__name__.dialog.ts @@ -0,0 +1,28 @@ +import { Component, OnInit<% if(viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection) { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; +import { MdDialogRef } from '@angular/material'; + +@Component({ + selector: '<%= selector %>',<% if(inlineTemplate) { %> + template: ` +

+ <%= dasherizedModuleName %> Works! +

+ `,<% } else { %> + templateUrl: './<%= dasherizedModuleName %>.dialog.html',<% } if(inlineStyle) { %> + styles: []<% } else { %> + styleUrls: [ './<%= dasherizedModuleName %>.dialog.<%= styleExt %>' ]<% } %><% if(viewEncapsulation) { %>, + encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection) { %>, + changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> +}) +export class <%= classifiedModuleName %>Dialog implements OnInit { + + constructor( + public dialogRef: MdDialogRef<<%= classifiedModuleName %>Dialog> + ) { } + + ngOnInit() { + } + + onSubmit() { + } +} diff --git a/packages/angular-cli/blueprints/dialog/index.js b/packages/angular-cli/blueprints/dialog/index.js new file mode 100644 index 000000000000..8c0a6b5f7a03 --- /dev/null +++ b/packages/angular-cli/blueprints/dialog/index.js @@ -0,0 +1,170 @@ +const path = require('path'); +const fs = require('fs'); +const chalk = require('chalk'); +const Blueprint = require('../../ember-cli/lib/models/blueprint'); +const dynamicPathParser = require('../../utilities/dynamic-path-parser'); +const findParentModule = require('../../utilities/find-parent-module').default; +const getFiles = Blueprint.prototype.files; +const stringUtils = require('ember-cli-string-utils'); +const astUtils = require('../../utilities/ast-utils'); +const NodeHost = require('@angular-cli/ast-tools').NodeHost; + +module.exports = { + description: '', + + availableOptions: [ + { name: 'flat', type: Boolean, default: false }, + { name: 'inline-template', type: Boolean, aliases: ['it'] }, + { name: 'inline-style', type: Boolean, aliases: ['is'] }, + { name: 'prefix', type: String, default: null }, + { name: 'spec', type: Boolean }, + { name: 'view-encapsulation', type: String, aliases: ['ve'] }, + { name: 'change-detection', type: String, aliases: ['cd'] }, + { name: 'skip-import', type: Boolean, default: false }, + { name: 'module', type: String, aliases: ['m'] } + ], + + beforeInstall: function(options) { + if (options.module) { + // Resolve path to module + const modulePath = options.module.endsWith('.ts') ? options.module : `${options.module}.ts`; + const parsedPath = dynamicPathParser(this.project, modulePath); + this.pathToModule = path.join(this.project.root, parsedPath.dir, parsedPath.base); + + if (!fs.existsSync(this.pathToModule)) { + throw 'Module specified does not exist'; + } + } else { + try { + this.pathToModule = findParentModule(this.project, this.dynamicPath.dir); + } catch(e) { + if (!options.skipImport) { + throw `Error locating module for declaration\n\t${e}`; + } + } + } + }, + + normalizeEntityName: function (entityName) { + var parsedPath = dynamicPathParser(this.project, entityName); + + this.dynamicPath = parsedPath; + + var defaultPrefix = ''; + if (this.project.ngConfig && + this.project.ngConfig.apps[0] && + this.project.ngConfig.apps[0].prefix) { + defaultPrefix = this.project.ngConfig.apps[0].prefix; + } + + var prefix = (this.options.prefix === 'false' || this.options.prefix === '') ? '' : (this.options.prefix || defaultPrefix); + prefix = prefix && `${prefix}-`; + + this.selector = stringUtils.dasherize(prefix + parsedPath.name); + + if (this.selector.indexOf('-') === -1) { + this._writeStatusToUI(chalk.yellow, 'WARNING', 'selectors should contain a dash'); + } + + return parsedPath.name; + }, + + locals: function (options) { + this.styleExt = 'css'; + if (this.project.ngConfig && + this.project.ngConfig.defaults && + this.project.ngConfig.defaults.styleExt) { + this.styleExt = this.project.ngConfig.defaults.styleExt; + } + + options.inlineStyle = options.inlineStyle !== undefined ? + options.inlineStyle : + this.project.ngConfigObj.get('defaults.inline.style'); + + options.inlineTemplate = options.inlineTemplate !== undefined ? + options.inlineTemplate : + this.project.ngConfigObj.get('defaults.inline.template'); + + options.spec = options.spec !== undefined ? + options.spec : + this.project.ngConfigObj.get('defaults.spec.component'); + + options.viewEncapsulation = options.viewEncapsulation !== undefined ? + options.viewEncapsulation : + this.project.ngConfigObj.get('defaults.viewEncapsulation'); + + options.changeDetection = options.changeDetection !== undefined ? + options.changeDetection : + this.project.ngConfigObj.get('defaults.changeDetection'); + + return { + dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''), + flat: options.flat, + spec: options.spec, + inlineTemplate: options.inlineTemplate, + inlineStyle: options.inlineStyle, + route: options.route, + isAppComponent: !!options.isAppComponent, + selector: this.selector, + styleExt: this.styleExt, + viewEncapsulation: options.viewEncapsulation, + changeDetection: options.changeDetection + }; + }, + + files: function() { + var fileList = getFiles.call(this); + + if (this.options && this.options.inlineTemplate) { + fileList = fileList.filter(p => p.indexOf('.html') < 0); + } + if (this.options && this.options.inlineStyle) { + fileList = fileList.filter(p => p.indexOf('.__styleext__') < 0); + } + if (this.options && !this.options.spec) { + fileList = fileList.filter(p => p.indexOf('__name__.dialog.spec.ts') < 0); + } + + return fileList; + }, + + fileMapTokens: function (options) { + // Return custom template variables here. + return { + __path__: () => { + var dir = this.dynamicPath.dir; + if (!options.locals.flat) { + dir += path.sep + options.dasherizedModuleName; + } + var srcDir = this.project.ngConfig.apps[0].root; + this.appDir = dir.substr(dir.indexOf(srcDir) + srcDir.length); + this.generatePath = dir; + return dir; + }, + __styleext__: () => { + return this.styleExt; + } + }; + }, + + afterInstall: function(options) { + if (options.dryRun) { + return; + } + + const returns = []; + const className = stringUtils.classify(`${options.entity.name}Dialog`); + const fileName = stringUtils.dasherize(`${options.entity.name}.dialog`); + const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath); + const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; + + if (!options.skipImport) { + returns.push( + astUtils.addDeclarationToModule(this.pathToModule, className, importPath) + .then(change => change.apply(NodeHost))); + this._writeStatusToUI(chalk.yellow, 'update', path.relative(this.project.root, this.pathToModule)); + } + + return Promise.all(returns); + } +}; diff --git a/packages/angular-cli/commands/generate.ts b/packages/angular-cli/commands/generate.ts index c183d99a68b4..f245fa07da4a 100644 --- a/packages/angular-cli/commands/generate.ts +++ b/packages/angular-cli/commands/generate.ts @@ -60,6 +60,7 @@ const aliasMap: { [alias: string]: string } = { 'cl': 'class', 'c': 'component', 'd': 'directive', + 'di': 'dialog', 'e': 'enum', 'i': 'interface', 'm': 'module', diff --git a/packages/angular-cli/models/webpack-build-test.js b/packages/angular-cli/models/webpack-build-test.js index a1b1dbe98ecd..8f5c2776d471 100644 --- a/packages/angular-cli/models/webpack-build-test.js +++ b/packages/angular-cli/models/webpack-build-test.js @@ -71,6 +71,7 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig, test return { devtool: testConfig.sourcemap ? 'inline-source-map' : 'eval', + performance: { hints: false }, context: projectRoot, resolve: { extensions: ['.ts', '.js'], diff --git a/packages/angular-cli/package.json b/packages/angular-cli/package.json index 316a8e173405..6187ab3fabd0 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.24", + "version": "1.0.0-beta.25.5", "description": "CLI tool for Angular", "main": "lib/cli/index.js", "trackingCode": "UA-8594346-19", @@ -25,13 +25,13 @@ }, "homepage": "https://github.com/angular/angular-cli", "dependencies": { - "@angular-cli/ast-tools": "^1.0.1", - "@angular-cli/base-href-webpack": "^1.0.0", + "@angular-cli/ast-tools": "^1.0.14", + "@angular-cli/base-href-webpack": "^1.0.14", "@angular/compiler": "^2.3.1", "@angular/compiler-cli": "^2.3.1", "@angular/core": "^2.3.1", "@ngtools/json-schema": "^1.0.0", - "@ngtools/webpack": "^1.0.0", + "@ngtools/webpack": "^1.2.3", "async": "^2.1.4", "autoprefixer": "^6.5.3", "chalk": "^1.1.3",