Commit a80cd47f by Wee

chore: add CircleCI and Coveralls

parent 12fd0431
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.0
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:lts
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: yarn install
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
paths:
- node_modules
# run tests!
# TODO: yarn lint && yarn test
- run: yarn test
- run:
name: post coverage
command: cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
......@@ -4,3 +4,4 @@ node_modules
umd
/*.js
!rollup.config.js
/coverage
An enhanced version of **react-router-v4 Route** Component that keeps route component alive on unmatched path and restore it completely on match path.
<p align="center">
<h1 align="center">Tinar</h1>
<p align="center">
An enhanced version of **react-router-v4 Route** Component that keeps route component alive on unmatched path and restore it completely on match path.
<p>
<p align="center">
<i>
<a href="https://www.npmjs.com/package/tinar">
<img src="https://img.shields.io/npm/v/react-live-route.svg?color=%2361AFEF" alt="NPM Version">
</a>
<a href="https://circleci.com/gh/tinarjs/tinar">
<img src="https://img.shields.io/circleci/project/github/tinarjs/tinar/master.svg" alt="Build Status">
</a>
<a href='https://coveralls.io/github/fi3ework/tinar?branch=master'><img src='https://coveralls.io/repos/github/fi3ework/tinar/badge.svg?branch=master&amp;t=CTNsds' alt='Coverage Status' /></a>
</i>
</p>
</p>
## Document
......@@ -63,40 +79,37 @@ LiveRoute will re-render when it come back from a `path` matching location from
Example:
The route of List will be rendered normally under `/list`, and it will be hidden when location change to `/user/:id`, and it will be unmounted normally when entering other locations.
The route of List will be rendered normally under `/list`, and it will be hidden when location change to `/user/:id`, and it will be unmounted normally when entering other locations.
```jsx
import LiveRoute from 'react-live-route'
<LiveRoute path="/list" livePath="/user/:id" component={List} />
;<LiveRoute path="/list" livePath="/user/:id" component={List} />
```
### alwaysLive: bool
`alwaysLive` is just like `livePath`. The difference is the component will not be unmount on **any other location** after the it's first mount.
`alwaysLive` is just like `livePath`. The difference is the component will not be unmount on **any other location** after the it's first mount.
Example:
Example:
After the first mount on match location, the Modal page will be hidden when the path is not matched, and will re-render when `path` match again.
```jsx
import LiveRoute from 'react-live-route'
<LiveRoute path="/list" alwaysLive={true} component={Modal}/>
;<LiveRoute path="/list" alwaysLive={true} component={Modal} />
```
### onHide: (routeState: {location, livePath, alwaysLive}) => any
This hook will be triggered when LiveRoute will hide in `componentWillReceiveProps` stage (so it happens before re-render).
This hook will be triggered when LiveRoute will hide in `componentWillReceiveProps` stage (so it happens before re-render).
### onReappear: (routeState: {location, livePath, alwaysLive}) => any
This hook will be triggered when LiveRoute will reappear from hide in `componentWillReceiveProps` stage (so it happens before re-render).
This hook will be triggered when LiveRoute will reappear from hide in `componentWillReceiveProps` stage (so it happens before re-render).
```js
import LiveRoute from 'react-live-route'
<LiveRoute
;<LiveRoute
path="/items"
component={List}
livePath="/item/:id"
......@@ -114,7 +127,6 @@ import LiveRoute from 'react-live-route'
## TODO
- [ ] add test case
- [ ] add forceUnmount prop
## Licence
......
......@@ -13,7 +13,7 @@
"dev": "tsc -b -w --pretty",
"prepare": "npm run build",
"lint": "tslint src",
"test": "jest",
"test": "jest --coverage",
"test:watch": "jest --watch"
},
"peerDependencies": {
......@@ -34,6 +34,7 @@
"@types/react": "^16.7.18",
"@types/react-dom": "^16.0.11",
"@types/react-router-dom": "^4.3.1",
"coveralls": "^3.0.3",
"jest": "^24.5.0",
"jest-environment-jsdom": "^24.5.0",
"react-testing-library": "^6.0.0",
......
......@@ -25,8 +25,8 @@ interface IProps extends RouteProps {
name?: string
}
const debugLog = (...messages: string[]) => {
// console.log(...messages)
const debugLog = (message: any) => {
// console.log(message)
}
/**
......
......@@ -867,6 +867,18 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
coveralls@^3.0.3:
version "3.0.3"
resolved "http://registry.npm.taobao.org/coveralls/download/coveralls-3.0.3.tgz#83b1c64aea1c6afa69beaf50b55ac1bc4d13e2b8"
integrity sha1-g7HGSuocavppvq9QtVrBvE0T4rg=
dependencies:
growl "~> 1.10.0"
js-yaml "^3.11.0"
lcov-parse "^0.0.10"
log-driver "^1.2.7"
minimist "^1.2.0"
request "^2.86.0"
cross-spawn@^6.0.0:
version "6.0.5"
resolved "http://registry.npm.taobao.org/cross-spawn/download/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
......@@ -1314,6 +1326,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2:
resolved "http://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00"
integrity sha1-/7cD4QZuig7qpMi4C6klPu77+wA=
"growl@~> 1.10.0":
version "1.10.5"
resolved "http://registry.npm.taobao.org/growl/download/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
integrity sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4=
growly@^1.3.0:
version "1.3.0"
resolved "http://registry.npm.taobao.org/growly/download/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
......@@ -2093,7 +2110,7 @@ js-tokens@^3.0.2:
resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls=
js-yaml@^3.12.0, js-yaml@^3.7.0:
js-yaml@^3.11.0, js-yaml@^3.12.0, js-yaml@^3.7.0:
version "3.12.2"
resolved "http://registry.npm.taobao.org/js-yaml/download/js-yaml-3.12.2.tgz#ef1d067c5a9d9cb65bd72f285b5d8105c77f14fc"
integrity sha1-7x0GfFqdnLZb1y8oW12BBcd/FPw=
......@@ -2216,6 +2233,11 @@ lcid@^2.0.0:
dependencies:
invert-kv "^2.0.0"
lcov-parse@^0.0.10:
version "0.0.10"
resolved "http://registry.npm.taobao.org/lcov-parse/download/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3"
integrity sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=
left-pad@^1.3.0:
version "1.3.0"
resolved "http://registry.npm.taobao.org/left-pad/download/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e"
......@@ -2262,6 +2284,11 @@ lodash@^4.17.11:
resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
integrity sha1-s56mIp72B+zYniyN8SU2iRysm40=
log-driver@^1.2.7:
version "1.2.7"
resolved "http://registry.npm.taobao.org/log-driver/download/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
integrity sha1-Y7lQIfBwL+36LJuwok53l9cYcdg=
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1:
version "1.4.0"
resolved "http://registry.npm.taobao.org/loose-envify/download/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
......@@ -2910,7 +2937,7 @@ request-promise-native@^1.0.5:
stealthy-require "^1.1.1"
tough-cookie "^2.3.3"
request@^2.87.0:
request@^2.86.0, request@^2.87.0:
version "2.88.0"
resolved "http://registry.npm.taobao.org/request/download/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
integrity sha1-nC/KT301tZLv5Xx/ClXoEFIST+8=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment