Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
schmod committed Apr 15, 2016
1 parent a9810eb commit 0055667
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@

[![Circle CI](https://circleci.com/gh/schmod/babel-plugin-angularjs-annotate.svg?style=svg)](https://circleci.com/gh/schmod/bablel-plugin-angularjs-annotate)

Experimental fork of [ng-annotate](https://github.com/olov/ng-annotate).
Experimental fork of [ng-annotate](https://github.com/olov/ng-annotate). Adds Angular 1.x DI annotations to ES5/ES6 code being processed by babel, with support for explicit annotations (`/* @ngInject */`) and implicit annotations of idiomatic Angular code.

Work in progress. **Do not use this for anything serious.** Stick with [ng-annotate](https://github.com/olov/ng-annotate)
or [babel-ng-annotate](https://github.com/mchmielarski/babel-plugin-ng-annotate) for now.
Work in progress. **Test thoroughly before using this in production.** If stability is a priority, consider [ng-annotate](https://github.com/olov/ng-annotate)
or [babel-ng-annotate](https://github.com/mchmielarski/babel-plugin-ng-annotate), which are both excellent alternatives to this plugin.

This plugin currently supports matching and transforming all of the patterns currently recognized by ng-annotate (explicit and implicit), and passes the relevant portions of ng-annotate's test suite. ES6 support will be expanded in future releases -- contributions are welcome!

See [ng-annotate](https://github.com/olov/ng-annotate)'s documentation for more details.

## Usage

Use like any other [Babel plugin](https://babeljs.io/docs/plugins/).

Most users will want to run

```sh
$ npm install babel-plugin-angularjs-annotate --save-dev
```

and add the plugin to your `.babelrc` file:

```json
{
"presets": ["es2015"],
"plugins": ["path/to/babel-ng-annotate"]
}
```

## Goals & Tasks

Expand All @@ -14,7 +37,7 @@ functionality for Angular 1.x developers who are already using Babel and/or codi

Because of some of the limitations presented by Babel's transformation process, this project does not aim to
achieve feature parity, or provide identical output to ng-annotate. Notably, Babel does not preserve formatting
and indentations like ng-annotate does.
and indentations like ng-annotate does, and this project does not seek to replicate the features of ng-annotate that remove or transform existing annotations.

Initially, I had hoped to make very few modifications to the upstream sources, in the hopes of eventually
merging babel support directly into ng-annotate. Unfortunately, Babylon appears to have diverged too
Expand All @@ -25,29 +48,10 @@ That being said, this is my short-term todo list:
* ✓ Support the majority of invocations/annotations currently performed by ng-annotate
* ✓ Split up ng-annotate's test suite to be more granular and tolerant of some of babel's other transforms.
* ✓ Actually pass those tests.
* Pass tests in conjunction with the ES2015 preset.
* Cleanup. Remove vestigial functionality from the upstream project.
* Pass tests in conjunction with the ES2015 preset. _(almost)_
* Cleanup. Remove vestigial functionality from the upstream project.
* Support a (very) limited set of ES6-friendly annotation patterns.
* Publish to npm, make a release, etc.


## Don't Say I Didn't Warn You

To test this mess of an experiment, create a .babelrc file for your sources

```json
{
"presets": ["es2015"],
"plugins": ["path/to/babel-ng-annotate"]
}

```

And try it out:

```
babel myCode.js
```
* ✓ Publish to npm, make a release, etc.

### To run tests:

Expand Down

0 comments on commit 0055667

Please sign in to comment.