Skip to content

Commit

Permalink
chore(folder-structure): Split angular2-meteor branch
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 10, 2016
1 parent b19d041 commit 4216670
Show file tree
Hide file tree
Showing 282 changed files with 298 additions and 25,763 deletions.
File renamed without changes.
5 changes: 4 additions & 1 deletion .gitignore
@@ -1,5 +1,8 @@
node_modules
.node_modules
.idea
typings
atmosphere-packages/examples
.npm
npm-debug.log
lerna-debug.log
dist
File renamed without changes.
24 changes: 14 additions & 10 deletions .travis.yml
@@ -1,14 +1,18 @@
sudo: required
language: node_js

cache:
directories:
# cache node modules
- node_modules
node_js:
- "5"

# use same node version as meteor does
- "6"
services:
- mongodb

install:
- curl https://install.meteor.com | /bin/sh
- npm install lerna
- npm run bootstrap

sudo: required
before_install: curl https://install.meteor.com | /bin/sh
before_script:
# remove unused node modules from cache
- npm prune
- npm install -g rollup@^0.35.9 tslint@3.6.0 typescript@2.0.7
- npm install
- npm run test
File renamed without changes.
File renamed without changes.
File renamed without changes.
249 changes: 221 additions & 28 deletions README.md
@@ -1,40 +1,233 @@
<a href="https://angular-meteor.com/"><img src="https://www.angular-meteor.com/images/logo-large.png" width="60" height="60" /></a> [![Join the chat at https://gitter.im/Urigo/angular-meteor](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Urigo/angular-meteor)
<a href="http://angular-meteor.com/"><img src="https://s22.postimg.org/vpn3d97ch/logo_large.png" width="120" height="120" /></a>

### Angular1-Meteor [![Build Status](https://travis-ci.org/Urigo/angular-meteor.svg?branch=master)](https://travis-ci.org/Urigo/angular-meteor) [![npm version](https://badge.fury.io/js/angular-meteor.svg)](https://badge.fury.io/js/angular-meteor)
### Angular2-Meteor [![Build Status](https://travis-ci.org/Urigo/angular-meteor.svg?branch=master)](https://travis-ci.org/Urigo/angular-meteor) [![npm version](https://badge.fury.io/js/angular2-meteor.svg)](https://badge.fury.io/js/angular2-meteor)
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![Build Status](https://travis-ci.org/Urigo/angular-meteor.svg?branch=master)](https://travis-ci.org/Urigo/angular-meteor) [![Join the chat at https://gitter.im/Reactive-Extensions/RxJS](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Urigo/angular-meteor)

#### The power of Meteor and the simplicity and eco-system of Angular
Angular 2 + Meteor integration.

[![ng-conf](https://img.youtube.com/vi/_mu6BWsnaPM/0.jpg)](https://www.youtube.com/watch?v=_mu6BWsnaPM)
## Table of Contents
* [Tutorial](../../#tutorial)
* [Quick Start](../../#quick-start)
* [Install package](../../#install-package)
* [Using Angular 2 in a Meteor app](../../#using-angular-2-in-a-meteor-app)
* [Demos](../../#demos)
* [TypeScript](../../#typescript)
* [Roadmap](../../#roadmap)
* [Contribution](../../#contribution)

## Documentation and Getting Started
- [Official website](https://www.angular-meteor.com)
- [Getting started tutorial](https://www.angular-meteor.com/tutorials/socially/)
- [Angular2 Example application](https://github.com/Urigo/meteor-angular2.0-socially) (Final version of the tutorial)
- [Angular1 Example application](https://github.com/Urigo/meteor-angular-socially) (Final version of the tutorial)
- Questions and help - [Stack Overflow `angular2-meteor` tag](http://stackoverflow.com/questions/tagged/angular2-meteor), [`angular-meteor` tag](http://stackoverflow.com/questions/tagged/angular-meteor)
- [Join angular-meteor Office Hours](https://plus.google.com/events/cj8i93v7cabr9fab5jvv3r6bb80)
- [Discussions - the Meteor Forum](https://forums.meteor.com/)
## Tutorial

If you are new to Angular2 and/or Meteor but want to learn them quickly,
please check out our 23-steps Angular2-Meteor [tutorial](http://www.angular-meteor.com/tutorials/socially/angular2/bootstrapping).

## Questions and Issues

If you have rather a question than an issue, please consider the following resources at first:
- [Gitter](https://gitter.im/Urigo/angular-meteor)
- [Report issues](https://github.com/Urigo/angular-meteor/issues)
- [Change Log, updates and breaking changes](https://github.com/Urigo/angular-meteor/releases)
- [Meteor Blog](https://info.meteor.com/blog)
- [Official Meteor guide for best practices](http://guide.meteor.com/)
- [Awesome Meteor](https://github.com/Urigo/awesome-meteor) - Curated, community driven list of Meteor resources
- Starters - [Angular2-Meteor Base](https://github.com/bsliran/angular2-meteor-base), [angular1-meteor Yeoman generator](https://github.com/ndxbxrme/generator-angular-meteor)
- Track Roadmap here: [angular-meteor milestones](https://github.com/Urigo/angular-meteor/milestones), [Meteor issues related to Angular](https://github.com/meteor/meteor/labels/Project%3AAngular)
- [Angular Meteor Stickers](https://www.stickermule.com/marketplace/9686-angular-meteor-sticker)
- [Stack Overflow `angular2-meteor` tag](http://stackoverflow.com/questions/tagged/angular2-meteor)
- [Meteor forum](https://forums.meteor.com/c/angular)

The chances to get a quick response there is higher than posting a new issue here.

If you've decided that it's likely a real issue, please consider going through the following list at first:
- Check quickly recently [created](https://github.com/Urigo/angular2-meteor/issues)/[closed](https://github.com/Urigo/angular2-meteor/issues?q=is%3Aissue+is%3Aclosed) issues: chances are high that someone's already created a similar one
or similar issue's been resolved;
- If your issue looks nontrivial, we would approciate a small demo to reproduce it.
You will also get a response much faster.

## Quick Start

### Install package:

To install Angular2-Meteor's NPMs:
````
npm install angular2-meteor --save
````

Second step is to add ` angular2-compilers` package — `meteor add angular2-compilers`.
This package adds custom HTML processor, LESS, SASS and TypeScript compilers.
Custom HTML processor and Style compilers make sure that static resources can be used
in the way that Angular 2 requires, and TypeScript is a recommended JS-superset to develop with Angular 2.

Please note that you'll have to remove the standard Meteor HTML processor (and LESS package).
The reason is that Meteor doesn't allow more than two processor for one extension:
````
meteor remove blaze-html-templates
````

Angular 2 heavily relies on some polyfills (`zone.js`, `reflect-metadata` etc).
There are two ways to add them:
- Add `import 'angular2-meteor-polyfills'` at the top of ts-file that is loaded first;
- Add `barbatus:angular2-polyfills` package. Since it's a package, it's loaded by Meteor before any user code.

Please, don't forget to add a main HTML file (can be `index.html` or with any other name) even if your app template consists of one single tag,
e.g., `<body><app></app></body>`.

### Using Angular 2 in a Meteor app:

The package contains `METEOR_PROVIDERS` providers that simplify development of a Meteor app with Angular 2.

You can use Mongo collections in the same way as you would do in a regular Meteor app with the Blaze,
the only thing required is to import and use `METEOR_PROVIDERS` from `angular2-meteor`.
After, you can iterate `Mongo.Cursor`s with Angular 2.0's `ngFor` as follows:

````ts
import {METEOR_PROVIDERS, MeteorReactive} from 'angular2-meteor';

const Parties = new Mongo.Collection('parties');

@Component({
template: `
<div *ngFor="let party of parties">
<p>Name: {{party.name}}</p>
</div>
`
})
class Socially extends MeteorReactive {
constructor() {
this.subscribe('my-subscription');
this.parties = Parties.find();
}
}

@NgModule({
imports: [BrowserModule],
providers: METEOR_PROVIDERS,
declarations: [Socially],
bootstrap: [Socially]
})
export class AppModule { }

platformBrowserDynamic().bootstrapModule(AppModule);
````
`MeteorReactive` is a special utility class that does two things behind the scene for you:
- releases Meteor and Mongo handlers on the destroy event;
- runs Angular 2 zone on Meteor methods' callbacks with
debouncing, i.e., reducing number of zone runs to minimun.

You can read more about `MeteorReactive` in the [tutorial section] (http://www.angular-meteor.com/tutorials/socially/angular2/privacy-and-publish-subscribe-functions)!

At this moment, you are almost set to create awesome apps backed by the power of Angular 2 and Meteor!
We recommend to check out our awesome [tutorial](http://www.angular-meteor.com/tutorials/socially/angular2/bootstrapping) in order to create more complex apps that have security and routing.

## Demos

Check out two demos for the quick how-to:

* the Tutorial's [Socially app](https://github.com/Urigo/meteor-angular2.0-socially)
* Simple [Todos](https://github.com/Urigo/Meteor-Angular2/tree/master/examples/todos-meteor-1.3) demo

## Static Resources

Angular 2 allows to define a component's template and styles in two ways: using template content inline
or using template URL. We recommend to use inline templates.

For that purpose, `angular2-compilers`'s HTML, LESS, and SASS compilers process associated files and
add Node JS-modules that export string file contents outside.
After, one can import a template content in ES6 style:
```
import template from './foo.html';
import style from './foo.less';
```

For more information, please check out [css-compiler](https://github.com/Urigo/angular2-meteor/tree/master/atmosphere-packages/css-compiler)
and [static-templates](https://github.com/Urigo/meteor-static-templates).

> To get rid of the `module './foo.html' not found` warnigns,
> run
```
typings install github:meteor-typings/angular2-compilers --global
```

## TypeScript
The package uses [TypeScript for Meteor](https://github.com/barbatus/typescript) to compile (transpile) `.ts`-files.

TypeScript configuration file a.k.a. `tsconfig.json` is supported as well.

Please note that `tsconfig.json` is not required, but if you want to configure TypeScript
in your IDE or add more options, place `tsconfig.json` in the root folder of your app.
You can read about all available compiler options [here](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json).

Default TypeScript options for Meteor 1.3 are as follows:
````json
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"target": "es5",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"sourceMap": true
}
}
````

### Typings

There are to two major ways to install declaration files:
- by installing NPM packages;
- by using `typings` utility.

A lot of NPM packages already contain typings internally, if not,
you can find almost all typings in the DefinitelyTyped repository.
For example, to install `jquery` typings from there,
run `npm install @types/jquery`, and then add a reference
at the top of your main ts-file: `/// <reference types="@types/jquery" />`.

As for Meteor typings, there is a special NPM that contains only its typings as well:
`meteor-typings`.
Install `meteor-typings` package and add the reference as described above.

Another one way to add typings of 3-party JavaScript libraries is
to use the [`typings`](https://github.com/typings/typings) utility.
This utility is designed to search across and install typings not only from `DefinitelyTyped` but
also own typings registries, which may be helpful in many cases.

For example, to install Meteor declaration file run:
````
npm install typings -g
typings install env~meteor --global
````

For more information on Meteor typings, please read [here](https://github.com/meteor-typings/meteor).

## Babel

It's possibly to use Angular2 with Babel as the primary language.

To make development as convenient as it would be if you chose TypeScript,
there exist special Babel plugins. So you'll need to install them:

```
npm i babel-plugin-angular2-annotations babel-plugin-transform-decorators-legacy babel-plugin-transform-class-properties babel-plugin-transform-flow-strip-types --save-dev
```

Then add `.babelrc` as follows:
```json
{
"plugins": [
"angular2-annotations",
"transform-decorators-legacy",
"transform-class-properties",
"transform-flow-strip-types"
]
}
```

## Contributing
## Change Log

Please read the contributing instructions at [the contributing page](https://github.com/Urigo/angular-meteor/blob/master/.github/CONTRIBUTING.md).
Change log of the package is located [here](CHANGELOG.md).

## Usage
## Roadmap

Go to the [official docs](https://www.angular-meteor.com/)
You can check out the package's roadmap and its status under this repository's issues.

### Acknowledgement
## Contribution
If you know how to make integration of Angular 2 and Meteor better, you are very welcome!

This project started as [ngMeteor](https://github.com/loneleeandroo/ngMeteor), a pre-0.9 meteorite package. Since then a lot has changed but that was the main base.
Check out [CONTRIBUTION.md](CONTRIBUTION.md) for more info.

Also, a lot of features were inspired by @superchris's [angular-meteor fork of ngMeteor](https://github.com/superchris/angular-meteor)
[npm-downloads-image]: http://img.shields.io/npm/dm/angular2-meteor.svg?style=flat
[npm-version-image]: http://img.shields.io/npm/v/angular2-meteor.svg?style=flat
[npm-url]: https://npmjs.org/package/angular2-meteor
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions lerna.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
75 changes: 59 additions & 16 deletions package.json
@@ -1,22 +1,65 @@
{
"name": "angular2-meteor",
"version": "0.7.1",
"keywords": [
"angular",
"angular2",
"angular2-meteor",
"meteor",
"mongo",
"typescript",
"html-templates"
],
"bugs": {
"url": "https://github.com/Urigo/angular2-meteor/issues"
},
"main": "dist/bundles/main.umd.js",
"browser": "dist/bundles/index.umd.js",
"typings": "dist/index.d.ts",
"homepage": "http://www.angular-meteor.com",
"repository": "https://github.com/Urigo/angular2-meteor/",
"description": "Angular 2.0 and Meteor - the perfect stack http://www.angular-meteor.com/",
"author": "Angular2-Meteor (https://github.com/Urigo/angular2-meteor)",
"license": "MIT",
"scripts": {
"commit": "git-cz",
"bootstrap": "lerna bootstrap",
"test": "lerna run test"
"typings": "typings i",
"prebuild": "npm run lint",
"build-only": "tsc || echo not ok",
"build": "npm run build-only && npm run bundle",
"prepublish": "npm run build",
"lint": "tslint modules/**/*.ts",
"pretest": "cd tests && npm install",
"test:unit": "cd tests && meteor test --port 3005 --once --driver-package=dispatch:mocha-phantomjs",
"test:app": "cd tests && meteor test --port 3005 --full-app --once --driver-package=dispatch:mocha-phantomjs",
"test": "npm run test:unit && npm run test:app",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"rollup:browser": "rollup -i ./dist/index.js -o ./dist/bundles/index.umd.js -n ng.meteor -c rollup.config.js",
"rollup:main": "rollup -i ./dist/main.js -o ./dist/bundles/main.umd.js -n ng.meteor -c rollup.config.js",
"bundle": "npm run rollup:browser && npm run rollup:main"
},
"peerDependencies": {
"@angular/core": "^2.0.0",
"angular2-meteor-polyfills": "^0.1.1"
},
"devDependencies": {
"commitizen": "^2.8.6",
"cz-conventional-changelog": "^1.2.0",
"ghooks": "^1.3.2",
"lerna": "2.0.0-beta.28",
"validate-commit-msg": "^2.8.0"
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/core": "^2.0.0",
"@types/underscore": "^1.7.33",
"angular2-meteor-polyfills": "^0.1.1",
"conventional-changelog-cli": "^1.2.0",
"es6-shim": "^0.35.0",
"meteor-typings": "^1.3.0",
"reflect-metadata": "^0.1.2",
"rollup": "^0.35.9",
"rollup-plugin-babel": "^2.6.1",
"rxjs": "5.0.0-beta.11",
"tslint": "^3.6.0",
"typescript": "2.0.7",
"typings": "^1.3.0",
"zone.js": "^0.6.12"
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
},
"ghooks": {
"commit-msg": "validate-commit-msg"
}
"dependencies": {
"underscore": "^1.8.3"
}
}
}

0 comments on commit 4216670

Please sign in to comment.