@cmpsr/contentful-core
Advanced tools
Comparing version 0.0.3 to 0.1.0
# @cmpsr/contentful-core | ||
## 0.1.0 | ||
### Minor Changes | ||
- c6a356e: Add ComponentRenderer component and utils to contentful-core package | ||
## 0.0.3 | ||
@@ -4,0 +10,0 @@ |
@@ -1,11 +0,13 @@ | ||
/// <reference types="react" /> | ||
export declare const ContentfulProvider: ({ accessToken, children, componentMap, environment, locale, space, queryMap, }: { | ||
accessToken: any; | ||
children: any; | ||
componentMap?: {}; | ||
import { ReactFragment } from 'react'; | ||
declare type Props = { | ||
accessToken?: string; | ||
children?: ReactFragment; | ||
componentMap?: any; | ||
environment?: string; | ||
locale?: string; | ||
space: any; | ||
queryMap?: {}; | ||
}) => JSX.Element; | ||
space?: string; | ||
queryMap?: any; | ||
}; | ||
export declare const ContentfulProvider: ({ accessToken, children, componentMap, environment, locale, space, queryMap, }: Props) => JSX.Element; | ||
export {}; | ||
//# sourceMappingURL=ContentfulProvider.d.ts.map |
@@ -16,2 +16,3 @@ "use strict"; | ||
// import invariant from 'invariant'; | ||
const ContentfulProvider = ({ | ||
@@ -31,7 +32,6 @@ accessToken, | ||
console.warn('`componentMap` supplied to `ContentfulProvider` is empty.'); | ||
} | ||
} // if (!Object.keys(queryMap).length) { | ||
// console.warn('`queryMap` supplied to `ContentfulProvider` is empty.'); | ||
// } | ||
if (!Object.keys(queryMap).length) { | ||
console.warn('`queryMap` supplied to `ContentfulProvider` is empty.'); | ||
} | ||
}, [accessToken, componentMap, queryMap, space]); | ||
@@ -38,0 +38,0 @@ const value = (0, _react.useMemo)(() => { |
{ | ||
"name": "@cmpsr/contentful-core", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "Base Composer components for standing up a React/NextJS app that can dynamically render components based on Contentful Model types mapped to components and queries.", | ||
@@ -42,3 +42,3 @@ "author": "Ryan Hefner <hi@ryanhefner.com>", | ||
}, | ||
"gitHead": "da04547ac0f791614975d61680e640dde27535ff" | ||
"gitHead": "57d666ba0230660a71e4b5d194025b1428b9703e" | ||
} |
@@ -1,2 +0,2 @@ | ||
# `contentful-core` | ||
# contentful-core | ||
@@ -6,7 +6,21 @@ Base Composer components for standing up a React/NextJS app that can dynamically | ||
## Usage | ||
## Install | ||
### `.env` | ||
Via [npm](https://npmjs.com/package/@cmpsr/contentful-core): | ||
```sh | ||
npm i --save @cmpsr/contentful-core | ||
``` | ||
Via [Yarn](https://yarn.fyi/@cmpsr/contentful-core): | ||
```sh | ||
yarn add @cmpsr/contentful-core | ||
``` | ||
## How to use | ||
### Required `.env` variables | ||
``` | ||
CONTENTFUL_PREVIEW={true|false} | ||
@@ -20,6 +34,16 @@ CONTENTFUL_SPACE_ID={Contentful space ID} | ||
### NextJS | ||
### `ContentfulProvider` | ||
#### Utility Scripts | ||
```js | ||
``` | ||
### `ComponentRenderer` | ||
```js | ||
``` | ||
### Utility Scripts | ||
The utility scripts make it easy to generate GraphQL schemas and the associated Typescript definitions for your Contentful setup. | ||
@@ -32,3 +56,3 @@ | ||
**Generate Schema** | ||
#### Generate Schema | ||
@@ -45,3 +69,3 @@ Within your project directory, run the following command to generate the `fragmentTypes.json` based on your Contentful models. | ||
**Generate Types** | ||
#### Generate Types | ||
@@ -69,4 +93,10 @@ Within your project directory, run the following command to generate the `fragmentTypes.json` based on your Contentful models. | ||
#### Define Apollo Client | ||
## Examples | ||
### NextJS | ||
#### 1. Define Apollo Client | ||
`lib/apollo.js` | ||
```js | ||
@@ -95,3 +125,3 @@ import { withApollo } from 'next-apollo'; | ||
#### Wrap Next App (or Page(s)) | ||
#### 2. Wrap Next App (or Page(s)) | ||
@@ -98,0 +128,0 @@ `pages/_app.js` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35136
50
655
150