Skip to content

Commit 0401677

Browse files
authored
Merge pull request angular#10 from angular/master
chore: merge September 30th 2016
2 parents 5fd4cf9 + 06976f4 commit 0401677

File tree

92 files changed

+1540
-321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1540
-321
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
> Please provide us with the following information:
22
> ---------------------------------------------------------------
33
4-
1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
4+
### OS?
5+
> Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
56
67

7-
2. Versions. Please run `ng --version`. If there's nothing outputted, please run
8-
in a Terminal: `node --version` and paste the result here:
8+
### Versions.
9+
> Please run `ng --version`. If there's nothing outputted, please run in a Terminal: `node --version` and paste the result here:
910
1011

11-
3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
12-
do on your code? etc.
12+
### Repro steps.
13+
> Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
1314
1415

15-
4. The log given by the failure. Normally this include a stack trace and some
16-
more information.
16+
### The log given by the failure.
17+
> Normally this include a stack trace and some more information.
1718
1819

19-
5. Mention any other details that might be useful.
20+
### Mention any other details that might be useful.
2021

2122
> ---------------------------------------------------------------
2223
> Thanks! We'll be in touch soon.

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
<a name="1.0.0-beta.16"></a>
2+
# [1.0.0-beta.16](https://github.com/angular/angular-cli/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2016-09-28)
3+
4+
5+
### Bug Fixes
6+
7+
* **build:** fail ng build on error ([#2360](https://github.com/angular/angular-cli/issues/2360)) ([aa48c30](https://github.com/angular/angular-cli/commit/aa48c30)), closes [#2014](https://github.com/angular/angular-cli/issues/2014)
8+
* **build:** use config output path as default ([#2158](https://github.com/angular/angular-cli/issues/2158)) ([49a120b](https://github.com/angular/angular-cli/commit/49a120b))
9+
* **generate:** Update directive.spec.ts blueprint to fix incorret import ([#1940](https://github.com/angular/angular-cli/issues/1940)) ([93da512](https://github.com/angular/angular-cli/commit/93da512))
10+
* **karma:** set defaults for karma.conf.js ([#1837](https://github.com/angular/angular-cli/issues/1837)) ([e2e94a5](https://github.com/angular/angular-cli/commit/e2e94a5))
11+
* **test:** correctly report packages spec failures ([#2238](https://github.com/angular/angular-cli/issues/2238)) ([3102453](https://github.com/angular/angular-cli/commit/3102453))
12+
13+
14+
### Features
15+
16+
* **webpackDevServer:** Add watchOptions for webpackDevServer ([#1814](https://github.com/angular/angular-cli/issues/1814)) ([ce03088](https://github.com/angular/angular-cli/commit/ce03088))
17+
18+
19+
120
<a name="1.0.0-beta.15"></a>
221
# [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)
322

README.md

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ Prototype of a CLI for Angular 2 applications based on the [ember-cli](http://ww
1313

1414
This project is very much still a work in progress.
1515

16-
The CLI is now in beta.
16+
The CLI is now in beta.
1717
If you wish to collaborate while the project is still young, check out [our issue list](https://github.com/angular/angular-cli/issues).
1818

1919
## Webpack update
2020

21-
We changed the build system between beta.10 and beta.12, from SystemJS to Webpack.
22-
And with it comes a lot of benefits.
21+
We changed the build system between beta.10 and beta.14, from SystemJS to Webpack.
22+
And with it comes a lot of benefits.
2323
To take advantage of these, your app built with the old beta will need to migrate.
2424

25-
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).
25+
You can update your `beta.10` projects to `beta.14` by following [these instructions](https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14).
2626

2727
## Prerequisites
2828

@@ -41,6 +41,7 @@ The generated project has dependencies that require **Node 4.x.x and NPM 3.x.x**
4141
* [Adding extra files to the build](#adding-extra-files-to-the-build)
4242
* [Running Unit Tests](#running-unit-tests)
4343
* [Running End-to-End Tests](#running-end-to-end-tests)
44+
* [Proxy To Backend](#proxy-to-backend)
4445
* [Deploying the App via GitHub Pages](#deploying-the-app-via-github-pages)
4546
* [Linting and formatting code](#linting-and-formatting-code)
4647
* [Support for offline applications](#support-for-offline-applications)
@@ -108,6 +109,7 @@ Service | `ng g service my-new-service`
108109
Class | `ng g class my-new-class`
109110
Interface | `ng g interface my-new-interface`
110111
Enum | `ng g enum my-new-enum`
112+
Module | `ng g module my-module`
111113

112114
### Generating a route
113115

@@ -125,8 +127,8 @@ The build artifacts will be stored in the `dist/` directory.
125127

126128
### Build Targets and Environment Files
127129

128-
`ng build` can specify both a build target (`--target=production` or `--target=development`) and an
129-
environment file to be used with that build (`--environment=dev` or `--environment=prod`).
130+
`ng build` can specify both a build target (`--target=production` or `--target=development`) and an
131+
environment file to be used with that build (`--environment=dev` or `--environment=prod`).
130132
By default, the development build target and environment are used.
131133

132134
The mapping used to determine which environment file is used can be found in `angular-cli.json`:
@@ -156,7 +158,7 @@ ng build
156158

157159
You can also add your own env files other than `dev` and `prod` by doing the following:
158160
- create a `src/environments/environment.NAME.ts`
159-
- add `{ "NAME": 'src/environments/environment.NAME.ts' }` to the the `apps[0].environments` object in `angular-cli.json`
161+
- add `{ "NAME": 'src/environments/environment.NAME.ts' }` to the the `apps[0].environments` object in `angular-cli.json`
160162
- use them via the `--env=NAME` flag on the build/serve commands.
161163

162164
### Base tag handling in index.html
@@ -171,7 +173,7 @@ ng build --bh /myUrl/
171173

172174
### Bundling
173175

174-
All builds make use of bundling, and using the `--prod` flag in `ng build --prod`
176+
All builds make use of bundling, and using the `--prod` flag in `ng build --prod`
175177
or `ng serve --prod` will also make use of uglifying and tree-shaking functionality.
176178

177179
### Running unit tests
@@ -192,6 +194,33 @@ Before running the tests make sure you are serving the app via `ng serve`.
192194

193195
End-to-end tests are run via [Protractor](https://angular.github.io/protractor/).
194196

197+
### Proxy To Backend
198+
Using the proxying support in webpack's dev server we can highjack certain urls and send them to a backend server.
199+
We do this by passing a file to `--proxy-config`
200+
201+
Say we have a server running on `http://localhost:3000/api` and we want all calls th `http://localhost:4200/api` to go to that server.
202+
203+
We create a file next to projects `package.json` called `proxy.conf.json`
204+
with the content
205+
206+
```
207+
{
208+
"/api": {
209+
"target": "http://localhost:3000",
210+
"secure": false
211+
}
212+
}
213+
```
214+
215+
You can read more about what options are available here [webpack-dev-server proxy settings](https://webpack.github.io/docs/webpack-dev-server.html#proxy)
216+
217+
and then we edit the `package.json` file's start script to be
218+
219+
```
220+
"start": "ng serve --proxy-config proxy.conf.json",
221+
```
222+
223+
now run it with `npm start`
195224

196225
### Deploying the app via GitHub Pages
197226

@@ -262,11 +291,11 @@ source ~/.bash_profile
262291

263292
### Global styles
264293

265-
The `styles.css` file allows users to add global styles and supports
266-
[CSS imports](https://developer.mozilla.org/en/docs/Web/CSS/@import).
294+
The `styles.css` file allows users to add global styles and supports
295+
[CSS imports](https://developer.mozilla.org/en/docs/Web/CSS/@import).
267296

268-
If the project is created with the `--style=sass` option, this will be a `.sass`
269-
file instead, and the same applies to `scss/less/styl`.
297+
If the project is created with the `--style=sass` option, this will be a `.sass`
298+
file instead, and the same applies to `scss/less/styl`.
270299

271300
You can add more global styles via the `apps[0].styles` property in `angular-cli.json`.
272301

@@ -290,7 +319,7 @@ export class AppComponent {
290319
}
291320
```
292321

293-
When generating a new project you can also define which extention you want for
322+
When generating a new project you can also define which extension you want for
294323
style files:
295324

296325
```bash
@@ -316,11 +345,11 @@ npm install @types/d3 --save-dev
316345

317346
### Global Library Installation
318347

319-
Some javascript libraries need to be added to the global scope, and loaded as if
320-
they were in a script tag. We can do this using the `apps[0].scripts` and
348+
Some javascript libraries need to be added to the global scope, and loaded as if
349+
they were in a script tag. We can do this using the `apps[0].scripts` and
321350
`apps[0].styles` properties of `angular-cli.json`.
322351

323-
As an example, to use [Boostrap 4](http://v4-alpha.getbootstrap.com/) this is
352+
As an example, to use [Boostrap 4](http://v4-alpha.getbootstrap.com/) this is
324353
what you need to do:
325354

326355
First install Bootstrap from `npm`:
@@ -329,7 +358,7 @@ First install Bootstrap from `npm`:
329358
npm install bootstrap@next
330359
```
331360

332-
Then add the needed script files to to `apps[0].scripts`.
361+
Then add the needed script files to `apps[0].scripts`:
333362

334363
```
335364
"scripts": [
@@ -342,12 +371,12 @@ Then add the needed script files to to `apps[0].scripts`.
342371
Finally add the Bootstrap CSS to the `apps[0].styles` array:
343372
```
344373
"styles": [
345-
"styles.css",
346-
"../node_modules/bootstrap/dist/css/bootstrap.css"
374+
"../node_modules/bootstrap/dist/css/bootstrap.css",
375+
"styles.css"
347376
],
348377
```
349378

350-
Restart `ng serve` if you're running it, and Bootstrap 4 should be working on
379+
Restart `ng serve` if you're running it, and Bootstrap 4 should be working on
351380
your app.
352381

353382
### Updating angular-cli
@@ -372,7 +401,7 @@ Running `ng init` will check for changes in all the auto-generated files created
372401

373402
Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes.
374403

375-
**The main cause of errors after an update is failing to incorporate these updates into your code**.
404+
**The main cause of errors after an update is failing to incorporate these updates into your code**.
376405

377406
You can find more details about changes between versions in [CHANGELOG.md](https://github.com/angular/angular-cli/blob/master/CHANGELOG.md).
378407

lib/bootstrap-local.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const ts = require('typescript');
77

88

99
global.angularCliIsLocal = true;
10+
global.angularCliPackages = require('./packages');
1011

1112
const compilerOptions = JSON.parse(fs.readFileSync(path.join(__dirname, '../tsconfig.json')));
1213

lib/packages.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ const packages = fs.readdirSync(packageRoot)
1111
.map(pkgName => ({ name: pkgName, root: path.join(packageRoot, pkgName) }))
1212
.filter(pkg => fs.statSync(pkg.root).isDirectory())
1313
.reduce((packages, pkg) => {
14-
let name = pkg == 'angular-cli' ? 'angular-cli' : `@angular-cli/${pkg.name}`;
14+
let pkgJson = JSON.parse(fs.readFileSync(path.join(pkg.root, 'package.json'), 'utf8'));
15+
let name = pkgJson['name'];
1516
packages[name] = {
17+
dist: path.join(__dirname, '../dist', pkg.name),
18+
packageJson: path.join(pkg.root, 'package.json'),
1619
root: pkg.root,
1720
main: path.resolve(pkg.root, 'src/index.ts')
1821
};

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-cli",
3-
"version": "1.0.0-beta.15",
3+
"version": "1.0.0-beta.16",
44
"description": "CLI tool for Angular",
55
"main": "packages/angular-cli/lib/cli/index.js",
66
"trackingCode": "UA-8594346-19",
@@ -12,7 +12,7 @@
1212
"build": "node ./scripts/publish/build.js",
1313
"build:patch": "node ./scripts/patch.js",
1414
"build:packages": "for PKG in packages/*; do echo Building $PKG...; tsc -p $PKG; done",
15-
"test": "npm run test:packages && npm run test:cli",
15+
"test": "npm-run-all -c test:packages test:cli",
1616
"e2e": "npm run test:e2e",
1717
"e2e:nightly": "node tests/e2e_runner.js --nightly",
1818
"mobile_test": "mocha tests/e2e/e2e_workflow.spec.js",
@@ -55,7 +55,7 @@
5555
"awesome-typescript-loader": "^2.2.3",
5656
"chalk": "^1.1.3",
5757
"common-tags": "^1.3.1",
58-
"compression-webpack-plugin": "^0.3.1",
58+
"compression-webpack-plugin": "github:webpack/compression-webpack-plugin#7e55907cd54a2e91b96d25a660acc6a2a6453f54",
5959
"copy-webpack-plugin": "^3.0.1",
6060
"core-js": "^2.4.0",
6161
"css-loader": "^0.23.1",
@@ -71,6 +71,7 @@
7171
"fs.realpath": "^1.0.0",
7272
"glob": "^7.0.3",
7373
"handlebars": "^4.0.5",
74+
"html-loader": "^0.4.4",
7475
"html-webpack-plugin": "^2.19.0",
7576
"istanbul-instrumenter-loader": "^0.2.0",
7677
"json-loader": "^0.5.4",
@@ -109,7 +110,7 @@
109110
"typedoc": "^0.4.2",
110111
"typescript": "2.0.2",
111112
"url-loader": "^0.5.7",
112-
"webpack": "2.1.0-beta.22",
113+
"webpack": "2.1.0-beta.25",
113114
"webpack-dev-server": "2.1.0-beta.3",
114115
"webpack-md5-hash": "0.0.5",
115116
"webpack-merge": "^0.14.0",

packages/angular-cli/blueprints/component/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
var path = require('path');
2-
var chalk = require('chalk');
3-
var Blueprint = require('ember-cli/lib/models/blueprint');
4-
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
1+
const path = require('path');
2+
const chalk = require('chalk');
3+
const Blueprint = require('ember-cli/lib/models/blueprint');
4+
const dynamicPathParser = require('../../utilities/dynamic-path-parser');
55
const findParentModule = require('../../utilities/find-parent-module').default;
6-
var getFiles = Blueprint.prototype.files;
6+
const getFiles = Blueprint.prototype.files;
77
const stringUtils = require('ember-cli-string-utils');
88
const astUtils = require('../../utilities/ast-utils');
9+
const NodeHost = require('@angular-cli/ast-tools').NodeHost;
910

1011
module.exports = {
1112
description: '',
@@ -117,7 +118,7 @@ module.exports = {
117118
if (!options['skip-import']) {
118119
returns.push(
119120
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
120-
.then(change => change.apply()));
121+
.then(change => change.apply(NodeHost)));
121122
}
122123

123124
return Promise.all(returns);

packages/angular-cli/blueprints/directive/files/__path__/__name__.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Directive } from '@angular/core';
22

33
@Directive({
4-
selector: '[<%= rawEntityName %>]'
4+
selector: '[<%= selector %>]'
55
})
66
export class <%= classifiedModuleName %>Directive {
77

packages/angular-cli/blueprints/directive/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var dynamicPathParser = require('../../utilities/dynamic-path-parser');
33
const stringUtils = require('ember-cli-string-utils');
44
const astUtils = require('../../utilities/ast-utils');
55
const findParentModule = require('../../utilities/find-parent-module').default;
6+
const NodeHost = require('@angular-cli/ast-tools').NodeHost;
67

78
module.exports = {
89
description: '',
@@ -31,17 +32,17 @@ module.exports = {
3132
this.project.ngConfig.apps[0].prefix) {
3233
defaultPrefix = this.project.ngConfig.apps[0].prefix;
3334
}
34-
var prefix = this.options.prefix ? defaultPrefix : '';
35+
var prefix = this.options.prefix ? `${defaultPrefix}-` : '';
3536

36-
this.rawEntityName = prefix + parsedPath.name;
37+
this.selector = stringUtils.camelize(prefix + parsedPath.name);
3738
return parsedPath.name;
3839
},
3940

4041
locals: function (options) {
4142
return {
4243
dynamicPath: this.dynamicPath.dir,
4344
flat: options.flat,
44-
rawEntityName: this.rawEntityName
45+
selector: this.selector
4546
};
4647
},
4748

@@ -73,7 +74,7 @@ module.exports = {
7374
if (!options['skip-import']) {
7475
returns.push(
7576
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
76-
.then(change => change.apply()));
77+
.then(change => change.apply(NodeHost)));
7778
}
7879

7980
return Promise.all(returns);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
@NgModule({
7+
imports: [RouterModule.forChild(routes)],
8+
exports: [RouterModule],
9+
providers: []
10+
})
11+
export class <%= classifiedModuleName %>RoutingModule { }

packages/angular-cli/blueprints/module/files/__path__/__name__.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';<% if (routing) { %>
3-
import { <%= camelizedModuleName %>Routing } from './<%= dasherizedModuleName %>.routing';<% } %>
3+
import { <%= classifiedModuleName %>RoutingModule } from './<%= dasherizedModuleName %>-routing.module';<% } %>
44

55
@NgModule({
66
imports: [
77
CommonModule<% if (routing) { %>,
8-
<%= camelizedModuleName %>Routing<% } %>
8+
<%= classifiedModuleName %>RoutingModule<% } %>
99
],
1010
declarations: []
1111
})

packages/angular-cli/blueprints/module/files/__path__/__name__.routing.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)