You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge Webpack Feature branch into Master (angular#1455)
* build: use webpack for building apps.
This pull request replaces the underlying broccoli build system and then
replaces it with webpack as the build and bundler.
This will affect the following commands (however the user-level)
functionality should go unchanged (besides unimplemented flags which
will come after this PR.):
ng build (with --env flag and --watch flag supported)
ng serve (with --port flag supported)
ng test / ng e2e
The webpack configuration is blackboxed, and therefore users will not
see a webpack.config.js file in their repository.
Also this PR will bump the typescript version to 2.0 (beta).
Fixesangular#909angular#1155angular#882
* chore(lint) Corrected any eslint errors and cleaned up unused files
* chore(cleanup) additional cleanup tasks performed. Removed unneeded code, indentation causing linting errors, add back tsconfig sourcemapping, removed console logs, deleted material unused files.
* chore: remove bind from serve command
* chore: simplify test command
* chore: fix test warnings
* chore: revert whitespace changes
* chore: re-add mapRoot to tsconfig
* chore: remove unused import
* bugfix: fix broken tests
* fix: fix mobile-specific feature test
* bugfix: fix public folder test
* fix: fixes for path mappings, tests, and coverage (angular#1359)
* fix(): Multiple fixes for path mappings:
* Removed invalid test case that was throwing path mappings tests because of a typescript bug.
* Readded PathsPlugin for Path Mappings
* Removed coverage preprocessor which was throwing bad type errors against ts code when it shouldn't be.
* Added sourcemap support for istanbul instrumenter. Coverage files are still being generated.
* fix: fix the way the build command runs for mobile tests
* fix: fix the way the build command runs for mobile tests
* fix: replaced promise based ng command with sh.exec to allow mappings test to run correctly against mobile
* fix: replaced promise based ng command with sh.exec to allow mappings test to run correctly against mobile
* fix: add environment configuration replacement (angular#1364)
* fix: add environment configuration replacement
* remove debuggers
* fix: move mobile test above config test because it relies on prod build from previous step
* fix: removed unneeded interface moved config paths
* fix(tests): re-enable sass/less/stylus tests (angular#1363)
* chore: remove systemjs (angular#1376)
* chore: remove vendor.ts (angular#1383)
* chore: remove material2 test option (angular#1385)
* fix(build): re-add support for sourceDir (angular#1378)
* chore(build): remove broccoli (angular#1386)
* chore: remove windows elevation check (angular#1384)
* fix(test): add missing sourceDir (angular#1387)
* fix: update node polyfill support properties for prod config to allow dev-server (aka ng serve) (angular#1395)
* chore(tests): add prod env e2e test (angular#1394)
* chore: cleanup of new files (angular#1388)
* fix(serve): disable HMR (angular#1402)
* chore: review docs (angular#1407)
* feat(env): decouple build from env file (angular#1404)
* fix: fix tsconfig for editors (angular#1420)
* chore: fix webpack branch after merge conflicts (angular#1423)
* fix: update to awesome-typescript-loader 2.1.0 (angular#1425)
* fix: update to awesome-typescript-loader 2.1.0 which fixes a few issues shimming typings libs in tsconfig.json
* fix: forgot to set libs in tsconfig blueprint
* chore(blueprints): remove module.id (angular#1426)
* feat: add host flag support for ng serve (angular#1442)
* feat(test): add karma plugin (angular#1437)
* chore(blueprints): re-add outDir (angular#1428)
* feat: use @types instead of typings (angular#1449)
* fix: make sourcemaps work in test (angular#1447)
* feat: add utilities for typescript ast (angular#1159) (angular#1453)
'ast-utils.ts' provides typescript ast utility functions
The build artifacts will be stored in the `dist/` directory.
116
114
117
-
### Environments
115
+
### Build Targets and Environment Files
118
116
119
-
At build time, the `src/app/environment.ts` will be replaced by either
120
-
`config/environment.dev.ts` or `config/environment.prod.ts`, depending on the
121
-
current cli environment. The resulting file will be `dist/app/environment.ts`.
117
+
A build can specify both a build target (`development` or `production`) and an
118
+
environment file to be used with that build. By default, the development build
119
+
target is used.
122
120
123
-
Environment defaults to `dev`, but you can generate a production build via
124
-
the `-prod` flag in either `ng build -prod` or `ng serve -prod`.
121
+
At build time, `src/app/environments/environment.ts` will be replaced by
122
+
`src/app/environments/environment.{NAME}.ts` where `NAME` is the argument
123
+
provided to the `--environment` flag.
124
+
125
+
These options also apply to the serve command. If you do not pass a value for `environment`,
126
+
it will default to `dev` for `development` and `prod` for `production`.
127
+
128
+
```bash
129
+
# these are equivalent
130
+
ng build --target=production --environment=prod
131
+
ng build --prod --env=prod
132
+
ng build --prod
133
+
# and so are these
134
+
ng build --target=development --environment=dev
135
+
ng build --dev --e=dev
136
+
ng build --dev
137
+
ng build
138
+
```
125
139
126
140
You can also add your own env files other than `dev` and `prod` by creating a
127
-
`config/environment.{NAME}.ts` and use them by using the `--env=NAME`
141
+
`src/app/environments/environment.{NAME}.ts` and use them by using the `--env=NAME`
128
142
flag on the build/serve commands.
129
143
130
144
### Bundling
@@ -138,13 +152,7 @@ all dependencies into a single file, and make use of tree-shaking techniques.
138
152
ng test
139
153
```
140
154
141
-
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.
142
-
143
-
You can run tests a single time via `--watch=false`, and turn off building of the app via `--build=false` (useful for running it at the same time as `ng serve`).
144
-
145
-
**WARNING:** On Windows, `ng test` is hitting a file descriptor limit (see https://github.com/angular/angular-cli/issues/977).
146
-
The solution for now is to instead run `ng serve` and `ng test --build=false` in separate console windows.
147
-
155
+
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`.
148
156
149
157
### Running end-to-end tests
150
158
@@ -198,7 +206,7 @@ You can modify the these scripts in `package.json` to run whatever tool you pref
198
206
199
207
### Support for offline applications
200
208
201
-
The index.html file includes a commented-out code snippet for installing the angular2-service-worker. This support is experimental, please see the angular/mobile-toolkit project and https://mobile.angular.io/ for documentation on how to make use of this functionality.
209
+
Angular-CLI includes support for offline applications via the `--mobile` flag on `ng new`. Support is experimental, please see the angular/mobile-toolkit project and https://mobile.angular.io/ for documentation on how to make use of this functionality.
202
210
203
211
### Commands autocompletion
204
212
@@ -225,19 +233,44 @@ source ~/.bash_profile
225
233
226
234
### CSS Preprocessor integration
227
235
228
-
We support all major CSS preprocessors:
236
+
Angular-CLI supports all major CSS preprocessors:
229
237
- sass (node-sass)
230
238
- less (less)
231
239
- compass (compass-importer + node-sass)
232
240
- stylus (stylus)
233
241
234
-
To use one just install for example `npm install node-sass` and rename `.css` files in your project to `.scss` or `.sass`. They will be compiled automatically.
242
+
To use these prepocessors simply add the file to your component's `styreUrl`:
243
+
244
+
```
245
+
@Component({
246
+
moduleId: module.id,
247
+
selector: 'app-root',
248
+
templateUrl: 'app.component.html',
249
+
styleUrls: ['app.component.scss']
250
+
})
251
+
export class AppComponent {
252
+
title = 'app works!';
253
+
}
254
+
```
255
+
256
+
When generating a new project you can also define which extention you want for
257
+
style files:
235
258
236
-
The `Angular2App`'s options argument has `sassCompiler`, `lessCompiler`, `stylusCompiler` and `compassCompiler` options that are passed directly to their respective CSS preprocessors.
259
+
```bash
260
+
ng new sassy-project --style=sass
261
+
262
+
```
237
263
238
264
### 3rd Party Library Installation
239
265
240
-
The installation of 3rd party libraries are well described at our [Wiki Page](https://github.com/angular/angular-cli/wiki/3rd-party-libs)
266
+
Simply install your library via `npm install lib-name` and import it in your code.
267
+
268
+
If the library does not include typings, you can install them using npm:
269
+
270
+
```bash
271
+
npm install moment
272
+
npm install @types/moment
273
+
```
241
274
242
275
### Updating angular-cli
243
276
@@ -307,6 +340,8 @@ the local `angular-cli` from the project which was fetched remotely from npm.
307
340
Now the `angular-cli` you cloned before is in three places:
308
341
The folder you cloned it into, npm's folder where it stores global packages and the `angular-cli` project you just created.
309
342
343
+
You can also use `ng new foo --link-cli` to automatically link the `angular-cli` package.
344
+
310
345
Please read the official [npm-link documentation](https://www.npmjs.org/doc/cli/npm-link.html)
311
346
and the [npm-link cheatsheet](http://browsenpm.org/help#linkinganynpmpackagelocally) for more information.
0 commit comments