|
| 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 | +rm -rf node_modules dist tmp typings |
| 15 | +npm install --save-dev angular-cli@webpack |
| 16 | +``` |
| 17 | + |
| 18 | +## Project files |
| 19 | + |
| 20 | +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). |
| 21 | + |
| 22 | +Carefully read the diffs for each code file, and either accept the changes or incorporate them manually after `ng init` finishes. |
| 23 | + |
| 24 | +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. |
| 25 | + |
| 26 | +Here is a summary of the file changes: |
| 27 | + |
| 28 | +1. Updated files: |
| 29 | + * `./config/karma.conf.js` - `frameworks`/`plugins`/`files`/`exclude`/`preprocessors` entries changed, added `angularCliConfig` entry. |
| 30 | + * `./e2e/tsconfig.json` - property cleanup, changed `outdir`, added `typeRoots` |
| 31 | + * `./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. |
| 32 | + * `./src/app/app.component.ts` (and all other components) - removed `module.id`. |
| 33 | + * `./src/app/index.ts` - import adjusted due to environment files moving (see below). |
| 34 | + * `./src/index.html` - removed templating tags and `SystemJS` import script. |
| 35 | + * `./src/app/tsconfig.json` - property cleanup, changed `outdir`/`module`, added `libs`/`typeRoots`/`types` |
| 36 | + * `./src/typings.d.ts` - added `System`/`require` typings, removed `typings` ref |
| 37 | + * `./typings.json` - updated `jasmine` globalDevDependency, removed `es6-shim` globalDependency |
| 38 | +1. New files: |
| 39 | + * `./src/polyfills.ts` - loads needed polyfills before main app |
| 40 | + * `./src/test.ts` - unit test spec loader |
| 41 | +1. These files have moved to `./src/app/environments/`: |
| 42 | + * `./config/environment.dev.ts` |
| 43 | + * `./config/environment.prod.ts` |
| 44 | + * `./src/app/environment.ts` |
| 45 | + |
| 46 | +Lastly, you can delete these files as they are not needed anymore. |
| 47 | + * `./config/karma-test-shim.js` |
| 48 | + * `./src/app/system-config.ts` |
| 49 | + * `./src/app/typings.d.ts` |
| 50 | + * `./angular-cli-build.js` |
0 commit comments