Skip to content

Commit 7ae1471

Browse files
committed
ci: setup circleci to auto deploy
1 parent decde32 commit 7ae1471

File tree

5 files changed

+666
-24
lines changed

5 files changed

+666
-24
lines changed

.circleci/config.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
defaults: &defaults
3+
working_directory: ~/ayanami
4+
docker:
5+
- image: circleci/node:10-browsers
6+
7+
version: 2
8+
jobs:
9+
build:
10+
<<: *defaults
11+
steps:
12+
- checkout
13+
- run: echo 'export PATH=${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin' >> $BASH_ENV
14+
- run: curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
15+
- run: sudo ln -sf ~/.yarn/bin/yarn /usr/local/bin/yarn
16+
- restore_cache:
17+
key: dependency-cache-{{ checksum "package.json" }}
18+
- run:
19+
name: yarn-with-greenkeeper
20+
command: |
21+
sudo yarn global add greenkeeper-lockfile@1
22+
yarn
23+
- save_cache:
24+
key: dependency-cache-{{ checksum "package.json" }}
25+
paths:
26+
- ~/.cache/yarn
27+
- run: greenkeeper-lockfile-update
28+
- run: yarn build
29+
- run: greenkeeper-lockfile-upload
30+
- persist_to_workspace:
31+
root: ~/ayanami
32+
paths:
33+
- ./*
34+
test:
35+
<<: *defaults
36+
steps:
37+
- attach_workspace:
38+
at: ~/ayanami
39+
- run: yarn lint
40+
- run: yarn check_circular_dependencies
41+
- run: yarn test
42+
- run:
43+
name: report-coverage
44+
command: codecov -f coverage/*.json
45+
46+
deploy:
47+
<<: *defaults
48+
steps:
49+
- attach_workspace:
50+
at: ~/ayanami
51+
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
52+
- run: |
53+
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
54+
then
55+
npm publish
56+
else
57+
echo "Not a release, skipping publish"
58+
fi
59+
workflows:
60+
version: 2
61+
build_test_and_deploy:
62+
jobs:
63+
- build
64+
- test:
65+
requires:
66+
- build
67+
- deploy:
68+
requires:
69+
- test
70+
filters:
71+
tags:
72+
only: /.*/
73+
branches:
74+
only: master

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ dist/
55
.cache
66
*.tgz
77
.DS_Store
8+
esm
9+
esnext

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ayanami &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/LeetCode-OpenSource/ayanami/blob/master/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier) [![npm version](https://img.shields.io/npm/v/ayanami.svg?style=flat)](https://www.npmjs.com/package/ayanami)
1+
# Ayanami &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/LeetCode-OpenSource/ayanami/blob/master/LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier) [![npm version](https://img.shields.io/npm/v/ayanami.svg?style=flat)](https://www.npmjs.com/package/ayanami) [![CircleCI](https://circleci.com/gh/LeetCode-OpenSource/ayanami.svg?style=svg)](https://circleci.com/gh/LeetCode-OpenSource/ayanami) [![codecov](https://codecov.io/gh/LeetCode-OpenSource/ayanami/branch/master/graph/badge.svg)](https://codecov.io/gh/LeetCode-OpenSource/ayanami)
22

33
> A better way to react with state. Inspire by [redux-epics-decorator](https://github.com/LeetCode-OpenSource/redux-epics-decorator)
44

package.json

+15-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"version": "0.1.0",
44
"description": "A better way to react with state",
55
"main": "./dist/index.js",
6+
"module": "./esm/index.js",
7+
"esnext": "./esnext/index.js",
68
"types": "./dist/index.d.ts",
9+
"sideEffects": false,
710
"repository": {
811
"type": "git",
912
"url": "git+https://github.com/LeetCode-OpenSource/ayanami.git"
@@ -13,8 +16,12 @@
1316
},
1417
"homepage": "https://github.com/LeetCode-OpenSource/ayanami#readme",
1518
"scripts": {
19+
"check_circular_dependencies": "madge esm/index.js --circular --warning",
1620
"demo": "parcel ./demo/index.html",
17-
"build": "rm -rf ./dist && tsc -p ./tsconfig.build.json",
21+
"build": "npm-run-all -p build:es5 build:esm build:next",
22+
"build:es5": "shx rm -rf ./dist && tsc -p ./tsconfig.build.json",
23+
"build:esm": "shx rm -rf ./esm && tsc -p ./tsconfig.build.json -m esnext --outDir esm",
24+
"build:next": "shx rm -rf ./esnext && tsc -p ./tsconfig.build.json --target esnext --outDir esnext",
1825
"prettier": "prettier '@(src|demo)/**/*.@(ts|tsx|html|less)' --write",
1926
"lint": "tslint -p tsconfig.json --fix",
2027
"test": "jest --collectCoverage"
@@ -59,23 +66,27 @@
5966
"@types/react-dom": "^16.8.3",
6067
"@types/react-test-renderer": "^16.8.1",
6168
"@types/shallowequal": "^1.1.1",
69+
"codecov": "^3.2.0",
6270
"husky": "^1.3.1",
6371
"jest": "^24.5.0",
6472
"lint-staged": "^8.1.5",
73+
"madge": "^3.4.4",
74+
"npm-run-all": "^4.1.5",
6575
"parcel": "^1.12.3",
6676
"prettier": "^1.16.4",
6777
"react": "^16.8.6",
6878
"react-dom": "^16.8.6",
6979
"react-test-renderer": "^16.8.6",
70-
"ts-jest": "^24.0.0",
80+
"shx": "^0.3.2",
81+
"ts-jest": "^24.0.1",
7182
"tslib": "^1.9.3",
7283
"tslint": "^5.14.0",
7384
"tslint-eslint-rules": "^5.4.0",
7485
"tslint-react": "^4.0.0",
7586
"tslint-sonarts": "^1.9.0",
76-
"typescript": "^3.3.4000"
87+
"typescript": "^3.4.1"
7788
},
7889
"peerDependencies": {
79-
"react": "^16.8.1"
90+
"react": "^16.8.6"
8091
}
8192
}

0 commit comments

Comments
 (0)