Skip to content

Commit

Permalink
fixed build process
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyan Zhang committed May 29, 2016
1 parent fa20a15 commit d0b993e
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 109 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

29 changes: 3 additions & 26 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
{
"extends": "airbnb",
"extends": "airbnb-base/legacy",
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true,
},
"ecmaFeatures": {
"generators": true,
},
"globals": {
"__DEV__": true,
},
"parser": "babel-eslint",
"rules": {
"babel/generator-star-spacing": 1,
"babel/new-cap": 1,
"babel/object-shorthand": 1,
"babel/arrow-parens": 1,
"babel/no-await-in-loop": 1,
"array-bracket-spacing": [1, "always", {
"singleValue": true,
"objectsInArrays": false,
"arraysInArrays": true,
}],
},
"plugins": [
"babel",
"react",
],
"jest": true,
}
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ build/Release
node_modules

.DS_Store
build
31 changes: 0 additions & 31 deletions .npmignore

This file was deleted.

11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: node_js

node_js:
- "5.3.0"
- "4.0"
- "0.12"
- "0.11"
- 6.2.0
- 5.3.0
- 4.0
- 0.12
- 0.11

compiler: clang-3.6

Expand All @@ -19,3 +20,5 @@ addons:
packages:
- clang-3.6
- g++-4.8

after_success: npm run coveralls
38 changes: 18 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
"name": "identity-obj-proxy",
"version": "1.0.0",
"description": "an identity object using ES6 proxies",
"main": "build/index.js",
"main": "src/index.js",
"scripts": {
"clean": "rimraf build",
"lint": "eslint src test",
"test": "NODE_ENV=test mocha --harmony-proxies",
"test:watch": "npm test -- --watch",
"build:babel": "babel src --out-dir build",
"build": "npm run clean && npm run lint && npm test && npm run build:babel",
"postinstall": "npm run build"
"lint": "eslint src",
"test": "node --harmony_proxies node_modules/.bin/jest",
"coverage": "node --harmony_proxies node_modules/.bin/jest --coverage",
"coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls",
"prepublish": "npm run lint && npm run test"
},
"engines": {
"node": ">=0.11"
Expand All @@ -33,19 +31,19 @@
},
"homepage": "https://github.com/keyanzhang/identity-obj-proxy#readme",
"dependencies": {
"harmony-reflect": "^1.4.2"
"harmony-reflect": "^1.4.6"
},
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.3.26",
"babel-eslint": "^5.0.0-beta6",
"babel-preset-es2015": "^6.3.13",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^2.1.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-react": "^3.13.0",
"expect": "^1.13.4",
"mocha": "^2.3.4",
"rimraf": "^2.5.0"
"coveralls": "^2.11.9",
"eslint": "^2.11.0",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.1",
"jest": "^12.1.1"
},
"jest": {
"automock": false,
"testPathDirs": [
"<rootDir>/src"
]
}
}
14 changes: 14 additions & 0 deletions src/__tests__/index-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable space-before-function-paren, func-names */
var idObj = require('..');

describe('idObj', function() {
it('should return the key as a string', function() {
expect(idObj.foo).toBe('foo');
});
it('should support dot notation', function() {
expect(idObj.bar).toBe('bar');
});
it('should support bracket notation', function() {
expect(idObj[1]).toBe('1');
});
});
25 changes: 19 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
const Reflect = require('harmony-reflect'); // eslint-disable-line no-unused-vars
var Reflect; // eslint-disable-line no-unused-vars
var idObj;

const idObjHandler = {
get: (target, key) => key,
};
function checkIsNodeV6OrAbove() {
if (typeof process === 'undefined') {
return false;
}

const idObj = new Proxy({}, idObjHandler);
return parseInt(process.versions.node.split('.')[0], 10) >= 6;
}

export default idObj;
if (!checkIsNodeV6OrAbove()) {
Reflect = require('harmony-reflect'); // eslint-disable-line global-require
}

idObj = new Proxy({}, {
get: function getter(target, key) {
return key;
}
});

module.exports = idObj;
1 change: 0 additions & 1 deletion test/__setup__/polyfills.js

This file was deleted.

14 changes: 0 additions & 14 deletions test/index.spec.js

This file was deleted.

3 changes: 0 additions & 3 deletions test/mocha.opts

This file was deleted.

0 comments on commit d0b993e

Please sign in to comment.