Skip to content

Commit

Permalink
scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
mathdroid committed Oct 25, 2018
0 parents commit ade49c8
Show file tree
Hide file tree
Showing 13 changed files with 7,696 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
node_modules
*.log
dist
.cache
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
git:
depth: 1
sudo: false
language: node_js
node_js:
- '8'
cache:
yarn: true
directories:
- node_modules
script:
- yarn test
19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2018-present ...

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.
26 changes: 26 additions & 0 deletions README.md
@@ -0,0 +1,26 @@
# `@rehooks/...`

> React hook for ...
> **Note:** This is using the new [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html)
> which is subject to change until React 16.7 final.
>
> You'll need to install `react`, `react-dom`, etc at `^16.7.0-alpha.0`
## Install

```sh
yarn add @rehooks/...
```

## Usage

```js
import use... from '@rehooks/...';

function MyComponent() {
let value = use...();
// value == ...
return <div/>;
}
```
13 changes: 13 additions & 0 deletions example.html
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example</title>
</head>
<body>
<div id="root"></div>
<script src="./example.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions example.js
@@ -0,0 +1,10 @@
import React from 'react';
import { render } from 'react-dom';
import use... from './';

function App() {
let value = use...();
return <div/>;
}

render(<App />, window.root);
5 changes: 5 additions & 0 deletions index.d.ts
@@ -0,0 +1,5 @@
interface ... {
// ...
}

export default function use...(): ...;
8 changes: 8 additions & 0 deletions index.js
@@ -0,0 +1,8 @@
'use strict';
let { useState } = require('react');

function use...() {
return;
}

module.exports = use...;
5 changes: 5 additions & 0 deletions index.js.flow
@@ -0,0 +1,5 @@
interface ... {
// ...
}

declare export default function use...(): ...;
41 changes: 41 additions & 0 deletions package.json
@@ -0,0 +1,41 @@
{
"name": "@rehooks/...",
"version": "1.0.0",
"description": "React hook for ...",
"main": "index.js",
"repository": "https://github.com/rehooks/...",
"author": "...",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"keywords": [
"react",
"hooks",
"..."
],
"files": [
"index.*"
],
"scripts": {
"test": "ava test.js",
"example": "parcel example.html"
},
"peerDependencies": {
"react": "^16.7.0-alpha.0"
},
"devDependencies": {
"ava": "^0.25.0",
"browser-env": "^3.2.5",
"parcel": "^1.10.3",
"raf": "^3.4.0",
"react": "^16.7.0-alpha.0",
"react-dom": "^16.7.0-alpha.0",
"react-test-renderer": "^16.7.0-alpha.0"
},
"ava": {
"require": [
"./test-setup.js"
]
}
}
2 changes: 2 additions & 0 deletions test-setup.js
@@ -0,0 +1,2 @@
require('raf/polyfill');
require('browser-env')();
20 changes: 20 additions & 0 deletions test.js
@@ -0,0 +1,20 @@
'use strict';
let test = require('ava');
let { createElement: h } = require('react');
let ReactTestRenderer = require('react-test-renderer');
let useInputValue = require('./');

function render(val) {
return ReactTestRenderer.create(val);
}

test(t => {
function Component() {
let value = use...();
return h('div');
}

let input = render(h(Component));

t.is(input.toJSON().props.value, '...');
});

0 comments on commit ade49c8

Please sign in to comment.