Skip to content

Commit

Permalink
Merge pull request #14 from homer0/next
Browse files Browse the repository at this point in the history
v4.0.0
  • Loading branch information
homer0 committed Feb 12, 2019
2 parents f3a1b69 + bc518db commit cf2e7ff
Show file tree
Hide file tree
Showing 7 changed files with 2,581 additions and 1,819 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6
8
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "6.10"
- "8.11"
- "10.15"
after_success:
- 'cat ./coverage/lcov.info | ./node_modules/.bin/coveralls'
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Allows you to bundle an [AngularJS](https://angularjs.org) project with [projext

## Introduction

[projext](https://yarnpkg.com/en/package/projext) allows you to configure a project without adding specific settings for a module bundler, then you can decide which build engine to use. This plugin is meant to be used when you are bundling an [AngularJS](https://angularjs.org) and you are using the [webpack](https://webpack.js.org) [build engine](https://yarnpkg.com/en/package/projext-plugin-webpack).
[projext](https://yarnpkg.com/en/package/projext) allows you to configure a project without adding specific settings for a module bundler, then you can decide which build engine to use. This plugin is meant to be used when you are bundling an [AngularJS](https://angularjs.org) application and you are using the [webpack](https://webpack.js.org) [build engine](https://yarnpkg.com/en/package/projext-plugin-webpack).

It adds the [`angularjs-annotate`](https://yarnpkg.com/en/package/babel-plugin-angularjs-annotate) plugin to the [Babel](https://babeljs.io) configuration in order to support AngularJS annotations.

Expand All @@ -34,7 +34,7 @@ class MyService {
|--------------|----------------------------------------------------------------------------------------|
| Package | projext-plugin-webpack-angularjs |
| Description | Allows you to bundle an AngularJS project with projext using the webpack build engine. |
| Node Version | >= v6.10.0 |
| Node Version | >= v8.0.0 |

## Usage

Expand All @@ -46,15 +46,15 @@ Now, when your target gets builded, the plugin will check if the target is using

### Babel

The [`babel-plugin-angularjs-annotate`](https://yarnpkg.com/en/package/babel-plugin-angularjs-annotate) package only works on `function` statements, that's why it needs to update the configuration of the [`babel-preset-env`](https://yarnpkg.com/en/package/babel-preset-env) in order to work.
The [`babel-plugin-angularjs-annotate`](https://yarnpkg.com/en/package/babel-plugin-angularjs-annotate) package only works on `function` statements, that's why it needs to update the configuration of the [`@babel/preset-env`](https://yarnpkg.com/en/package/@babel/preset-env) in order to work.

Let's say you are only supporting the last version of major browsers, well, most of them already support arrow functions and by default they wouldn't be transpiled.

If for some reason you are overwriting the [Babel](https://babeljs.io) configuration projext generates, you need to make sure the following transformations are included:

- `transform-es2015-arrow-functions`
- `transform-es2015-classes`
- `transform-es2015-parameters`
- `@babel/plugin-transform-arrow-functions`
- `@babel/plugin-transform-classes`
- `@babel/plugin-transform-parameters`

### External dependencies

Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,32 @@
"name": "projext-plugin-webpack-angularjs",
"description": "Allows you to bundle an AngularJS project with projext using the webpack build engine.",
"homepage": "https://homer0.github.io/projext-plugin-webpack-angularjs/",
"version": "3.0.0",
"version": "4.0.0",
"repository": "homer0/projext-plugin-webpack-angularjs",
"author": "Leonardo Apiwan (@homer0) <me@homer0.com>",
"license": "MIT",
"dependencies": {
"babel-plugin-angularjs-annotate": "0.9.0"
"babel-plugin-angularjs-annotate": "0.10.0"
},
"devDependencies": {
"wootils": "^1.3.2",
"eslint": "4.19.1",
"eslint-config-airbnb-base": "13.0.0",
"eslint-plugin-import": "2.12.0",
"eslint-plugin-node": "6.0.1",
"babel-preset-env": "1.7.0",
"jest-ex": "5.0.0",
"jest-cli": "23.1.0",
"jasmine-expect": "3.8.3",
"wootils": "^2.0.0",
"eslint": "5.13.0",
"eslint-config-airbnb-base": "13.1.0",
"eslint-plugin-import": "2.16.0",
"eslint-plugin-node": "8.0.1",
"@babel/core": "7.2.2",
"@babel/preset-env": "7.3.1",
"jest-ex": "^6.0.0",
"jest-cli": "24.0.0",
"jasmine-expect": "4.0.1",
"esdoc": "1.1.0",
"esdoc-standard-plugin": "1.0.0",
"esdoc-node": "1.0.3",
"coveralls": "3.0.1"
"esdoc-node": "1.0.4",
"coveralls": "3.0.2"
},
"engine-strict": true,
"engines": {
"node": ">=6.0.0",
"node": ">=8.0.0",
"npm": ">=3.0.0"
},
"main": "src/index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class ProjextAngularJSPlugin {
* @ignore
*/
this._babelRequiredEnvFeatures = [
'transform-es2015-arrow-functions',
'transform-es2015-classes',
'transform-es2015-parameters',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-classes',
'@babel/plugin-transform-parameters',
];
/**
* The name of the reducer event the service uses to intercept a browser target default HTML
Expand Down Expand Up @@ -125,7 +125,7 @@ class ProjextAngularJSPlugin {
}
/**
* This method gets called when projext reduces a target Babel configuration. The method will
* validate the target settings and add the Babel plugins needed for JSX.
* validate the target settings and add the Babel plugin needed for AngularJS annotations.
* @param {Object} currentConfiguration The current Babel configuration for the target.
* @param {Target} target The target information.
* @param {BabelHelper} babelHelper To update the target configuration and add the
Expand Down
12 changes: 6 additions & 6 deletions tests/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ describe('plugin:projextAngularJS/main', () => {
let result = null;
const expectedConfigWithEnvFeatures = Object.assign({}, initialBabelConfiguration, {
features: [
'transform-es2015-arrow-functions',
'transform-es2015-classes',
'transform-es2015-parameters',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-classes',
'@babel/plugin-transform-parameters',
],
});
const expectedConfigWithPlugin = Object.assign({}, expectedConfigWithEnvFeatures, {
Expand All @@ -126,9 +126,9 @@ describe('plugin:projextAngularJS/main', () => {
expect(babelHelper.addEnvPresetFeature).toHaveBeenCalledWith(
initialBabelConfiguration,
[
'transform-es2015-arrow-functions',
'transform-es2015-classes',
'transform-es2015-parameters',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-classes',
'@babel/plugin-transform-parameters',
]
);
expect(babelHelper.addPlugin).toHaveBeenCalledTimes(1);
Expand Down
Loading

0 comments on commit cf2e7ff

Please sign in to comment.