Skip to content

Commit 0055667

Browse files
committed
Update README.md
1 parent a9810eb commit 0055667

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

README.md

+30-26
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,33 @@
22

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

5-
Experimental fork of [ng-annotate](https://github.com/olov/ng-annotate).
5+
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.
66

7-
Work in progress. **Do not use this for anything serious.** Stick with [ng-annotate](https://github.com/olov/ng-annotate)
8-
or [babel-ng-annotate](https://github.com/mchmielarski/babel-plugin-ng-annotate) for now.
7+
Work in progress. **Test thoroughly before using this in production.** If stability is a priority, consider [ng-annotate](https://github.com/olov/ng-annotate)
8+
or [babel-ng-annotate](https://github.com/mchmielarski/babel-plugin-ng-annotate), which are both excellent alternatives to this plugin.
9+
10+
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!
11+
12+
See [ng-annotate](https://github.com/olov/ng-annotate)'s documentation for more details.
13+
14+
## Usage
15+
16+
Use like any other [Babel plugin](https://babeljs.io/docs/plugins/).
17+
18+
Most users will want to run
19+
20+
```sh
21+
$ npm install babel-plugin-angularjs-annotate --save-dev
22+
```
23+
24+
and add the plugin to your `.babelrc` file:
25+
26+
```json
27+
{
28+
"presets": ["es2015"],
29+
"plugins": ["path/to/babel-ng-annotate"]
30+
}
31+
```
932

1033
## Goals & Tasks
1134

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

1538
Because of some of the limitations presented by Babel's transformation process, this project does not aim to
1639
achieve feature parity, or provide identical output to ng-annotate. Notably, Babel does not preserve formatting
17-
and indentations like ng-annotate does.
40+
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.
1841

1942
Initially, I had hoped to make very few modifications to the upstream sources, in the hopes of eventually
2043
merging babel support directly into ng-annotate. Unfortunately, Babylon appears to have diverged too
@@ -25,29 +48,10 @@ That being said, this is my short-term todo list:
2548
* ✓ Support the majority of invocations/annotations currently performed by ng-annotate
2649
* ✓ Split up ng-annotate's test suite to be more granular and tolerant of some of babel's other transforms.
2750
* ✓ Actually pass those tests.
28-
* Pass tests in conjunction with the ES2015 preset.
29-
* Cleanup. Remove vestigial functionality from the upstream project.
51+
* Pass tests in conjunction with the ES2015 preset. _(almost)_
52+
* Cleanup. Remove vestigial functionality from the upstream project.
3053
* Support a (very) limited set of ES6-friendly annotation patterns.
31-
* Publish to npm, make a release, etc.
32-
33-
34-
## Don't Say I Didn't Warn You
35-
36-
To test this mess of an experiment, create a .babelrc file for your sources
37-
38-
```json
39-
{
40-
"presets": ["es2015"],
41-
"plugins": ["path/to/babel-ng-annotate"]
42-
}
43-
44-
```
45-
46-
And try it out:
47-
48-
```
49-
babel myCode.js
50-
```
54+
* ✓ Publish to npm, make a release, etc.
5155

5256
### To run tests:
5357

0 commit comments

Comments
 (0)