Skip to content

Commit

Permalink
Support jsnext:main and module fields
Browse files Browse the repository at this point in the history
- Adds separate es build (for webpack 2 and rollup)
- Removes release script (related to thorgate#9 and thorgate#13)
  • Loading branch information
Jyrno42 committed Jul 14, 2017
1 parent 82acdb8 commit 6a4c9a3
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 193 deletions.
52 changes: 39 additions & 13 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
{
"presets": ["es2015"],
"plugins": ["transform-class-properties", "transform-object-rest-spread"],
"env": {
"test": {
"plugins": [
["istanbul", {
"exclude": [
"**/test/*.js",
"test-server.js"
]
}]
]
"env": {
"commonjs": {
"presets": [
"es2015"
],
"plugins": [
"transform-runtime",
"transform-class-properties",
"transform-object-rest-spread"
]
},
"es": {
"presets": [
["es2015", {
"loose": false,
"modules": false
}]
],
"plugins": [
"transform-runtime",
"transform-class-properties",
"transform-object-rest-spread"
]
},
"test": {
"presets": [
"es2015"
],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
["istanbul", {
"exclude": [
"**/test/*.js",
"test-server.js"
]
}]
]
}
}
}
}
1 change: 0 additions & 1 deletion index.js

This file was deleted.

1 change: 0 additions & 1 deletion lib.js

This file was deleted.

28 changes: 17 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
"name": "tg-resources",
"version": "1.0.0",
"description": "Abstractions on-top of `superagent` (or other Ajax libaries) for communication with REST.",
"main": "lib.js",
"main": "./dist/index.js",
"jsnext:main": "./es/index.js",
"module": "es/index.js",
"files": [
"dist/",
"src/",
"lib.js",
"index.js"
],
"scripts": {
"clean": "rimraf dist",
"lint": "eslint src test",
"watch": "watch 'npm run build' src test",
"clean": "$(npm bin)/rimraf dist",
"lint": "$(npm bin)/eslint src test",
"pretest": "npm run lint",
"test": "NODE_ENV=test nyc --require babel-register mocha -u exports test/*.js",
"coverage": "nyc report && nyc report --reporter=html",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "cross-env BABEL_ENV=test $(npm bin)/nyc mocha -u exports test/*.js",
"coverage": "$(npm bin)/nyc report && $(npm bin)/nyc report --reporter=html",
"coveralls": "$(npm bin)/nyc report --reporter=text-lcov | $(npm bin)/coveralls",
"prebuild": "npm run clean -s",
"build": "babel --optional runtime src -d dist",
"toc": "doctoc --github --title \"# Changelog\" CHANGELOG.md",
"prerelease": "npm run build -s",
"release": "node ./scripts/release.js"
"build": "npm run build:umd && npm run build:es",
"build:umd": "cross-env BABEL_ENV=commonjs $(npm bin)/babel src -d dist",
"build:es": "cross-env BABEL_ENV=es $(npm bin)/babel src -d es",
"toc": "$(npm bin)/doctoc --github --title \"# Changelog\" CHANGELOG.md"
},
"repository": {
"type": "git",
Expand All @@ -46,13 +47,15 @@
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.0",
"babel-runtime": "*",
"body-parser": "^1.17.2",
"chai": "^4.1.0",
"cookie-parser": "^1.4.3",
"coveralls": "*",
"cross-env": "^5.0.1",
"debug": "*",
"doctoc": "*",
"eslint": "^3.19.0",
Expand All @@ -78,6 +81,9 @@
"cookie": ">=0.2.2"
},
"nyc": {
"require": [
"babel-register"
],
"sourceMap": false,
"instrument": false
}
Expand Down
159 changes: 0 additions & 159 deletions scripts/release.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rules": {
"no-new": 0,
},
"no-new": 0
}
}
2 changes: 1 addition & 1 deletion test/InvalidResponseCode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { InvalidResponseCode } from '../index';
import { InvalidResponseCode } from '../src';


let instance = null;
Expand Down
2 changes: 1 addition & 1 deletion test/NetworkError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { NetworkError } from '../index';
import { NetworkError } from '../src';


let instance = null;
Expand Down
2 changes: 1 addition & 1 deletion test/ValidationError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { ValidationError } from '../index';
import { ValidationError } from '../src';

let instance = null;

Expand Down
2 changes: 1 addition & 1 deletion test/exports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert, expect } from 'chai';

import * as tgResources from '../index';
import * as tgResources from '../src';
import { isSubClass } from '../src/typeChecks';


Expand Down
2 changes: 1 addition & 1 deletion test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assert, expect } from 'chai';

import listen from '../test-server';

import { Resource } from '../index';
import { Resource } from '../src';
import { isSubClass } from '../src/typeChecks';


Expand Down
2 changes: 1 addition & 1 deletion test/router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import Router, { Resource } from '../index';
import Router, { Resource } from '../src';


export default {
Expand Down

0 comments on commit 6a4c9a3

Please sign in to comment.