|
| 1 | +# Upgrading from [email protected] to the angular-cli@webpack |
| 2 | + |
| 3 | +To update `angular-cli` to the webpack preview, you must update both the global package, project's local package and your project files. |
| 4 | + |
| 5 | +## Global package: |
| 6 | +``` |
| 7 | +npm uninstall -g angular-cli |
| 8 | +npm cache clean |
| 9 | +npm install -g angular-cli@webpack |
| 10 | +``` |
| 11 | + |
| 12 | +## Local project package: |
| 13 | +``` |
| 14 | +# commit any changes you have to git first |
| 15 | +rm -rf node_modules dist tmp typings |
| 16 | +npm install --save-dev angular-cli@webpack |
| 17 | +``` |
| 18 | + |
| 19 | +IMPORTANT NOTE: |
| 20 | +Currently project generated with `ng new` will use a wrong local CLI version (see https://github.com/angular/angular-cli/issues/1528). After initializing your project, run `npm install --save-dev angular-cli@webpack` to set the correct version. |
| 21 | + |
| 22 | +## Project files |
| 23 | + |
| 24 | +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). |
| 25 | + |
| 26 | +Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes. |
| 27 | + |
| 28 | +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. |
| 29 | + |
| 30 | +Here is a summary of the file changes: |
| 31 | + |
| 32 | +1. Updated files: |
| 33 | + * `./config/karma.conf.js` - `frameworks`/`plugins`/`files`/`exclude`/`preprocessors` entries changed, added `angularCliConfig` entry. |
| 34 | + * `./e2e/tsconfig.json` - property cleanup, changed `outdir`, added `typeRoots` |
| 35 | + * `./angular-cli.json` - updated version entry. |
| 36 | + * `./README.md` - updated version entry, removed route from generator list. |
| 37 | + * `./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. |
| 38 | + * `./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`. |
| 39 | + * `./src/app/index.ts` - import adjusted due to environment files moving (see below). |
| 40 | + * `./src/index.html` - removed templating tags and `SystemJS` import script. |
| 41 | + * `./src/app/tsconfig.json` - property cleanup, changed `outdir`/`module`, added `libs`/`typeRoots`/`types` |
| 42 | + * `./src/typings.d.ts` - added `System`/`require` typings, removed `typings` ref |
| 43 | +1. Mobile app updated files: |
| 44 | + * `./package.json` - local versions of `angular2-universal` now used by the build system, updated package versions. |
| 45 | + * `./src/index.html` - moved service worker code to build system, hardcoded icons. |
| 46 | + * `./src/main-app-shell.ts` - reworked to interface with the build system, see comments in file. |
| 47 | +1. New files: |
| 48 | + * `./src/polyfills.ts` - loads needed polyfills before main app |
| 49 | + * `./src/test.ts` - unit test spec loader |
| 50 | +1. These files have moved to `./src/app/environments/`: |
| 51 | + * `./config/environment.dev.ts` |
| 52 | + * `./config/environment.prod.ts` |
| 53 | + * `./src/app/environment.ts` |
| 54 | + |
| 55 | +Lastly, you can delete these files as they are not needed anymore. |
| 56 | + * `./config/karma-test-shim.js` |
| 57 | + * `./src/system-config.ts` |
| 58 | + * `./angular-cli-build.js` |
| 59 | + * `./typings.json` |
| 60 | + * `./.clang-format` (if present) |
0 commit comments