init create-react-hook@2.6.18

This commit is contained in:
2019-12-31 13:30:23 +05:30
commit 5e5b56ad52
20 changed files with 23936 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
+22
View File
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
dist
.rpt2_cache
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+4
View File
@@ -0,0 +1,4 @@
language: node_js
node_js:
- 9
- 8
+36
View File
@@ -0,0 +1,36 @@
# some-hooks
> Collection of some reusable hooks that I use
[![NPM](https://img.shields.io/npm/v/some-hooks.svg)](https://www.npmjs.com/package/some-hooks) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
```bash
npm install --save some-hooks
```
## Usage
```tsx
import * as React from 'react'
import { useMyHook } from 'some-hooks'
const Example = () => {
const example = useMyHook()
return (
<div>
{example}
</div>
)
}
```
## License
MIT © [bendtherules](https://github.com/bendtherules)
---
This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).
+2026
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
{
"name": "some-hooks-example",
"homepage": "https://bendtherules.github.io/some-hooks",
"version": "0.0.0",
"license": "MIT",
"private": true,
"dependencies": {
"react": "link:../node_modules/react",
"react-dom": "^16.8.6",
"react-scripts": "^3.0.1",
"some-hooks": "link:.."
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
+20
View File
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<title>some-hooks</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
</body>
</html>
+8
View File
@@ -0,0 +1,8 @@
{
"short_name": "some-hooks",
"name": "some-hooks",
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
+13
View File
@@ -0,0 +1,13 @@
import React from 'react'
import { useMyHook } from 'some-hooks'
const App = () => {
const example = useMyHook()
return (
<div>
{example}
</div>
)
}
export default App
+5
View File
@@ -0,0 +1,5 @@
/* body {
margin: 0;
padding: 0;
font-family: sans-serif;
} */
+7
View File
@@ -0,0 +1,7 @@
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
ReactDOM.render(<App />, document.getElementById('root'))
+10600
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
{
"name": "some-hooks",
"version": "1.0.0",
"description": "Collection of some reusable hooks that I use",
"author": "bendtherules",
"license": "MIT",
"repository": "bendtherules/some-hooks",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "yarn run build",
"predeploy": "cd example && yarn install && yarn run build",
"deploy": "gh-pages -d example/build"
},
"dependencies": {},
"peerDependencies": {
"react": "^16.8.6"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/runtime": "^7.3.1",
"@types/jest": "^23.3.13",
"@types/react": "^16.7.22",
"cross-env": "^5.2.0",
"gh-pages": "^2.0.1",
"react": "^16.8.6",
"react-scripts": "^3.0.1",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-typescript2": "^0.19.2",
"rollup-plugin-url": "^2.1.0",
"typescript": "^3.2.4"
}
}
+35
View File
@@ -0,0 +1,35 @@
import typescript from 'rollup-plugin-typescript2'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import pkg from './package.json'
export default {
input: 'src/index.tsx',
output: [
{
file: pkg.main,
format: 'cjs',
exports: 'named',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
exports: 'named',
sourcemap: true
}
],
plugins: [
external(),
url({ exclude: ['**/*.svg'] }),
resolve(),
typescript({
rollupCommonJSResolveHack: true,
clean: true
}),
commonjs()
]
}
+23
View File
@@ -0,0 +1,23 @@
import * as React from 'react';
export const useMyHook = () => {
let [{
counter
}, setState] = React.useState<{
counter: number;
}>({
counter: 0
});
React.useEffect(() => {
let interval = window.setInterval(() => {
counter++;
setState({counter})
}, 1000)
return () => {
window.clearInterval(interval);
};
}, []);
return counter;
};
+1
View File
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
+7
View File
@@ -0,0 +1,7 @@
import { useMyHook } from './'
describe('useMyHook', () => {
it('is truthy', () => {
expect(useMyHook).toBeTruthy()
})
})
+43
View File
@@ -0,0 +1,43 @@
{
"compilerOptions": {
"outDir": "build",
"module": "esnext",
"target": "es5",
"lib": [
"es6",
"dom",
"es2016",
"es2017"
],
"sourceMap": true,
"allowJs": false,
"jsx": "preserve",
"declaration": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"resolveJsonModule": true,
"isolatedModules": false,
"noEmit": true
},
"include": [
"src"
],
"exclude": [
"node_modules",
"build",
"dist",
"example",
"rollup.config.js"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs"
}
}
+11000
View File
File diff suppressed because it is too large Load Diff