Skip to content

Commit

Permalink
init monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
李元秋 committed Nov 11, 2019
0 parents commit acf62c9
Show file tree
Hide file tree
Showing 74 changed files with 35,438 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules/
.deprecated
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: node_js
node_js:
- "8"
- "10"
- "12"
cache: yarn
jobs:
include:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2
- export PATH="$HOME/.yarn/bin:$PATH"
- yarn global add codecov lerna
script:
- lerna bootstrap
- cd packages/final-state
- yarn build
- yarn test
- cd -
- cd packages/final-state-logger
- yarn build
- yarn test
- cd -
- cd packages/final-state-rx
- yarn build
- yarn test
- cd -
- cd packages/react-final-state
- yarn build
- yarn test
- cd -
after_success:
- codecov
Empty file added README.md
Empty file.
24 changes: 24 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
coverage:
status:
project:
final-state:
flags: final-state
final-state-rx:
flags: final-state-rx
final-state-logger:
flags: final-state-logger
react-final-state:
flags: react-final-state
flags:
final-state:
paths:
- packages/final-state
final-state-rx:
paths:
- packages/final-state-rx
final-state-logger:
paths:
- packages/final-state-logger
react-final-state:
paths:
- packages/react-final-state
5 changes: 5 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"npmClient": "yarn",
"packages": ["packages/*"],
"version": "2.0.0-alpha.1"
}
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "final-state-workspace",
"version": "0.0.1",
"description": "final state workspace",
"main": "index.js",
"repository": "https://github.com/final-state/monorepo.git",
"author": "[email protected]",
"license": "MIT",
"private": true,
"devDependencies": {
"lerna": "^3.14.1"
}
}
2 changes: 2 additions & 0 deletions packages/final-state-logger/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
scripts/
29 changes: 29 additions & 0 deletions packages/final-state-logger/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'airbnb-base',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
indent: 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'no-dupe-class-members': 'off',
'import/no-extraneous-dependencies': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.js'],
},
},
},
env: {
jest: true,
},
};
8 changes: 8 additions & 0 deletions packages/final-state-logger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.log
.DS_Store
node_modules
.rts2_cache_cjs
.rts2_cache_esm
.rts2_cache_umd
/coverage/
dist
6 changes: 6 additions & 0 deletions packages/final-state-logger/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/coverage/
/.rts2_cache_cjs/
/.rts2_cache_esm/
/coverage/
/dist/
/node_modules/
6 changes: 6 additions & 0 deletions packages/final-state-logger/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 80,
semi: true,
};
13 changes: 13 additions & 0 deletions packages/final-state-logger/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
node_js:
- '10'
cache: yarn
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2
- export PATH="$HOME/.yarn/bin:$PATH"
- yarn global add codecov
script:
- yarn build
- yarn test
after_success:
- codecov
2 changes: 2 additions & 0 deletions packages/final-state-logger/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add tests for new features
- Run `yarn test` before raising a PR
21 changes: 21 additions & 0 deletions packages/final-state-logger/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 final-state

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.
44 changes: 44 additions & 0 deletions packages/final-state-logger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[![Build Status](https://travis-ci.com/final-state/final-state-logger.svg?branch=master)](https://travis-ci.com/final-state/final-state-logger)
[![codecov.io](https://codecov.io/gh/final-state/final-state-logger/branch/master/graph/badge.svg)](https://codecov.io/gh/final-state/final-state-logger)
[![Known Vulnerabilities](https://snyk.io/test/github/final-state/final-state-logger/badge.svg)](https://snyk.io/test/github/final-state/final-state-logger)
[![minified + gzip](https://badgen.net/bundlephobia/minzip/[email protected])](https://bundlephobia.com/[email protected])
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

# final-state-logger

> Logger for `final-state`. (Just like `redux-logger` to `redux`)
## Installation

```bash
yarn add final-state
yarn add final-state-logger
```

You should care about the `peer dependencies` of this package. If something not installed, just install them manually.

`final-state-logger` is written in `Typescript`, so you don't need to find a type definition for it.

## Basic Example

```javascript
import { applyLogger } from 'final-state-logger';

applyLogger(store);
```

## API Reference

### function finalStateLogger(store: Store): void

Print all state changes of the passed in store instance.

## Test

This project uses [jest](https://jestjs.io/) to perform testing.

```bash
yarn test
```

## Road Map
56 changes: 56 additions & 0 deletions packages/final-state-logger/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "final-state-logger",
"version": "1.0.1",
"author": "[email protected]",
"main": "dist/index.js",
"module": "dist/final-state-logger.esm.js",
"typings": "dist/index.d.ts",
"sideEffects": false,
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/final-state/final-state-logger"
},
"homepage": "https://final-state.github.io/final-state-logger",
"files": [
"dist"
],
"scripts": {
"lint": "eslint -c .eslintrc.js --ext ts src",
"pub": "bash scripts/pub.sh",
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test --coverage"
},
"peerDependencies": {
"date-fns": "^2.0.0"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"devDependencies": {
"@types/jest": "^24.0.15",
"@typescript-eslint/eslint-plugin": "^2.1.0",
"@typescript-eslint/parser": "^2.1.0",
"date-fns": "^2.0.1",
"eslint": "6.1.0",
"eslint-config-airbnb-base": "14.0.0",
"eslint-config-prettier": "^6.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.0",
"final-state": "^1.1.1",
"husky": "^2.4.1",
"immer": "^3.2.0",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"tsdx": "^0.7.2",
"tslib": "^1.10.0",
"typescript": "^3.6.2"
},
"dependencies": {
"@types/deep-diff": "^1.0.0",
"deep-diff": "^1.0.2"
}
}
14 changes: 14 additions & 0 deletions packages/final-state-logger/scripts/pub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

VERSION=$1

if [[ $VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]
then
node scripts/update-readme.js $VERSION
yarn publish --access public --new-version $VERSION
git status
else
echo "VERSION not correct!"
fi
22 changes: 22 additions & 0 deletions packages/final-state-logger/scripts/update-readme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { readFile, writeFile } = require('fs');
const { argv } = require('process');

const version = argv[2];

readFile('./README.md', (err1, buf1) => {
if (err1) {
throw err1;
}
const text = buf1
.toString()
.replace(
/final-state-logger@\d+\.\d+\.\d+/g,
`final-state-logger@${version}`,
);

writeFile('./README.md', text, err2 => {
if (err2) {
throw err2;
}
});
});
Loading

0 comments on commit acf62c9

Please sign in to comment.