Skip to content

Commit

Permalink
trying to get types working.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harley Alexander committed Aug 16, 2019
1 parent 4641ff1 commit 45a0d2b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Install

```bash
yarn add react-pusher-hooks
yarn add use-pusher
```

## Usage
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"types": "./dist/index.d.ts",
"engines": {
"node": ">=8",
"npm": ">=5"
Expand All @@ -16,10 +17,7 @@
"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"
"start": "rollup -c -w"
},
"dependencies": {
"dequal": "^1.0.0",
Expand All @@ -36,8 +34,6 @@
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.3.1",
"@testing-library/react": "^9.1.2",
"pusher-js": "^5.0.0",
"react-dom": "^16.8.6",
"@testing-library/react-hooks": "^2.0.1",
"@types/invariant": "^2.2.30",
"@types/jest": "^23.3.13",
Expand All @@ -46,13 +42,16 @@
"cross-env": "^5.2.0",
"gh-pages": "^2.0.1",
"jest-fetch-mock": "^2.1.2",
"pusher-js": "^5.0.0",
"pusher-js-mock": "^0.2.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "^3.0.1",
"react-test-renderer": "^16.9.0",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-dts": "^1.1.6",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-typescript2": "^0.19.2",
Expand Down
7 changes: 4 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dts from "rollup-plugin-dts";
import typescript from "rollup-plugin-typescript2";
import commonjs from "rollup-plugin-commonjs";
import external from "rollup-plugin-peer-deps-external";
Expand All @@ -8,7 +9,7 @@ import babel from "rollup-plugin-babel";
import pkg from "./package.json";

export default {
input: "src/index.tsx",
input: "src/index.ts",
output: [
{
file: pkg.main,
Expand All @@ -31,12 +32,12 @@ export default {
rollupCommonJSResolveHack: true,
clean: true
}),

babel({
extensions: [".tsx"],
exclude: "node_modules/**",
presets: ["@babel/env", "@babel/preset-react"]
}),
commonjs()
commonjs(),
dts()
]
};
2 changes: 1 addition & 1 deletion src/PusherProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const __PusherConsumer = __PusherContext.Consumer;

/**
* Provider for the pusher service in an app
* @param props
* @param props Config for Pusher client
*/
export function PusherProvider({
clientKey,
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx → src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { PusherProvider } from "./PusherProvider";
export { useChannel } from "./useChannel";
export { useTrigger } from "./useTrigger";
export { usePusher } from "./usePusher";
6 changes: 1 addition & 5 deletions src/useChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ import { useChannelOptions } from "./types";
* Subscribe to channel events
*
* @example
* useChannel(
* "my-channel",
* "my-event",
* (message) => console.log(message)
* )
*
*/

export function useChannel(
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"resolveJsonModule": true,
"isolatedModules": true,
"isolatedModules": false,
"declaration": true,
"noEmit": true
},
"include": ["src"],
Expand Down
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,13 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^12.0.9"

"@michaelfoidl/barrel-dts@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@michaelfoidl/barrel-dts/-/barrel-dts-1.0.2.tgz#3a64e7527e9f3117bfd5ce99b0768e9b0a03ee81"
integrity sha512-dJB59S4Q0i8/zAr2xRwcDrF0c0fb3HCyGySr09wZPKXYFDz3JSa7aYsF74R+hCSzIp+Bm4SHQDIW8tRkssZ9yA==
dependencies:
commander "~2.20.0"

"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
Expand Down Expand Up @@ -8834,6 +8841,13 @@ rollup-plugin-commonjs@^9.2.0:
resolve "^1.10.0"
rollup-pluginutils "^2.6.0"

rollup-plugin-dts@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-1.1.6.tgz#dc081b62491aba5a200c566dd7d61b4cdc65f72b"
integrity sha512-CqrI0viXojw3ufqFyfJjoyM/zibcvBTr6Ky3BGK9jfuT79hn32PifLwusulC0z3TG0QW6tPfDCb3JI5EOaSjRg==
optionalDependencies:
"@babel/code-frame" "^7.5.5"

rollup-plugin-node-resolve@^4.0.0:
version "4.2.4"
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.4.tgz#7d370f8d6fd3031006a0032c38262dd9be3c6250"
Expand Down

0 comments on commit 45a0d2b

Please sign in to comment.