Skip to content

Commit

Permalink
Set up project
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhallinan committed Aug 31, 2017
1 parent af1286b commit 0d9b9df
Show file tree
Hide file tree
Showing 17 changed files with 3,629 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"plugins": [
"check-es2015-constants",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-destructuring",
"transform-es2015-duplicate-keys",
"transform-es2015-for-of",
"transform-es2015-function-name",
"transform-es2015-object-super",
"transform-es2015-parameters",
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
"transform-es2015-sticky-regex",
"transform-es2015-template-literals",
"transform-es2015-typeof-symbol",
"transform-es2015-unicode-regex",
"transform-regenerator",
"transform-object-rest-spread"
],
"env": {
"commonjs": {
"plugins": ["transform-es2015-modules-commonjs"]
},
"rollup": {
"plugins": ["external-helpers"]
},
"test": {
"presets": [
"es2015",
"stage-2"
]
}
}
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
61 changes: 61 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"before": true,
"describe": true,
"it": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"rules": {
"array-bracket-spacing": [
"error",
"always"
],
"comma-dangle": [
"error",
"always"
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"new-cap": [
"error",
{
"capIsNew": false
}
],
"no-console": [
"error"
],
"no-self-compare": 1,
"object-curly-spacing": [
"error",
"always"
],
"quotes": [
"error",
"backtick"
],
"semi": [
"error",
"always"
],
"unicorn/explicit-length-check": 0
}
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.nyc_output
.coveralls.yml
coverage
coverage.lcov
dist
es
lib
node_modules
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
test
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- '7'
- '6'
script:
- npm run lint
- npm run test
after_success:
- npm run coverage
21 changes: 21 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Max Hallinan <maxhallinan@gmail.com> (github.com/maxhallinan)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
98 changes: 98 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"name": "reshep",
"version": "0.0.0",
"description": "A declarative props transformation utility.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/maxhallinan/reshep"
},
"main": "./lib/index.js",
"module": "es/index.es.js",
"jsnext:main": "es/index.js",
"unpkg": "dist/reshep.min.js",
"scripts": {
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
"build:umd": "cross-env BABEL_ENV=rollup NODE_ENV=development rollup -c -o dist/reshep.js",
"build:umd:min": "cross-env BABEL_ENV=rollup NODE_ENV=production rollup -c -o dist/reshep.min.js",
"build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min",
"clean": "rimraf coverage dist es lib",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"lint": "./node_modules/.bin/eslint src test",
"prepublishOnly": "npm run clean && npm run build",
"test": "cross-env NODE_ENV=test BABEL_ENV=test nyc mocha 'test/**/*.spec.js'",
"test:watch": "cross-env NODE_ENV=test BABEL_ENV=test nyc mocha 'test/**/*.spec.js' --watch"
},
"author": {
"name": "Max Hallinan",
"email": "maxhallinan@riseup.net"
},
"dependencies": {},
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.24.1",
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-es2015-computed-properties": "^6.24.1",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "^6.24.1",
"babel-plugin-transform-es2015-for-of": "^6.23.0",
"babel-plugin-transform-es2015-function-name": "^6.24.1",
"babel-plugin-transform-es2015-literals": "^6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-es2015-object-super": "^6.24.1",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "^6.24.1",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "^6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-regenerator": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babel-register": "^6.24.1",
"babelrc-rollup": "^3.0.0",
"chai": "^4.0.2",
"coveralls": "^2.13.1",
"cross-env": "^5.0.1",
"eslint": "^4.1.1",
"mocha": "^3.4.2",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^11.0.3",
"redux": "^3.7.1",
"rimraf": "^2.6.1",
"rollup": "^0.43.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.0.0"
},
"keywords": [
"redux",
"redux-action"
],
"files": [
"dist",
"es",
"lib",
"src"
],
"nyc": {
"all": true,
"include": [
"src/**/*.js"
],
"cache": true,
"require": [
"./test/helpers/babel-register.js"
]
}
}
58 changes: 58 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# reshep

[![Build Status](https://travis-ci.org/maxhallinan/reshep.svg?branch=master)](https://travis-ci.org/maxhallinan/reshep)
[![Coverage Status](https://coveralls.io/repos/github/maxhallinan/reshep/badge.svg)](https://coveralls.io/github/maxhallinan/reshep)

*Work in progress.*
A declarative props transformation utility.


## Install

```
$ npm install --save reshep
```


## Usage

```javascript
import { shapeFrom, } from 'reshep';

const enhance = shapeFrom({
'match.params.fooId': 'fooId'
});

const Foo = enhance(({ fooId, }) => (/*...*/));
```

```javascript
import { shapeWith, } from 'reshep';

const enhance = shapeWith({
'match.params.fooId': 'fooId'
});

const Foo = enhance(({ fooId, match, }) => (/*...*/));
```


## API

### shapeFrom(shapeMap)

#### shapeMap

Type: `{ [fromPath]: toPath }`


### shapeWith(shapeMap)

#### shapeMap

Type: `{ [fromPath]: toPath }`


## License

MIT © [Max Hallinan](https://github.com/maxhallinan)
40 changes: 40 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import babel from 'rollup-plugin-babel';
import babelrc from 'babelrc-rollup';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';

const pkg = require('./package.json');
const env = process.env.NODE_ENV;

const external = Object.keys(pkg.dependencies);

const plugins = [
nodeResolve(),
babel(babelrc()),
commonjs(),
];

const config = {
entry: 'src/index.js',
external,
plugins,
format: 'umd',
moduleName: 'redeuceur',
}

if (env === 'production') {
config.plugins.push(
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
}
})
);
}

export default config;

2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default x => x;

1 change: 1 addition & 0 deletions test/helpers/babel-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require(`babel-register`)();
File renamed without changes.
Empty file added test/unit/shape-with.js
Empty file.
Loading

0 comments on commit 0d9b9df

Please sign in to comment.