|
1 | 1 | # AngularcliMeteor
|
2 | 2 |
|
3 |
| -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.0. |
| 3 | +## Meteor server |
4 | 4 |
|
5 |
| -## Development server |
| 5 | +Run `meteor` from the `api` directory to start the Meteor server. |
| 6 | + |
| 7 | +## Bundling Meteor client |
| 8 | + |
| 9 | +`meteor-client-bundler` is a module bundler which will take a bunch of Atmosphere package and put them into a single module, so we can load Meteor's client scripts regardless of what framework we're using to run our server. |
6 | 10 |
|
7 |
| -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
| 11 | +Run `./node_modules/.bin/meteor-client bundle -s api`. |
8 | 12 |
|
9 |
| -## Code scaffolding |
| 13 | +## Development server |
10 | 14 |
|
11 |
| -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. |
| 15 | +Then run `npm run start` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
12 | 16 |
|
13 | 17 | ## Build
|
14 | 18 |
|
15 |
| -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. |
| 19 | +Run `npm run build` to build the project. The build artifacts will be stored in the `dist/` directory. Use `npm run build-prod` for a production build with AOT. |
16 | 20 |
|
17 | 21 | ## Running unit tests
|
18 | 22 |
|
19 |
| -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). |
| 23 | +Run `npm run test` to execute the unit tests via [Karma](https://karma-runner.github.io). |
20 | 24 |
|
21 | 25 | ## Running end-to-end tests
|
22 | 26 |
|
23 |
| -Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). |
| 27 | +Run `npm run e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). |
| 28 | + |
| 29 | +## The process I've done to recreate this |
| 30 | + |
| 31 | +``` |
| 32 | +ng new angularcli-meteor --style scss |
| 33 | +cd angularcli-meteor |
| 34 | +ng eject |
| 35 | +``` |
| 36 | +We need to eject `webpack.config.js` to be able to patch it to support Meteor. |
| 37 | + |
| 38 | +``` |
| 39 | +cat patches/webpack.config.js.patch | patch -p1 |
| 40 | +cat patches/tsconfig.json.patch | patch -p1 |
| 41 | +cat patches/tsconfig.app.json.patch | patch -p1 |
| 42 | +cat patches/tsconfig.spec.json.patch | patch -p1 |
| 43 | +cat patches/tsconfig.e2e.json.patch | patch -p1 |
| 44 | +``` |
| 45 | + |
| 46 | +``` |
| 47 | +npm install --save-dev typescript-extends |
| 48 | +npm install --save moment |
| 49 | +npm install --save angular2-moment |
| 50 | +``` |
| 51 | + |
| 52 | +``` |
| 53 | +meteor create api --release 1.6-rc.13 |
| 54 | +npm install --save babel-runtime |
| 55 | +npm install --save meteor-node-stubs |
| 56 | +npm install --save meteor-rxjs |
| 57 | +npm install --save-dev meteor-client-bundler |
| 58 | +npm install --save-dev @types/meteor |
| 59 | +npm install --save-dev tmp |
| 60 | +rm -rf api/node_modules |
| 61 | +rm -rf api/client |
| 62 | +mv api/server/main.js api/server/main.ts |
| 63 | +rm api/package.json api/package-lock.json |
| 64 | +ln -s ../package.json api/package.json |
| 65 | +ln -s ../package-lock.json api/package-lock.json |
| 66 | +ln -s ../node_modules api/ |
| 67 | +cd api; meteor add barbatus:typescript; cd .. |
| 68 | +``` |
| 69 | + |
| 70 | +Now we need to create `api/tsconfig.json`. |
| 71 | + |
| 72 | +To get the AOT config we will need to eject `webpack.config.js` once again, this time with the `--prod` flag. |
| 73 | +To be able to do so we will first have to remove all the "run" scripts from package.json. |
24 | 74 |
|
25 |
| -## Further help |
| 75 | +``` |
| 76 | +mv webpack.config.js webpack.config.js.dev |
| 77 | +ng eject --prod |
| 78 | +cat patches/webpack.config.js.prod.patch | patch -p1 |
| 79 | +mv webpack.config.js webpack.config.js.prod |
| 80 | +ln -s webpack.config.js.dev webpack.config.js |
| 81 | +``` |
26 | 82 |
|
27 |
| -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). |
| 83 | +Finally let's add `start-prod` and `build-prod` to the "run" scripts from package.json. |
0 commit comments