Skip to content

Commit bafeb16

Browse files
committed
Merge branch 'master' into prefix-string-option
2 parents 77854fa + 1352545 commit bafeb16

Some content is hidden

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

52 files changed

+913
-653
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
222222
[github]: https://github.com/angular/angular-cli
223223
[gitter]: https://gitter.im/angular/angular-cli
224224
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
225-
[js-style-guide]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
225+
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
226226
[jsfiddle]: http://jsfiddle.net/
227227
[plunker]: http://plnkr.co/edit
228228
[runnable]: http://runnable.com/

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This project is very much still a work in progress.
1616
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

19-
Before submitting new issues, have a look at [issues marked with the `type: faq` label](https://github.com/angular/angular-cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22type%3A%20faq%22%20).
19+
Before submitting new issues, have a look at [issues marked with the `type: faq` label](https://github.com/angular/angular-cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22type%3A%20faq%22%20).
2020

2121
## Webpack update
2222

@@ -67,7 +67,7 @@ npm install -g angular-cli
6767
## Usage
6868

6969
```bash
70-
ng --help
70+
ng help
7171
```
7272

7373
### Generating and serving an Angular2 project via a development server
@@ -161,7 +161,7 @@ ng build
161161

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

167167
### Base tag handling in index.html
@@ -187,6 +187,10 @@ ng test
187187

188188
Tests will execute after a build is executed via [Karma](http://karma-runner.github.io/0.13/index.html), and it will automatically watch your files for changes. You can run tests a single time via `--watch=false` or `--single-run`.
189189

190+
You can run tests with coverage via `--code-coverage`. The coverage report will be in the `coverage/` directory.
191+
192+
Linting during tests is also available via the `--lint` flag. See [Linting and formatting code](#linting-and-formatting-code) chapter for more informations.
193+
190194
### Running end-to-end tests
191195

192196
```bash
@@ -319,7 +323,7 @@ Angular-CLI supports all major CSS preprocessors:
319323
- less ([http://lesscss.org/](http://lesscss.org/))
320324
- stylus ([http://stylus-lang.com/](http://stylus-lang.com/))
321325

322-
To use these prepocessors simply add the file to your component's `styleUrls`:
326+
To use these preprocessors simply add the file to your component's `styleUrls`:
323327

324328
```javascript
325329
@Component({

package.json

+9-15
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
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-all -c test:packages test:cli",
15+
"test": "npm-run-all -c test:packages test:cli test:deps",
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",
1919
"test:e2e": "node tests/e2e_runner.js",
2020
"test:cli": "node tests/runner",
21+
"test:deps": "node scripts/publish/validate_dependencies.js",
2122
"test:inspect": "node --inspect --debug-brk tests/runner",
2223
"test:packages": "node scripts/run-packages-spec.js",
2324
"build-config-interface": "dtsgen packages/angular-cli/lib/config/schema.json --out packages/angular-cli/lib/config/schema.d.ts",
@@ -45,13 +46,11 @@
4546
"@angular/compiler-cli": "2.2.3",
4647
"@angular/core": "2.2.3",
4748
"@angular/tsc-wrapped": "0.4.0",
48-
"angular2-template-loader": "^0.5.0",
4949
"async": "^2.1.4",
5050
"autoprefixer": "^6.5.3",
5151
"chalk": "^1.1.3",
5252
"common-tags": "^1.3.1",
5353
"configstore": "^2.0.0",
54-
"core-js": "^2.4.0",
5554
"css-loader": "^0.23.1",
5655
"debug": "^2.1.3",
5756
"denodeify": "^1.2.1",
@@ -73,31 +72,27 @@
7372
"inquirer": "^0.12.0",
7473
"is-git-url": "^0.2.0",
7574
"isbinaryfile": "^2.0.3",
76-
"istanbul-instrumenter-loader": "^0.2.0",
7775
"json-loader": "^0.5.4",
7876
"karma-sourcemap-loader": "^0.3.7",
7977
"karma-webpack": "^1.8.0",
8078
"leek": "0.0.21",
8179
"less": "^2.7.1",
8280
"less-loader": "^2.2.3",
81+
"loader-utils": "^0.2.16",
8382
"lodash": "^4.11.1",
8483
"magic-string": "^0.16.0",
8584
"markdown-it": "4.3.0",
8685
"markdown-it-terminal": "0.0.3",
8786
"minimatch": "^3.0.0",
88-
"mkdirp": "^0.5.1",
8987
"node-modules-path": "^1.0.0",
9088
"node-sass": "^3.10.1",
9189
"nopt": "^3.0.1",
92-
"npm-run-all": "^3.0.0",
9390
"offline-plugin": "^3.4.1",
9491
"opn": "4.0.1",
9592
"ora": "^0.2.0",
96-
"parse5": "^2.1.5",
9793
"portfinder": "1.0.9",
9894
"postcss-discard-comments": "^2.0.4",
9995
"postcss-loader": "^0.9.1",
100-
"protractor": "^3.3.0",
10196
"quick-temp": "0.1.5",
10297
"raw-loader": "^0.5.1",
10398
"readline2": "0.1.1",
@@ -107,22 +102,20 @@
107102
"rimraf": "^2.5.3",
108103
"rsvp": "^3.0.17",
109104
"rxjs": "5.0.0-beta.12",
110-
"sass-loader": "^3.2.0",
105+
"sass-loader": "^4.0.1",
111106
"script-loader": "^0.7.0",
112107
"semver": "^5.1.0",
113108
"silent-error": "^1.0.0",
114109
"source-map": "^0.5.6",
115110
"source-map-loader": "^0.1.5",
116111
"sourcemap-istanbul-instrumenter-loader": "^0.2.0",
117-
"string-replace-loader": "^1.0.5",
118112
"style-loader": "^0.13.1",
119113
"stylus": "^0.54.5",
120114
"stylus-loader": "^2.1.0",
121115
"temp": "0.8.3",
122116
"through": "^2.3.6",
123-
"ts-loader": "^0.8.2",
124117
"tslint": "^3.15.1",
125-
"tslint-loader": "^2.1.4",
118+
"tslint-loader": "^3.3.0",
126119
"typescript": "~2.0.3",
127120
"url-loader": "^0.5.7",
128121
"uuid": "^3.0.0",
@@ -131,8 +124,8 @@
131124
"webpack-dev-server": "2.1.0-beta.9",
132125
"webpack-md5-hash": "0.0.5",
133126
"webpack-merge": "^0.14.0",
134-
"yam": "0.0.18",
135-
"zone.js": "^0.6.23"
127+
"webpack-sources": "^0.1.3",
128+
"yam": "0.0.18"
136129
},
137130
"ember-addon": {
138131
"paths": [
@@ -148,7 +141,7 @@
148141
"@types/fs-extra": "^0.0.31",
149142
"@types/glob": "^5.0.29",
150143
"@types/jasmine": "^2.2.32",
151-
"@types/lodash": "^4.0.25-alpha",
144+
"@types/lodash": "^4.14.43",
152145
"@types/mock-fs": "3.6.28",
153146
"@types/node": "^6.0.36",
154147
"@types/request": "0.0.30",
@@ -168,6 +161,7 @@
168161
"mocha": "^2.4.5",
169162
"mock-fs": "3.10.0",
170163
"npm-run": "^4.1.0",
164+
"npm-run-all": "^3.0.0",
171165
"object-assign": "^4.0.1",
172166
"request": "^2.74.0",
173167
"resolve-bin": "^0.4.0",

packages/@ngtools/webpack/package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@
2525
"npm": ">= 3.0.0"
2626
},
2727
"dependencies": {
28-
"@angular-cli/ast-tools": "^1.0.0",
28+
"enhanced-resolve": "^2.3.0",
29+
"loader-utils": "^0.2.16",
2930
"magic-string": "^0.16.0",
3031
"source-map": "^0.5.6"
3132
},
3233
"peerDependencies": {
33-
"typescript": "^2.0.2",
34+
"@angular/compiler": "2.2.3",
3435
"@angular/compiler-cli": "2.2.3",
3536
"@angular/core": "2.2.3",
36-
"reflect-metadata": "^0.1.8"
37+
"@angular/tsc-wrapped": "0.4.0",
38+
"typescript": "^2.0.2",
39+
"reflect-metadata": "^0.1.8",
40+
"webpack": "^2.1.0-beta.25"
3741
}
3842
}

packages/@ngtools/webpack/src/refactor.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,20 @@ export class TypeScriptFileRefactor {
4848
this._sourceString = new MagicString(this._sourceText);
4949
}
5050

51+
/**
52+
* Collates the diagnostic messages for the current source file
53+
*/
5154
getDiagnostics(): ts.Diagnostic[] {
5255
if (!this._program) {
5356
return [];
5457
}
55-
56-
return this._program.getSyntacticDiagnostics(this._sourceFile)
57-
.concat(this._program.getSemanticDiagnostics(this._sourceFile))
58-
.concat(this._program.getDeclarationDiagnostics(this._sourceFile));
58+
let diagnostics: ts.Diagnostic[] = this._program.getSyntacticDiagnostics(this._sourceFile)
59+
.concat(this._program.getSemanticDiagnostics(this._sourceFile));
60+
// only concat the declaration diagnostics if the tsconfig config sets it to true.
61+
if (this._program.getCompilerOptions().declaration == true) {
62+
diagnostics = diagnostics.concat(this._program.getDeclarationDiagnostics(this._sourceFile));
63+
}
64+
return diagnostics;
5965
}
6066

6167
/**

packages/@ngtools/webpack/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"sourceRoot": "/",
1616
"baseUrl": "./",
1717
"paths": {
18-
"@angular-cli/ast-tools": [ "../../../dist/ast-tools/src" ]
1918
},
2019
"typeRoots": [
2120
"../../node_modules/@types"

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

+12-10
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,18 @@ module.exports = {
5959

6060
afterInstall: function (options) {
6161
// Note that `this.generatePath` already contains `this.dasherizedModuleName`
62-
// So, the path will end like `name/name`,
62+
// So, the path will end like `name/name`,
6363
// which is correct for `name.component.ts` created in module `name`
64-
var componentPath = path.join(this.generatePath, this.dasherizedModuleName);
65-
options.entity.name = path.relative(this.dynamicPath.appRoot, componentPath);
66-
options.flat = true;
67-
options.route = false;
68-
options.inlineTemplate = false;
69-
options.inlineStyle = false;
70-
options.prefix = null;
71-
options.spec = true;
72-
return Blueprint.load(path.join(__dirname, '../component')).install(options);
64+
if (this.options && this.options.routing) {
65+
var componentPath = path.join(this.generatePath, this.dasherizedModuleName);
66+
options.entity.name = path.relative(this.dynamicPath.appRoot, componentPath);
67+
options.flat = true;
68+
options.route = false;
69+
options.inlineTemplate = false;
70+
options.inlineStyle = false;
71+
options.prefix = null;
72+
options.spec = true;
73+
return Blueprint.load(path.join(__dirname, '../component')).install(options);
74+
}
7375
}
7476
};

packages/angular-cli/blueprints/ng2/files/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ Run `ng github-pages:deploy` to deploy to Github Pages.
2828

2929
## Further help
3030

31-
To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
31+
To get more help on the `angular-cli` use `ng help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

packages/angular-cli/blueprints/ng2/files/__path__/app/index.ts

-2
This file was deleted.

packages/angular-cli/blueprints/ng2/files/__path__/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import './polyfills.ts';
33
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
44
import { enableProdMode } from '@angular/core';
55
import { environment } from './environments/environment';
6-
import { AppModule } from './app/';
6+
import { AppModule } from './app/app.module';
77

88
if (environment.production) {
99
enableProdMode();

packages/angular-cli/blueprints/ng2/files/gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010

1111
# IDEs and editors
1212
/.idea
13-
/.vscode
1413
.project
1514
.classpath
1615
.c9/
1716
*.launch
1817
.settings/
1918

19+
# IDE - VSCode
20+
.vscode/*
21+
!.vscode/settings.json
22+
!.vscode/tasks.json
23+
!.vscode/launch.json
24+
!.vscode/extensions.json
25+
2026
# misc
2127
/.sass-cache
2228
/connect.lock

packages/angular-cli/blueprints/ng2/files/package.json

+5-12
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"license": "MIT",
55
"angular-cli": {},
66
"scripts": {
7+
"ng": "ng",
78
"start": "ng serve",
89
"lint": "tslint \"<%= sourceDir %>/**/*.ts\"",
910
"test": "ng test",
10-
"pree2e": "webdriver-manager update",
11+
"pree2e": "webdriver-manager update --standalone false --gecko false",
1112
"e2e": "protractor"
1213
},
1314
"private": true,
@@ -25,14 +26,7 @@
2526
"ts-helpers": "^1.1.1",
2627
"zone.js": "^0.6.23"
2728
},
28-
"devDependencies": {<% if(isMobile) { %>
29-
"@angular/platform-server": "2.2.3",
30-
"@angular/service-worker": "0.2.0",
31-
"@angular/app-shell": "0.0.0",
32-
"angular2-universal":"0.104.5",
33-
"angular2-universal-polyfills": "0.4.1",
34-
"preboot": "2.1.2",
35-
"parse5": "1.5.1",<% } %>
29+
"devDependencies": {
3630
"@angular/compiler-cli": "2.2.3",
3731
"@types/jasmine": "2.5.38",
3832
"@types/node": "^6.0.42",
@@ -45,10 +39,9 @@
4539
"karma-cli": "^1.0.1",
4640
"karma-jasmine": "^1.0.2",
4741
"karma-remap-istanbul": "^0.2.1",
48-
"protractor": "4.0.9",
42+
"protractor": "~4.0.13",
4943
"ts-node": "1.2.1",
5044
"tslint": "^4.0.2",
51-
"typescript": "~2.0.3",
52-
"webdriver-manager": "10.2.5"
45+
"typescript": "~2.0.3"
5346
}
5447
}

packages/angular-cli/commands/new.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as chalk from 'chalk';
22
import InitCommand from './init';
3+
import {oneLine} from 'common-tags';
34

45
const Command = require('../ember-cli/lib/models/command');
56
const Project = require('../ember-cli/lib/models/project');
@@ -37,6 +38,12 @@ const NewCommand = Command.extend({
3738
`The "ng ${this.name}" command requires a name argument to be specified. ` +
3839
`For more details, use "ng help".`));
3940
}
41+
if (!packageName.match(/^[a-zA-Z][.0-9a-zA-Z]*(-[a-zA-Z][.0-9a-zA-Z]*)*$/)) {
42+
return Promise.reject(new SilentError(oneLine`
43+
Project name "${packageName}" is not valid. New project names must
44+
start with a letter, and must contain only alphanumeric characters or dashes.
45+
`));
46+
}
4047

4148
commandOptions.name = packageName;
4249
if (commandOptions.dryRun) {

packages/angular-cli/commands/serve.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as assign from 'lodash/assign';
21
import * as denodeify from 'denodeify';
3-
const Command = require('../ember-cli/lib/models/command');
2+
const assign = require('lodash/assign');
43
const SilentError = require('silent-error');
54
const PortFinder = require('portfinder');
5+
const Command = require('../ember-cli/lib/models/command');
66
import ServeWebpackTask from '../tasks/serve-webpack';
77

88
PortFinder.basePort = 49152;

0 commit comments

Comments
 (0)