-
Notifications
You must be signed in to change notification settings - Fork 91
Lerna #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Lerna #78
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
aed19f5
lerna init & move graphql-hooks to packages
jackdclark 0abf896
update root scripts
jackdclark 6eff413
update circleci
jackdclark 1a5f696
first
bmullan91 840f02e
update quickstart guide
bmullan91 83fab50
v1.0.1
bmullan91 a7a3c1b
Add renovate.json (#2)
renovate[bot] 8b2a9ab
Pin dependencies (#3)
renovate[bot] b27f14e
Update react monorepo to v16.8.3 (#4)
renovate[bot] d9ec381
first
bmullan91 2fd2a36
use prettier
bmullan91 1811112
v1.0.1
bmullan91 719108a
reademe -> readme... doh
bmullan91 d35c85b
v1.0.2
bmullan91 1c0ecbb
use fnv1a algo for object hashing
bmullan91 e12e0fc
v1.0.3
bmullan91 0ed80c9
update package.json repo, bugs and homepage links
bmullan91 2ccf40b
v1.0.4
bmullan91 bc33c5b
Add renovate.json (#2)
renovate[bot] fd4843c
Pin dependencies (#3)
renovate[bot] 3fd8fa8
exit 0 for new packages
jackdclark b170b87
Create jest config for packages
Joezo 61889ed
move coveralls reporting to root
jackdclark 382a830
run root coveralls in ci
jackdclark 8385170
Remove duplicate files from packages
Joezo 3dedb53
update README
jackdclark 59fc827
Merge branch 'master' into lerna
jackdclark 405140e
update eslint & prettier paths
jackdclark f37f848
add npm release & update CONTRIBUTING.md
jackdclark 56133e8
Merge branch 'master' into lerna
jackdclark 8be86cc
relative packages in README
jackdclark 58666aa
Merge branch 'master' into lerna
jackdclark 280553f
tidy package.json for packages
jackdclark b4418c4
update issue templates
jackdclark eea43c9
prettier babel config
jackdclark 56d5b1d
remove test test
jackdclark 8ff00cb
Update lint-staged config
Joezo e287b2e
Merge branch 'master' into lerna
Joezo 6b76c92
Update eslint command
Joezo dc3f1f5
Add note to CONTRIBUTING about lerna
Joezo bfe3fb3
remove jest from package dir
jackdclark e047a50
update graphql-hooks-memcache to latest
jackdclark c2d9f9f
Update eslint/prettier paths
Joezo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,7 +1,7 @@ | ||
| node_modules | ||
| graphql-hooks-*.*.*.tgz | ||
| package-lock.json | ||
| /coverage | ||
| coverage | ||
| .DS_Store | ||
| lib | ||
| dist | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,3 +1,4 @@ | ||
| // this is used by jest only | ||
| module.exports = { | ||
| presets: [ | ||
| [ | ||
|
|
||
This file contains hidden or 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,25 @@ | ||
| const projects = [ | ||
| { | ||
| displayName: 'graphql-hooks', | ||
| roots: ['./packages/graphql-hooks'], | ||
| testMatch: ['<rootDir>/packages/graphql-hooks/**/*.test.js'], | ||
| setupFiles: ['<rootDir>/packages/graphql-hooks/test/setup.js'], | ||
| setupFilesAfterEnv: [ | ||
| '<rootDir>/packages/graphql-hooks/test/setupAfterEnv.js' | ||
| ], | ||
| automock: false | ||
| }, | ||
| { | ||
| roots: ['./packages/graphql-hooks-memcache'], | ||
| displayName: 'graphql-hooks-memcache', | ||
| testMatch: ['<rootDir>/packages/graphql-hooks-memcache/**/*.test.js'] | ||
| }, | ||
| { | ||
| roots: ['./packages/graphql-hooks-ssr'], | ||
| displayName: 'graphql-hooks-ssr', | ||
| testMatch: ['<rootDir>/packages/graphql-hooks-ssr/**/*.test.js'] | ||
| } | ||
| ]; | ||
| module.exports = { | ||
| projects | ||
| }; |
This file contains hidden or 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 @@ | ||
| { | ||
| "packages": ["packages/*"], | ||
| "version": "independent" | ||
| } |
This file contains hidden or 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,91 +1,52 @@ | ||
| { | ||
| "name": "graphql-hooks", | ||
| "version": "3.2.2", | ||
| "description": "Graphql Hooks", | ||
| "main": "lib/graphql-hooks.js", | ||
| "module": "es/graphql-hooks.js", | ||
| "unpkg": "dist/graphql-hooks.min.js", | ||
| "name": "root", | ||
| "private": true, | ||
| "scripts": { | ||
| "test": "jest", | ||
| "test:watch": "jest --watch", | ||
| "test:coverage": "jest --coverage", | ||
| "eslint": "eslint src test", | ||
| "prettier": "prettier src/**/*.js test/**/*.js --write", | ||
| "build": "rollup -c", | ||
| "prepublishOnly": "npm run build" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "es", | ||
| "lib" | ||
| ], | ||
| "keywords": [ | ||
| "graphql", | ||
| "hooks", | ||
| "graphql-hooks", | ||
| "gql", | ||
| "gql-hooks", | ||
| "react-graphql-hooks", | ||
| "react", | ||
| "apollo" | ||
| ], | ||
| "author": "Brian Mullan <[email protected]>", | ||
| "license": "Apache-2.0", | ||
| "peerDependencies": { | ||
| "react": "^16.8.3" | ||
| "postinstall": "lerna bootstrap --no-ci", | ||
| "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
| "eslint": "eslint *.js packages/*/*.js packages/*/{src,test}/**/*.js", | ||
| "prettier": "prettier *.js *.md packages/*/*.{js,md} packages/*/{src,test}/**/*.{js,md} --write", | ||
| "release": "lerna publish" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/preset-env": "7.3.4", | ||
| "@babel/preset-react": "7.0.0", | ||
| "babel-eslint": "10.0.1", | ||
| "babel-jest": "24.1.0", | ||
| "eslint": "5.15.0", | ||
| "coveralls": "3.0.3", | ||
| "eslint-config-prettier": "4.1.0", | ||
| "eslint-plugin-prettier": "3.0.1", | ||
| "eslint-plugin-react": "7.12.4", | ||
| "eslint-plugin-react-hooks": "1.4.0", | ||
| "eslint-plugin-react": "7.12.4", | ||
| "eslint": "5.15.0", | ||
| "husky": "1.3.1", | ||
| "jest": "24.1.0", | ||
| "jest-fetch-mock": "2.1.1", | ||
| "lerna": "3.13.1", | ||
| "lint-staged": "8.1.5", | ||
| "prettier": "1.16.4", | ||
| "react": "16.8.3", | ||
| "react-dom": "16.8.3", | ||
| "react-hooks-testing-library": "0.3.6", | ||
| "react-testing-library": "6.0.0", | ||
| "rollup": "1.4.1", | ||
| "rollup-plugin-babel": "4.3.2", | ||
| "rollup-plugin-node-resolve": "4.0.1", | ||
| "rollup-plugin-size-snapshot": "0.8.0", | ||
| "rollup-plugin-terser": "4.0.4" | ||
| "prettier": "1.16.4" | ||
| }, | ||
| "lint-staged": { | ||
| "./src/**/*.js": [ | ||
| "eslint src test", | ||
| "prettier src/**/*.js test/**/*.js --write", | ||
| "./packages/*/{src,test}/**/*.js": [ | ||
| "eslint", | ||
| "prettier --write", | ||
| "git add" | ||
| ], | ||
| "./packages/*/*.js": [ | ||
| "eslint", | ||
| "prettier --write", | ||
| "git add" | ||
| ], | ||
| "*.js": [ | ||
| "eslint", | ||
| "prettier --write", | ||
| "git add" | ||
| ] | ||
| }, | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "lint-staged" | ||
| } | ||
| }, | ||
| "jest": { | ||
| "automock": false, | ||
| "setupFiles": [ | ||
| "./test/setup.js" | ||
| ], | ||
| "setupFilesAfterEnv": [ | ||
| "react-testing-library/cleanup-after-each" | ||
| ] | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git://github.com/nearform/graphql-hooks.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/nearform/graphql-hooks" | ||
| }, | ||
| "homepage": "https://github.com/nearform/graphql-hooks#readme" | ||
| } | ||
| } | ||
This file contains hidden or 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,42 @@ | ||
| # graphql-hooks-memcache | ||
|
|
||
| In-memory caching implementation for graphql-hooks | ||
|
|
||
| ## Install | ||
|
|
||
| `npm install graphql-hooks-memcache` | ||
|
|
||
| or | ||
|
|
||
| `yarn add graphql-hooks-memcache` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| This is intended to be used as the `cache` option when calling `createClient` from `graphql-hooks`. | ||
|
|
||
| ```js | ||
| import { GraphQLClient } from 'graphql-hooks'; | ||
| import memCache from 'graphql-hooks-memcache'; | ||
|
|
||
| const client = new GraphQLClient({ | ||
| endpoint: '/graphql', | ||
| cache: memCache() | ||
| }); | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| `memCache(options)`: Option object properties | ||
|
|
||
| - `size`: The number of items to store in the cache | ||
| - `ttl`: Milliseconds an item will remain in cache. Default behaviour will only evict items when `size` limit has been reached | ||
| - `initialState`: The value from `cache.getInitialState()` used for rehydrating the cache after SSR | ||
|
|
||
| ### API | ||
|
|
||
| - `cache.get(key)`: Find item in cache that matches `key` | ||
| - `cache.set(key, value)`: Set an item in the cache | ||
| - `cache.delete(key)`: Delete an item from the cache | ||
| - `cache.clear()`: Clear all items from the cache | ||
| - `cache.keys()`: Returns an array of keys, useful when you need to iterate over the cache items | ||
| - `cache.getInitialState()`: A serialisable version of the cache - used during SSR |
This file contains hidden or 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,32 @@ | ||
| const LRU = require('tiny-lru'); | ||
| const fnv1a = require('@sindresorhus/fnv1a'); | ||
|
|
||
| function generateKey(keyObj) { | ||
| return fnv1a(JSON.stringify(keyObj)).toString(36); | ||
| } | ||
|
|
||
| module.exports = function memCache({ size = 100, ttl = 0, initialState } = {}) { | ||
| const lru = LRU(size, ttl); | ||
|
|
||
| if (initialState) { | ||
| Object.keys(initialState).map(k => { | ||
| lru.set(k, initialState[k]); | ||
| }); | ||
| } | ||
|
|
||
| return { | ||
| get: keyObj => lru.get(generateKey(keyObj)), | ||
| set: (keyObj, data) => lru.set(generateKey(keyObj), data), | ||
| delete: keyObj => lru.delete(generateKey(keyObj)), | ||
| clear: () => lru.clear(), | ||
| keys: () => lru.keys(), | ||
| getInitialState: () => | ||
| lru.keys().reduce( | ||
| (initialState, key) => ({ | ||
| ...initialState, | ||
| [key]: lru.get(key) | ||
| }), | ||
| {} | ||
| ) | ||
| }; | ||
| }; |
This file contains hidden or 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,32 @@ | ||
| { | ||
| "name": "graphql-hooks-memcache", | ||
| "version": "1.0.5", | ||
| "description": "In memory cache for graphql-hooks", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "keywords": [ | ||
| "graphql", | ||
| "hooks", | ||
| "react", | ||
| "graphql-hooks", | ||
| "cache", | ||
| "ssr", | ||
| "server-side rendering" | ||
| ], | ||
| "author": "Brian Mullan <[email protected]>", | ||
| "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@sindresorhus/fnv1a": "^1.0.0", | ||
| "tiny-lru": "^6.0.1" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git://github.com/nearform/graphql-hooks.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/nearform/graphql-hooks/issues" | ||
| }, | ||
| "homepage": "https://github.com/nearform/graphql-hooks/blob/master/packages/graphql-hooks-memcache#readme" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.