-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
5,790 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
# install EditorConfig for VS Code extension | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"airbnb", | ||
"prettier", | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2019, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"prettier", | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"no-useless-constructor": 0, | ||
"class-methods-use-this": 0, | ||
"no-underscore-dangle": 0, | ||
"@typescript-eslint/no-non-null-assertion": 0, | ||
"@typescript-eslint/interface-name-prefix": 0, | ||
"@typescript-eslint/explicit-function-return-type": 0, | ||
"max-classes-per-file": 0, | ||
"no-await-in-loop": "off", | ||
"no-restricted-syntax": "off", | ||
"import/no-extraneous-dependencies": [ | ||
"error", | ||
{ | ||
"devDependencies": true | ||
} | ||
], | ||
"import/prefer-default-export": "off", | ||
"prettier/prettier": [ | ||
"error" | ||
], | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"ts": "never" | ||
} | ||
] | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [ | ||
".js", | ||
".ts" | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Node CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x, 18.x, 20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: yarn install, build, and test | ||
run: | | ||
yarn install | ||
yarn build | ||
yarn test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish Package to npmjs | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: yarn | ||
- run: yarn build | ||
- run: yarn test | ||
- run: npm publish --provenance | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} | ||
CI: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,31 @@ | ||
# use-transport | ||
A React hook with simple and responsible universal transports | ||
|
||
![Node CI](https://github.com/unadlib/use-transport/workflows/Node%20CI/badge.svg) | ||
[![npm](https://img.shields.io/npm/v/use-transport.svg)](https://www.npmjs.com/package/use-transport) | ||
![license](https://img.shields.io/npm/l/use-transport) | ||
|
||
A React hook with simple and responsible universal transports. | ||
|
||
### Motivation | ||
|
||
### Installation | ||
|
||
```bash | ||
npm install use-transport data-transport | ||
# or | ||
yarn add use-transport data-transport | ||
``` | ||
|
||
### Features | ||
|
||
### Example | ||
|
||
### API | ||
|
||
### Options | ||
|
||
### Return | ||
|
||
## License | ||
|
||
`use-transport` is [MIT licensed](https://github.com/unadlib/use-transport/blob/main/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare var __DEV__: boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './src'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"name": "use-transport", | ||
"version": "0.0.1", | ||
"description": "A React hook with simple and responsible universal transports", | ||
"main": "dist/index.cjs.js", | ||
"unpkg": "dist/index.umd.js", | ||
"types": "dist/index.d.ts", | ||
"umd:main": "dist/index.umd.js", | ||
"module": "dist/index.esm.js", | ||
"jsnext:main": "dist/index.esm.js", | ||
"react-native": "dist/index.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"source": "src/index.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"test:coverage": "jest --coverage && coveralls < coverage/lcov.info", | ||
"clean": "rimraf dist", | ||
"build": "yarn clean && tsc --skipLibCheck && yarn build:prod", | ||
"build:prod": "NODE_ENV=production rollup --config --bundleConfigAsCjs", | ||
"commit": "yarn git-cz" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/unadlib/use-transport.git" | ||
}, | ||
"author": "unadlib", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/unadlib/use-transport/issues" | ||
}, | ||
"homepage": "https://github.com/unadlib/use-transport#readme", | ||
"keywords": [], | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-replace": "^5.0.2", | ||
"@testing-library/react": "^14.2.1", | ||
"@types/jest": "^29.5.0", | ||
"@types/node": "^18.15.5", | ||
"@types/react": "^18.2.66", | ||
"@typescript-eslint/eslint-plugin": "^7.4.0", | ||
"@typescript-eslint/parser": "^7.4.0", | ||
"commitizen": "^4.3.0", | ||
"coveralls": "^3.1.1", | ||
"data-transport": "^4.3.5", | ||
"eslint": "^8.36.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"prettier": "^2.8.6", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^4.4.0", | ||
"rollup": "^3.20.0", | ||
"rollup-plugin-terser": "^7.0.0", | ||
"ts-jest": "^29.1.0", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.5.0", | ||
"typedoc": "^0.23.28", | ||
"typedoc-plugin-markdown": "^3.14.0", | ||
"typescript": "^5.4.3", | ||
"yargs": "^17.7.1" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "jsdom", | ||
"globals": { | ||
"__DEV__": false | ||
} | ||
}, | ||
"peerDependencies": { | ||
"@types/react": "^18.0 || ^17.0", | ||
"data-transport": "^4.3.5", | ||
"react": "^18.0 || ^17.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import replace from '@rollup/plugin-replace'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import pkg from './package.json'; | ||
|
||
const input = './dist/index.js'; | ||
|
||
export default { | ||
input, | ||
output: [ | ||
{ | ||
format: 'cjs', | ||
exports: 'auto', | ||
file: 'dist/index.cjs.js', | ||
sourcemap: true, | ||
}, | ||
{ | ||
format: 'es', | ||
file: 'dist/index.esm.js', | ||
sourcemap: true, | ||
}, | ||
{ | ||
format: 'umd', | ||
name: pkg.name | ||
.split('-') | ||
.map(([s, ...rest]) => [s.toUpperCase(), ...rest].join('')) | ||
.join(''), | ||
file: pkg.unpkg, | ||
sourcemap: true, | ||
globals: { | ||
'data-transport': 'DataTransport', | ||
react: 'React', | ||
}, | ||
exports: 'named', | ||
}, | ||
], | ||
plugins: [ | ||
resolve(), | ||
commonjs(), | ||
replace({ | ||
__DEV__: 'false', | ||
preventAssignment: true, | ||
}), | ||
terser(), | ||
], | ||
external: ['data-transport', 'react'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const add = (a: number, b: number) => a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test('', () => { | ||
// | ||
}); |
Oops, something went wrong.