diff --git a/CHANGELOG.md b/CHANGELOG.md index 45bd63dd3a09..4a9e221aca32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +# [1.0.0-beta.15](https://github.com/angular/angular-cli/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2016-09-20) + + +### Bug Fixes + +* **help:** fix a bug where help was not available inside a project. ([#2146](https://github.com/angular/angular-cli/issues/2146)) ([5b880b2](https://github.com/angular/angular-cli/commit/5b880b2)) +* pin beta package versions ([#2236](https://github.com/angular/angular-cli/issues/2236)) ([638a54b](https://github.com/angular/angular-cli/commit/638a54b)), closes [#2234](https://github.com/angular/angular-cli/issues/2234) + + + # [1.0.0-beta.14](https://github.com/angular/angular-cli/compare/v1.0.0-beta.11-webpack.2...v1.0.0-beta.14) (2016-09-15) diff --git a/README.md b/README.md index 7b602a961a00..41284f42db97 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,13 @@ This project is very much still a work in progress. The CLI is now in beta. If you wish to collaborate while the project is still young, check out [our issue list](https://github.com/angular/angular-cli/issues). -## Webpack preview release update +## Webpack update -We're updating the build system in Angular-CLI to use webpack instead of Broccoli. +We changed the build system between beta.10 and beta.12, from SystemJS to Webpack. +And with it comes a lot of benefits. +To take advantage of these, your app built with the old beta will need to migrate. -You can install and update your projects using [these instructions](https://github.com/angular/angular-cli/blob/master/WEBPACK_UPDATE.md). - -**The current instructions on this file reflect usage for the `webpack` version.** +You can update your `beta.10` projects to `beta.12` by following [these instructions](https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14). ## Prerequisites diff --git a/WEBPACK_UPDATE.md b/WEBPACK_UPDATE.md deleted file mode 100644 index 9a03299f45d2..000000000000 --- a/WEBPACK_UPDATE.md +++ /dev/null @@ -1,58 +0,0 @@ -# Upgrading from angular-cli@1.0.0-beta.10 to the angular-cli@webpack - -To update `angular-cli` to the webpack preview, you must update both the global package, project's local package and your project files. - -## Global package: -``` -npm uninstall -g angular-cli -npm cache clean -npm install -g angular-cli@webpack -``` - -## Local project package: -``` -# commit any changes you have to git first -rm -rf node_modules dist tmp typings -npm install --save-dev angular-cli@webpack -``` - -## Project files - -You will need to run `ng init` to check for changes in all the auto-generated files created by `ng new` and allow you to update yours. You are offered four choices for each changed file: `y` (overwrite), `n` (don't overwrite), `d` (show diff between your file and the updated file) and `h` (help). - -Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes. - -You can find a sample github diff of the changes introduced between a beta.10 and webpack preview project at https://github.com/filipesilva/angular-cli-webpack-upgrade/commit/HEAD. - -Here is a summary of the file changes: - -1. Updated files: - * `./config/karma.conf.js` - `frameworks`/`plugins`/`files`/`exclude`/`preprocessors` entries changed, added `angularCliConfig` entry. - * `./e2e/tsconfig.json` - property cleanup, changed `outdir`, added `typeRoots` - * `./angular-cli.json` - updated version entry. - * `./README.md` - updated version entry, removed route from generator list. - * `./package.json` - removed typings postinstall script, removed `ember-cli-inject-live-reload`/`es6-shim`/`systemjs` dependencies, added `core-js`/`ts-helpers` dependencies, updated `angular-cli`/`codelyzer`/`ts-node`/`ts-lint`/`typescript` devDependencies, added `@types/jasmine`/`@types/protractor`/`karma-coverage` devDependencies. - * `./src/app/app.component.ts` (and all other components) - removed `module.id`, sass/less/stylus preprocessing now uses the real extension in `styleUrls` instead of `.css`. - * `./src/app/index.ts` - import adjusted due to environment files moving (see below). - * `./src/index.html` - removed templating tags and `SystemJS` import script. - * `./src/app/tsconfig.json` - property cleanup, changed `outdir`/`module`, added `libs`/`typeRoots`/`types` - * `./src/typings.d.ts` - added `System`/`require` typings, removed `typings` ref -1. Mobile app updated files: - * `./package.json` - local versions of `angular2-universal` now used by the build system, updated package versions. - * `./src/index.html` - moved service worker code to build system, hardcoded icons. - * `./src/main-app-shell.ts` - reworked to interface with the build system, see comments in file. -1. New files: - * `./src/polyfills.ts` - loads needed polyfills before main app - * `./src/test.ts` - unit test spec loader -1. These files have moved to `./src/app/environments/`: - * `./config/environment.dev.ts` - * `./config/environment.prod.ts` - * `./src/app/environment.ts` - -Lastly, you can delete these files as they are not needed anymore. - * `./config/karma-test-shim.js` - * `./config/environment.js` - * `./src/system-config.ts` - * `./angular-cli-build.js` - * `./typings.json` - * `./.clang-format` (if present) \ No newline at end of file diff --git a/package.json b/package.json index 19f41fcf125a..0f061d2b7463 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-cli", - "version": "1.0.0-beta.14", + "version": "1.0.0-beta.15", "description": "CLI tool for Angular", "main": "packages/angular-cli/lib/cli/index.js", "trackingCode": "UA-8594346-19", @@ -91,7 +91,7 @@ "remap-istanbul": "^0.6.4", "resolve": "^1.1.7", "rimraf": "^2.5.3", - "rxjs": "^5.0.0-beta.12", + "rxjs": "5.0.0-beta.12", "sass-loader": "^3.2.0", "script-loader": "^0.7.0", "shelljs": "^0.7.0", @@ -109,8 +109,8 @@ "typedoc": "^0.4.2", "typescript": "2.0.2", "url-loader": "^0.5.7", - "webpack": "^2.1.0-beta.22", - "webpack-dev-server": "^2.1.0-beta.3", + "webpack": "2.1.0-beta.22", + "webpack-dev-server": "2.1.0-beta.3", "webpack-md5-hash": "0.0.5", "webpack-merge": "^0.14.0", "zone.js": "^0.6.23" diff --git a/packages/angular-cli/commands/help.ts b/packages/angular-cli/commands/help.ts index 06c5773ba1c2..b87c2cd9bbde 100644 --- a/packages/angular-cli/commands/help.ts +++ b/packages/angular-cli/commands/help.ts @@ -15,12 +15,14 @@ const commandsToIgnore = [ const HelpCommand = Command.extend({ name: 'help', description: 'Shows help for the CLI', - works: 'outsideProject', + works: 'everywhere', availableOptions: [], run: function (commandOptions: any) { let commandFiles = fs.readdirSync(__dirname) + // Remove files that are not JavaScript + .filter(file => file.match(/\.js$/)) .map(file => path.parse(file).name) .map(file => file.toLowerCase()); diff --git a/packages/angular-cli/models/webpack-build-common.ts b/packages/angular-cli/models/webpack-build-common.ts index 684e573b65b8..6de3b9d3f6c0 100644 --- a/packages/angular-cli/models/webpack-build-common.ts +++ b/packages/angular-cli/models/webpack-build-common.ts @@ -117,7 +117,7 @@ export function getWebpackCommonConfig(        { test: /\.(jpg|png|gif)$/, loader: 'url-loader?limit=10000' },        { test: /\.html$/, loader: 'raw-loader' }, - { test: /\.(woff|ttf|svg)$/, loader: 'url?limit=10000' }, + { test: /\.(otf|woff|ttf|svg)$/, loader: 'url?limit=10000' }, { test: /\.woff2$/, loader: 'url?limit=10000&mimetype=font/woff2' }, { test: /\.eot$/, loader: 'file' } ] diff --git a/packages/angular-cli/package.json b/packages/angular-cli/package.json index 0a719b4db0ff..3ce25ae89fa4 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.14", + "version": "1.0.0-beta.15", "description": "CLI tool for Angular", "main": "lib/cli/index.js", "trackingCode": "UA-8594346-19", @@ -73,7 +73,7 @@ "remap-istanbul": "^0.6.4", "resolve": "^1.1.7", "rimraf": "^2.5.3", - "rxjs": "^5.0.0-beta.12", + "rxjs": "5.0.0-beta.12", "sass-loader": "^3.2.0", "script-loader": "^0.7.0", "shelljs": "^0.7.0", @@ -91,8 +91,8 @@ "typedoc": "^0.4.2", "typescript": "2.0.2", "url-loader": "^0.5.7", - "webpack": "^2.1.0-beta.22", - "webpack-dev-server": "^2.1.0-beta.3", + "webpack": "2.1.0-beta.22", + "webpack-dev-server": "2.1.0-beta.3", "webpack-md5-hash": "0.0.5", "webpack-merge": "^0.14.0", "zone.js": "^0.6.23" diff --git a/packages/ast-tools/package.json b/packages/ast-tools/package.json index 6641fb7a9f4f..cb551bfe1586 100644 --- a/packages/ast-tools/package.json +++ b/packages/ast-tools/package.json @@ -20,7 +20,7 @@ }, "homepage": "https://github.com/angular/angular-cli", "dependencies": { - "rxjs": "^5.0.0-beta.11", + "rxjs": "5.0.0-beta.11", "denodeify": "^1.2.1", "typescript": "2.0.0" } diff --git a/packages/ast-tools/src/route-utils.spec.ts b/packages/ast-tools/src/route-utils.spec.ts index c9d83b87ef21..fb221f20013c 100644 --- a/packages/ast-tools/src/route-utils.spec.ts +++ b/packages/ast-tools/src/route-utils.spec.ts @@ -84,6 +84,20 @@ describe('route utils', () => { expect(newContent).toEqual(`import { Router } from '@angular/router';\n`); }); }); + it('inserts subcomponent in win32 environment', () => { + let content = './level1\\level2/level2.component'; + return nru.insertImport(sourceFile, 'level2', content).apply() + .then(() => readFile(sourceFile, 'utf8')) + .then(newContent => { + if (process.platform.startsWith('win')) { + expect(newContent).toEqual( + `import { level2 } from './level1/level2/level2.component';\n`); + } else { + expect(newContent).toEqual( + `import { level2 } from './level1\\level2/level2.component';\n`); + } + }); + }); }); describe('bootstrapItem', () => { @@ -124,7 +138,7 @@ describe('route utils', () => { .then(content => { expect(content).toEqual( `import routes from './routes'; - import { provideRouter } from '@angular/router'; + import { provideRouter } from '@angular/router'; bootstrap(AppComponent, [ provideRouter(routes) ]);`); }); }); @@ -299,7 +313,7 @@ export default [ children: [ { path: 'about', component: AboutComponent, children: [ - { path: 'details', component: DetailsComponent }, + { path: 'details', component: DetailsComponent }, { path: 'more', component: MoreComponent } ] } @@ -327,7 +341,7 @@ export default [ children: [ { path: 'more', component: MoreComponent, children: [ - { path: 'sections', component: SectionsComponent } + { path: 'sections', component: SectionsComponent } ] } ] @@ -359,7 +373,7 @@ export default [ { path: 'main', component: MainComponent } { path: 'home', component: HomeComponent, children: [ - { path: 'about/:id', component: AboutComponent_1 }, + { path: 'about/:id', component: AboutComponent_1 }, { path: 'about', component: AboutComponent } ] } @@ -447,7 +461,7 @@ export default [ export default [ { path: 'home', component: HomeComponent, children: [ - { path: 'trap-queen', component: TrapQueenComponent }, + { path: 'trap-queen', component: TrapQueenComponent }, { path: 'about', component: AboutComponent, children: [ { path: 'more', component: MoreComponent } @@ -478,7 +492,7 @@ import { HomeComponent as HomeComponent_1 } from './app/home/home/home.component export default [ { path: 'home', component: HomeComponent, children: [ - { path: 'home', component: HomeComponent_1 } + { path: 'home', component: HomeComponent_1 } ] } ];`; @@ -487,7 +501,7 @@ export default [ }); it('throws error if components collide and there is repitition', () => { let editedFile = new InsertChange(routesFile, 16, - `\n { path: 'about', component: AboutComponent, + `\n { path: 'about', component: AboutComponent, children: [ { path: 'details/:id', component: DetailsComponent_1 }, { path: 'details', component: DetailsComponent } @@ -543,7 +557,7 @@ import { DetailsComponent as DetailsComponent_1 } from './app/about/description/ export default [ { path: 'home', component: HomeComponent, children: [ - { path: 'more', component: MoreComponent, canDeactivate: [ MyGuard ], useAsDefault: true } + { path: 'more', component: MoreComponent, canDeactivate: [ MyGuard ], useAsDefault: true } ] } ];` diff --git a/packages/ast-tools/src/route-utils.ts b/packages/ast-tools/src/route-utils.ts index fc9fd8ed4ac4..db40e0a41766 100644 --- a/packages/ast-tools/src/route-utils.ts +++ b/packages/ast-tools/src/route-utils.ts @@ -79,6 +79,9 @@ export function bootstrapItem( export function insertImport(fileToEdit: string, symbolName: string, fileName: string, isDefault = false): Change { + if (process.platform.startsWith('win')) { + fileName = fileName.replace(/\\/g, '/'); // correction in windows + } let rootNode = getRootNode(fileToEdit); let allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration); diff --git a/scripts/publish/build.js b/scripts/publish/build.js index 01a79a91f804..b5bda9d3a951 100755 --- a/scripts/publish/build.js +++ b/scripts/publish/build.js @@ -55,7 +55,7 @@ Promise.resolve() }, Promise.resolve()); }) .then(() => console.log('Copying uncompiled resources...')) - .then(() => glob(path.join(packagesRoot, '**/*'))) + .then(() => glob(path.join(packagesRoot, '**/*'), { dot: true })) .then(files => { console.log(` Found ${files.length} files...`); return files @@ -88,8 +88,8 @@ Promise.resolve() // The only remaining file we want to ignore is tsconfig and spec files. return !(/tsconfig\.json$/.test(fileName)) - && !(/\.spec\./.test(fileName)) - && !(/[\/\\]tests[\/\\]/.test(fileName)); + && !(/\.spec\./.test(fileName)) + && !(/[\/\\]tests[\/\\]/.test(fileName)); }) .map((fileName) => { const source = path.join(packagesRoot, fileName); diff --git a/tests/e2e/setup/100-npm-link.ts b/tests/e2e/setup/100-npm-link.ts index c53dabd511b1..fbe66d23b70c 100644 --- a/tests/e2e/setup/100-npm-link.ts +++ b/tests/e2e/setup/100-npm-link.ts @@ -1,8 +1,19 @@ +import {join} from 'path'; import {npm, exec} from '../utils/process'; export default function (argv: any) { return Promise.resolve() - .then(() => argv.nolink || npm('link')) + .then(() => { + if (argv.nolink) { + return; + } + + const distAngularCli = join(__dirname, '../../../dist/angular-cli'); + const oldCwd = process.cwd(); + process.chdir(distAngularCli); + return npm('link') + .then(() => process.chdir(oldCwd)); + }) .then(() => exec(process.platform.startsWith('win') ? 'where' : 'which', 'ng')); } diff --git a/tests/e2e/setup/500-create-project.ts b/tests/e2e/setup/500-create-project.ts index 5ac58970a25e..dd7fb0481a26 100644 --- a/tests/e2e/setup/500-create-project.ts +++ b/tests/e2e/setup/500-create-project.ts @@ -25,11 +25,10 @@ export default function(argv: any) { return Promise.resolve() .then(() => createProject) .then(() => updateJsonFile('package.json', json => { - const dist = '../../../dist/'; - json['devDependencies']['angular-cli'] = join(__dirname, dist, 'angular-cli'); - json['devDependencies']['@angular-cli/ast-tools'] = join(__dirname, dist, 'ast-tools'); - json['devDependencies']['@angular-cli/base-href-webpack'] = - join(__dirname, dist, 'base-href-webpack'); + const dist = join(__dirname, '../../../dist/'); + json['devDependencies']['angular-cli'] = join(dist, 'angular-cli'); + json['devDependencies']['@angular-cli/ast-tools'] = join(dist, 'ast-tools'); + json['devDependencies']['@angular-cli/base-href-webpack'] = join(dist, 'base-href-webpack'); })) .then(() => { if (argv.nightly) { diff --git a/tests/e2e/tests/commands/help.ts b/tests/e2e/tests/commands/help.ts new file mode 100644 index 000000000000..ad268b78ab64 --- /dev/null +++ b/tests/e2e/tests/commands/help.ts @@ -0,0 +1,11 @@ +import {silentNg} from '../../utils/process'; + + +export default function() { + const projectDir = process.cwd(); + return Promise.resolve() + .then(() => silentNg('help')) + .then(() => process.chdir('/')) + .then(() => silentNg('help')) + .then(() => process.chdir(projectDir)); +} diff --git a/tests/e2e/utils/process.ts b/tests/e2e/utils/process.ts index 75543f58180a..d8d9a69be1d8 100644 --- a/tests/e2e/utils/process.ts +++ b/tests/e2e/utils/process.ts @@ -13,6 +13,7 @@ let _processes: child_process.ChildProcess[] = []; function _exec(options: ExecOptions, cmd: string, args: string[]): Promise { let stdout = ''; + let stderr = ''; const cwd = process.cwd(); console.log(white( ` ==========================================================================================` @@ -42,9 +43,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise console.log(' ' + line)); }); npmProcess.stderr.on('data', (data: Buffer) => { - if (options.silent) { - return; - } + stderr += data.toString('utf-8'); data.toString('utf-8') .split(/[\n\r]+/) .filter(line => line !== '') @@ -62,7 +61,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise