Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 36dbec7

Browse files
committed
Initial commit
0 parents  commit 36dbec7

29 files changed

+2586
-0
lines changed

.babelrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"env": {
3+
"build-lib": {
4+
"presets": [["es2015", { "modules": false }], "react"],
5+
"plugins": [
6+
"transform-object-assign"
7+
]
8+
},
9+
"build-cjs": {
10+
"presets": ["es2015", "react"],
11+
"plugins": [
12+
"transform-object-assign"
13+
]
14+
},
15+
"test": {
16+
"presets": ["es2015", "react"],
17+
"plugins": [
18+
"rewire"
19+
]
20+
},
21+
"coverage": {
22+
"presets": ["es2015"],
23+
"plugins": [
24+
"istanbul", "rewire"
25+
]
26+
}
27+
}
28+
}

.eslintrc.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extends:
2+
- airbnb-base
3+
env:
4+
es6: true
5+
node: true
6+
rules:
7+
# sometimes brackets are useful for formatting.
8+
arrow-body-style: 0
9+
10+
# align with typescript.
11+
quotes: ["error", "double", {
12+
"avoidEscape": true,
13+
"allowTemplateLiterals": true
14+
}]
15+
16+
# we use js mainly for non production code.
17+
import/no-extraneous-dependencies: ["error", {
18+
"devDependencies": true,
19+
"optionalDependencies": true,
20+
"peerDependencies": true
21+
}]

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/node_modules/
2+
/coverage/
3+
/npm-debug.log
4+
/lib/
5+
/cjs/
6+
/.awcache/
7+
/.nyc_output/

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
sudo: required
2+
dist: trusty
3+
language: node_js
4+
node_js:
5+
- 6
6+
addons:
7+
apt:
8+
sources:
9+
- google-chrome
10+
packages:
11+
- google-chrome-stable
12+
- google-chrome-beta
13+
before_install:
14+
- export CHROME_BIN=chromium-browser
15+
- export DISPLAY=:99.0
16+
- sh -e /etc/init.d/xvfb start
17+
before_script:
18+
- npm prune
19+
script:
20+
- npm run lint
21+
- npm run test
22+
- npm run test:coverage
23+
after_success:
24+
- npm run ci:coveralls
25+
before_deploy:
26+
- npm run build
27+
deploy:
28+
provider: npm
29+
on:
30+
repo: wikiwi/react-css-transition
31+
tags: true
32+
node: 6
33+
skip_cleanup: true
34+
email: vinh@wikiwi.io
35+
api_key:
36+
secure: ROnp0q0AUa+2Vm2b4MNgnzT4hmyS6fjDAPfwaeERecZC8grY0HnCdwbKgtXw20rC89O9TyhL1oPsliJJA2zu2jNwb04hVze437cBWKamboez1GlhnpC8WPPogbkEQtkPjykFgL2RzsVDY0IPiyqsmwKPtxOJ+TCAIlflWSucLw0ibZUpLr/G7MUe6nNk/a3UlbmdrLvp+j8xu3SLgJ4tYbTNhnQKtRTC2EpCV8M0vcRanCfzOjajBLRf9vdVhf56FLbnUvj3wDQFzTLZj23hq0TniX4JXGoB91KnPKZ92EY6kXM2y1c980smq12K1O2LONOm7YgZsuz3B1/esg4hhU1Ev0IzB1YBE+8wO/2w+cbmnfdldCYJPAKGvL14ZeD5DZEu/SnlLYzs6ltzpJGHtgdw7d1Hg1jMaSdnLZ6DejBd5ywFeXbs0RIjal3Ae2QpmbbM6aqZJooTC6G9KoCzKYs3EI/cMT733JgyfWlY751yKPlYnIYoxez7ad0YNOWo5yjjWEzS2X0ZOdqH0c1OhJGhWuT0kS5RqjUo+LPd11btR1aKbwAkYRz9OfSbOQAD2cI58Xcn9JfaPbL3CEx7zBXwGZ4xvViw7emzG/g0gRXmLgZNxdUG0VjPLb9MgH2Uh66k0o9Ab1/zZum8jHkDRXWPDXxK+GRTp+WukOrz9Oc=

.vimrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
set backupcopy=yes
2+
let s:path = expand('<sfile>:p:h')
3+
let g:syntastic_typescript_checkers = ['tslint']
4+
let g:syntastic_javascript_checkers = ['eslint']
5+
let g:syntastic_yaml_checkers = ['jsyaml']
6+
let NERDTreeShowHidden=1
7+
8+
let g:formatdef_eslint = '"cat > '.expand("%:p:h").'/.fix.'.expand('%:t').';'.
9+
\ s:path.'/node_modules/.bin/eslint --fix --ignore-pattern ''!*'' '.expand("%:p:h").'/.fix.'.expand('%:t').'> /dev/null 2>&1;'.
10+
\ 'cat '.expand("%:p:h").'/.fix.'.expand('%:t').';'.
11+
\ 'rm '.expand("%:p:h").'/.fix.'.expand('%:t').'"'
12+
let g:formatters_javascript = ['eslint']
13+
14+
:function Autoformat()
15+
: if exists(":Autoformat") | :Autoformat | endif
16+
:endfunction
17+
18+
execute 'au BufWrite '.s:path.'/*.tsx :call Autoformat()'
19+
execute 'au BufWrite '.s:path.'/*.ts :call Autoformat()'
20+
execute 'au BufWrite '.s:path.'/*.d.ts :call Autoformat()'
21+
execute 'au BufWrite '.s:path.'/*.json :call Autoformat()'
22+
execute 'au BufWrite '.s:path.'/*.js :call Autoformat()'
23+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (C) 2016 Chi Vinh Le and contributors.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# react-css-transition
2+
3+
Take back control of CSS Transitions for React!
4+
5+
[![NPM Version Widget]][npm version]
6+
[![Build Status Widget]][build status]
7+
[![Coverage Status Widget]][coverage status]
8+
9+
## Installation
10+
11+
```sh
12+
npm install react-css-transition --save
13+
```
14+
15+
16+
[npm version]: https://www.npmjs.com/package/react-css-transition
17+
18+
[npm version widget]: https://img.shields.io/npm/v/react-css-transition.svg?style=flat-square
19+
20+
[build status]: https://travis-ci.org/wikiwi/react-css-transition
21+
22+
[build status widget]: https://img.shields.io/travis/wikiwi/react-css-transition/master.svg?style=flat-square
23+
24+
[coverage status]: https://coveralls.io/github/wikiwi/react-css-transition?branch=master
25+
26+
[coverage status widget]: https://img.shields.io/coveralls/wikiwi/react-css-transition/master.svg?style=flat-square
27+

gulpfile.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const gulp = require("gulp");
2+
const ts = require("gulp-typescript");
3+
const tslint = require("gulp-tslint");
4+
const jsonlint = require("gulp-jsonlint");
5+
const eslint = require("gulp-eslint");
6+
const merge = require("merge2");
7+
const yamllint = require("gulp-yaml-validate");
8+
const babel = require("gulp-babel");
9+
const sourcemaps = require("gulp-sourcemaps");
10+
const fs = require("fs");
11+
12+
const babelConfig = JSON.parse(fs.readFileSync("./.babelrc", "utf8"));
13+
14+
const files = {
15+
tsWithoutTest: ["./src/**/*.ts", "./src/**/*.tsx", "!./src/**/*.spec.tsx", "!./src/**/*.spec.ts"],
16+
tsWithTest: ["./src/**/*.ts", "./src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
17+
json: ["./*.json", "./.babelrc"],
18+
yml: ["./*.yml"],
19+
js: ["./*.js"],
20+
};
21+
22+
function onBuildError() {
23+
this.once("finish", () => process.exit(1));
24+
}
25+
26+
function build(type) {
27+
return () => {
28+
const tsProject = ts.createProject("tsconfig.json", {
29+
noEmitOnError: true,
30+
declaration: type === "lib",
31+
target: "es6",
32+
module: "es6",
33+
});
34+
const tsResult = gulp.src(files.tsWithoutTest)
35+
.pipe(sourcemaps.init())
36+
.pipe(tsProject())
37+
.once("error", onBuildError);
38+
return merge([
39+
tsResult.dts.pipe(gulp.dest(type)),
40+
tsResult.js
41+
.pipe(babel(babelConfig.env[`build-${type}`]))
42+
.pipe(sourcemaps.write("."))
43+
.pipe(gulp.dest(type)),
44+
]);
45+
};
46+
}
47+
48+
gulp.task("lib", ["lint"], build("lib"));
49+
gulp.task("commonjs", ["lint"], build("cjs"));
50+
51+
gulp.task("tslint", () => {
52+
return gulp.src(files.tsWithTest)
53+
.pipe(tslint({
54+
formatter: "verbose",
55+
}))
56+
.pipe(tslint.report());
57+
});
58+
59+
gulp.task("eslint", () => {
60+
return gulp.src(files.js, { dot: true })
61+
.pipe(eslint())
62+
.pipe(eslint.format())
63+
.pipe(eslint.failAfterError());
64+
});
65+
66+
gulp.task("jsonlint", () => {
67+
return gulp.src(files.json, { dot: true })
68+
.pipe(jsonlint())
69+
.pipe(jsonlint.reporter());
70+
});
71+
72+
gulp.task("yamllint", () => {
73+
return gulp.src(files.yml, { dot: true })
74+
.pipe(yamllint());
75+
});
76+
77+
gulp.task("lint", ["jsonlint", "eslint", "tslint", "yamllint"]);
78+
gulp.task("default", ["lint", "lib", "commonjs"]);

karma.conf.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const path = require("path");
2+
3+
module.exports = (config) => {
4+
config.set({
5+
browsers: ["Chrome"], // run in Chrome
6+
singleRun: true, // just run once by default
7+
frameworks: ["mocha"], // use the mocha test framework
8+
files: [
9+
"tests.webpack.js", // just load this file
10+
],
11+
preprocessors: {
12+
"tests.webpack.js": ["webpack", "sourcemap"], // preprocess with webpack and our sourcemap loader
13+
},
14+
remapCoverageReporter: {
15+
"text-summary": null,
16+
// json: './coverage/coverage.json',
17+
// html: './coverage/html'
18+
},
19+
coverageReporter: {
20+
reporters: [
21+
{ type: "in-memory" },
22+
],
23+
},
24+
// TODO: enable coverage after https://github.com/deepsweet/istanbul-instrumenter-loader/pull/29.
25+
reporters: ["dots"], // , "coverage", "remap-coverage"], // report results in this format
26+
webpack: { // kind of a copy of your webpack config
27+
resolve: {
28+
extensions: [".tsx", ".ts", ".js", ".json"],
29+
},
30+
// as required by sinon: https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md.
31+
externals: {
32+
"react/addons": true,
33+
"react/lib/ExecutionEnvironment": true,
34+
"react/lib/ReactContext": true,
35+
},
36+
devtool: "inline-source-map", // just do inline source maps instead of the default
37+
module: {
38+
rules: [
39+
{
40+
test: /\.json$/,
41+
loader: "json",
42+
},
43+
{
44+
test: /\.tsx?$/,
45+
loader: "awesome-typescript",
46+
query: {
47+
sourceMap: true,
48+
useBabel: true,
49+
useCache: false,
50+
module: "commonjs",
51+
},
52+
},
53+
{
54+
enforce: "post",
55+
test: /\.tsx?$/,
56+
include: path.resolve("src"),
57+
loader: "istanbul-instrumenter",
58+
exclude: [
59+
/\.spec\.tsx?$/,
60+
/node_modules/,
61+
],
62+
},
63+
],
64+
},
65+
},
66+
webpackServer: {
67+
noInfo: true,
68+
},
69+
});
70+
};

mocha.opts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--compilers tsx:ts-babel-node/register,ts:ts-babel-node/register
2+
--reporter dot
3+
src/**/*.spec.tsx
4+
src/**/*.spec.ts

0 commit comments

Comments
 (0)