未验证 提交 98233b91 编写于 作者: S Stefan Judis 提交者: GitHub

[Examples] Improve Contentful example starter and docs (#12351)

上级 5808221f
......@@ -29,60 +29,123 @@ yarn create next-app --example cms-contentful cms-contentful-app
First, [create an account on Contentful](https://www.contentful.com/sign-up/).
After creating an account, create a new **space** from the [dashboard](https://app.contentful.com/) and assign to it any name of your liking.
After creating an account, create a new empty **space** from the [dashboard](https://app.contentful.com/) and assign to it any name of your liking.
### Step 2. Create an `author` content type
### Step 2. Create a content model
The [content model](https://www.contentful.com/developers/docs/concepts/data-model/) defines the data structures of your application/websites. The structures are flexible and you can tailor them to your needs.
For this example you need to create a content model that defines an author and a post content type. **You can create these two by running a script or by doing it manually** to familiarize yourself with the Contentful user interface.
#### Run a script to create the content model
This project includes a setup script which you can use to set up the content model expected by the source code.
In your Contentful dashboard go to **Settings > General Settings** and copy the **Space ID**.
Next, go to **Settings > API > Content management tokens** and create a new token by clicking **Generate personal token**. This token has the same access rights as the logged in user. **Do not share it publicly**, you will only use it to set up your space and can delete it afterwards.
With the space ID and management access token at hand run the following command:
```
npx cross-env CONTENTFUL_SPACE_ID=YOUR_SPACE_ID CONTENTFUL_MANAGEMENT_TOKEN=XXX npm run setup
```
This command will create the needed content structures and set up your Contentful space ready to use. The output should look as follows:
```
> cms-contentful@1.0.0 setup /Users/stefan.judis/Projects/next.js/examples/cms-contentful
> node ./contentful/setup.js $CONTENTFUL_SPACE_ID $CONTENTFUL_MANAGEMENT_TOKEN
┌──────────────────────────────────────────────────┐
│ The following entities are going to be imported: │
├─────────────────────────────────┬────────────────┤
│ Content Types │ 2 │
├─────────────────────────────────┼────────────────┤
│ Editor Interfaces │ 2 │
├─────────────────────────────────┼────────────────┤
│ Locales │ 1 │
├─────────────────────────────────┼────────────────┤
│ Webhooks │ 0 │
├─────────────────────────────────┼────────────────┤
│ Entries │ 0 │
├─────────────────────────────────┼────────────────┤
│ Assets │ 0 │
└─────────────────────────────────┴────────────────┘
✔ Validating content-file
✔ Initialize client (1s)
✔ Checking if destination space already has any content and retrieving it (2s)
✔ Apply transformations to source data (1s)
✔ Push content to destination space
✔ Connecting to space (1s)
...
...
...
```
#### Create the content model manually
##### Create an `Author` content type
From your contentful space, go to **Content model** and add a new content type:
- **Api Identifier** should be `author`
- Give it the **Name** `Author`, the **Api Identifier** should be `author`
Once the content model is saved, let's add these fields (you don't have to modify the settings unless specified):
Once the content model is saved, add these fields (you don't have to modify the settings unless specified):
- `name` - **Text** field. **Field ID** should be set to `name`
- `picture` - **Media** field. **Field ID** should be set to `picture`
- `name` - **Text** field (type **short text**). **Field ID** should be set to `name`
- `picture` - **Media** field (type **one file**). **Field ID** should be set to `picture`
Save the content type and continue.
### Step 3. Create a `post` type
##### Create a `post` type
From your contentful space, go to **Content model** and add a new content type:
From your contentful space, go to **Content model** and add another content type:
- **Api Identifier** should be `post`
- Give it the **Name** `Post`, the **Api Identifier** should be `post`
Next, add these fields (you don't have to modify the settings unless specified):
- `title` - **Text** field
- `title` - **Text** field (type **short text**)
- `content` - **Rich text** field
- `excerpt` - **Text** field. Enable **Long text, full-text search**
- `coverImage` - **Media** field
- `excerpt` - **Text** field (type **Long text, full-text search**)
- `coverImage` - **Media** field (type **one file**)
- `date` - **Date and time** field
- `slug` - **Text** field. You can optionally go to the settings of this field, and under **Appearance**, select **Slug** to display it as a slug of the `title` field.
- `author` - **Reference** field
- `author` - **Reference** field (type **one reference**)
Save the content type and continue.
### Step 3. Validate your content model
After setting up the content model (either manually or by running `npm run setup` or `yarn setup`), it should look as follows.
**Content model overview**
![Content model overview](./docs/content-model-overview.jpg)
### Step 4. Populate Content
Go to the **Content** page in your space, then click on **Add entry** and select the **author** content type:
Go to the **Content** section in your space, then click on **Add entry** and select the **Author** content type:
- You just need **1 author entry**.
- Use dummy data for the text.
- For the image, you can download one from [Unsplash](https://unsplash.com/).
Next, add a new entry to **post**:
Next, create another entry with the content type **Post**:
- We recommend creating at least **2 post entries**.
- Use dummy data for the text.
- You can write markdown for the **content** field.
- For images, you can download them from [Unsplash](https://unsplash.com/).
- Pick the **author** you created earlier.
**Important:** For each entry, you need to click on **Publish**. If not, the entry will be in draft state.
**Important:** For each entry and asset, you need to click on **Publish**. If not, the entry will be in draft state.
![Published content entry](./docs/content-entry-publish.jpg)
### Step 5. Set up environment variables
From your contentful space, go to **Settings > API keys**. There should be an example Content delivery / preview token - you can use this API key. (You may also create a new key.)
From your contentful space, go to **Settings > API keys**. There will be an example Content delivery / preview token - you can use these API keys. (You may also create a new key.)
Next, copy the `.env.example` file in this directory to `.env` (which will be ignored by Git):
......@@ -93,8 +156,8 @@ cp .env.example .env
Then set each variable on `.env`:
- `NEXT_EXAMPLE_CMS_CONTENTFUL_SPACE_ID` should be the **Space ID** field of your API Key
- `NEXT_EXAMPLE_CMS_CONTENTFUL_ACCESS_TOKEN` should be the **Content Delivery API - access token** field of your API key
- `NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_ACCESS_TOKEN` should be the **Content Preview API - access token** field of your API key
- `NEXT_EXAMPLE_CMS_CONTENTFUL_ACCESS_TOKEN` should be the **[Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) - access token** field of your API key
- `NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_ACCESS_TOKEN` should be the **[Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/) - access token** field of your API key
- `NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_SECRET` should be any value you want. It must be URL friendly as the dashboard will send it as a query parameter to enable preview mode
Your `.env` file should look like this:
......@@ -122,9 +185,9 @@ Your blog should be up and running on [http://localhost:3000](http://localhost:3
### Step 7. Try preview mode
On your contentful space, go to **Settings > Content preview**, then add a new content preview for development.
In your Contentful space, go to **Settings > Content preview** and add a new content preview for development.
The **Name** field may be anything, like `Development`. Then, under **Content preview URLs**, check **post** and set its value to:
The **Name** field may be anything, like `Development`. Then, under **Content preview URLs**, check **Post** and set its value to:
```
http://localhost:3000/api/preview?secret=<NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_SECRET>&slug={entry.fields.slug}
......@@ -132,13 +195,17 @@ http://localhost:3000/api/preview?secret=<NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_SE
Replace `<NEXT_EXAMPLE_CMS_CONTENTFUL_PREVIEW_SECRET>` with its respective value in `.env`.
![Content preview setup](./docs/content-preview-setup.jpg)
Once saved, go to one of the posts you've created and:
- **Update the title**. For example, you can add `[Draft]` in front of the title.
- The state of the post will switch to **CHANGED** automatically. **Do not** publish it. By doing this, the post will be in draft state.
- In the sidebar, you should see the **Open preview** button. Click on it!
- In the sidebar, you will see the **Open preview** button. Click on it!
![Content entry overview](./docs/content-entry-preview.jpg)
You should now be able to see the updated title. To exit preview mode, you can click on **Click here to exit preview mode** at the top of the page.
You will now be able to see the updated title. To exit preview mode, you can click on **Click here to exit preview mode** at the top of the page.
### Step 8. Deploy on Vercel
......
{
"contentTypes": [
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"id": "author",
"type": "ContentType",
"createdAt": "2020-04-22T09:32:50.535Z",
"updatedAt": "2020-04-22T09:32:50.885Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"publishedVersion": 1,
"publishedAt": "2020-04-22T09:32:50.885Z",
"firstPublishedAt": "2020-04-22T09:32:50.885Z",
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"publishedCounter": 1,
"version": 2,
"publishedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
}
},
"displayField": "name",
"name": "Author",
"description": "",
"fields": [
{
"id": "name",
"name": "Name",
"type": "Symbol",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "picture",
"name": "Picture",
"type": "Link",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false,
"linkType": "Asset"
}
]
},
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"id": "post",
"type": "ContentType",
"createdAt": "2020-04-22T09:34:36.878Z",
"updatedAt": "2020-04-22T12:23:57.726Z",
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
},
"publishedVersion": 3,
"publishedAt": "2020-04-22T12:23:57.726Z",
"firstPublishedAt": "2020-04-22T09:34:37.228Z",
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"publishedCounter": 2,
"version": 4,
"publishedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
}
},
"displayField": "title",
"name": "Post",
"description": "",
"fields": [
{
"id": "title",
"name": "Title",
"type": "Symbol",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "slug",
"name": "Slug",
"type": "Symbol",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "content",
"name": "Content",
"type": "RichText",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "excerpt",
"name": "Excerpt",
"type": "Symbol",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "coverImage",
"name": "Cover Image",
"type": "Link",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false,
"linkType": "Asset"
},
{
"id": "date",
"name": "Date",
"type": "Date",
"localized": false,
"required": false,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "author",
"name": "Author",
"type": "Link",
"localized": false,
"required": false,
"validations": [
{
"linkContentType": ["author"]
}
],
"disabled": false,
"omitted": false,
"linkType": "Entry"
}
]
}
],
"editorInterfaces": [
{
"sys": {
"id": "default",
"type": "EditorInterface",
"space": {
"sys": {
"id": "p5asbbjx1p90",
"type": "Link",
"linkType": "Space"
}
},
"version": 2,
"createdAt": "2020-04-22T09:32:50.954Z",
"createdBy": {
"sys": {
"id": "066RqBikAjzKy0SWUEtFvH",
"type": "Link",
"linkType": "User"
}
},
"updatedAt": "2020-04-22T09:32:51.642Z",
"updatedBy": {
"sys": {
"id": "066RqBikAjzKy0SWUEtFvH",
"type": "Link",
"linkType": "User"
}
},
"contentType": {
"sys": {
"id": "author",
"type": "Link",
"linkType": "ContentType"
}
},
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
}
},
"controls": [
{
"fieldId": "name",
"widgetId": "singleLine",
"widgetNamespace": "builtin"
},
{
"fieldId": "picture",
"widgetId": "assetLinkEditor",
"widgetNamespace": "builtin"
}
]
},
{
"sys": {
"id": "default",
"type": "EditorInterface",
"space": {
"sys": {
"id": "p5asbbjx1p90",
"type": "Link",
"linkType": "Space"
}
},
"version": 4,
"createdAt": "2020-04-22T09:34:37.309Z",
"createdBy": {
"sys": {
"id": "066RqBikAjzKy0SWUEtFvH",
"type": "Link",
"linkType": "User"
}
},
"updatedAt": "2020-04-22T12:23:58.324Z",
"updatedBy": {
"sys": {
"id": "066RqBikAjzKy0SWUEtFvH",
"type": "Link",
"linkType": "User"
}
},
"contentType": {
"sys": {
"id": "post",
"type": "Link",
"linkType": "ContentType"
}
},
"environment": {
"sys": {
"id": "master",
"type": "Link",
"linkType": "Environment"
}
}
},
"controls": [
{
"fieldId": "title",
"widgetId": "singleLine",
"widgetNamespace": "builtin"
},
{
"fieldId": "slug",
"widgetId": "slugEditor",
"widgetNamespace": "builtin"
},
{
"fieldId": "content",
"widgetId": "richTextEditor",
"widgetNamespace": "builtin"
},
{
"fieldId": "excerpt",
"widgetId": "singleLine",
"widgetNamespace": "builtin"
},
{
"fieldId": "coverImage",
"widgetId": "assetLinkEditor",
"widgetNamespace": "builtin"
},
{
"fieldId": "date",
"widgetId": "datePicker",
"widgetNamespace": "builtin"
},
{
"fieldId": "author",
"widgetId": "entryLinkEditor",
"widgetNamespace": "builtin"
}
]
}
],
"locales": [
{
"name": "English (United States)",
"code": "en-US",
"fallbackCode": null,
"default": true,
"contentManagementApi": true,
"contentDeliveryApi": true,
"optional": false,
"sys": {
"type": "Locale",
"id": "09Kvvkay28CRdOt7j8Ze7V",
"version": 1,
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"environment": {
"sys": {
"type": "Link",
"linkType": "Environment",
"id": "master"
}
},
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"createdAt": "2020-04-22T09:10:22Z",
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedAt": "2020-04-22T09:10:22Z"
}
}
],
"webhooks": [],
"roles": [
{
"name": "Author",
"description": "Allows editing of content",
"policies": [
{
"effect": "allow",
"actions": ["create"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": ["create"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
},
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
}
],
"permissions": {
"ContentModel": ["read"],
"Settings": [],
"ContentDelivery": [],
"Environments": [],
"EnvironmentAliases": []
},
"sys": {
"type": "Role",
"id": "09Ly1xcRRW9vpcvEXo7Q9R",
"version": 0,
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"createdAt": "2020-04-22T09:10:22Z",
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedAt": "2020-04-22T09:10:22Z"
}
},
{
"name": "Editor",
"description": "Allows editing, publishing and archiving of content",
"policies": [
{
"effect": "allow",
"actions": "all",
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": "all",
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
}
],
"permissions": {
"ContentModel": ["read"],
"Settings": [],
"ContentDelivery": [],
"Environments": [],
"EnvironmentAliases": []
},
"sys": {
"type": "Role",
"id": "09M0BGG76Wp2UNMBgSxKGv",
"version": 0,
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"createdAt": "2020-04-22T09:10:22Z",
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedAt": "2020-04-22T09:10:22Z"
}
},
{
"name": "Freelancer",
"description": "Allows only editing of content they created themselves",
"policies": [
{
"effect": "allow",
"actions": ["create"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": ["create"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
},
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
},
{
"paths": [
{
"doc": "fields.%.%"
}
]
}
]
}
},
{
"effect": "allow",
"actions": ["delete"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
}
]
}
},
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
},
{
"paths": [
{
"doc": "fields.%.%"
}
]
}
]
}
},
{
"effect": "allow",
"actions": ["delete"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
},
{
"equals": [
{
"doc": "sys.createdBy.sys.id"
},
"User.current()"
]
}
]
}
}
],
"permissions": {
"ContentModel": ["read"],
"Settings": [],
"ContentDelivery": [],
"Environments": [],
"EnvironmentAliases": []
},
"sys": {
"type": "Role",
"id": "09MrKDfvFxjsr5PMEJjLBN",
"version": 0,
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"createdAt": "2020-04-22T09:10:22Z",
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedAt": "2020-04-22T09:10:22Z"
}
},
{
"name": "Translator",
"description": "Allows editing of localized fields in the specified language",
"policies": [
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
}
]
}
},
{
"effect": "allow",
"actions": ["read"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Entry"
]
},
{
"paths": [
{
"doc": "fields.%.%"
}
]
}
]
}
},
{
"effect": "allow",
"actions": ["update"],
"constraint": {
"and": [
{
"equals": [
{
"doc": "sys.type"
},
"Asset"
]
},
{
"paths": [
{
"doc": "fields.%.%"
}
]
}
]
}
}
],
"permissions": {
"ContentModel": ["read"],
"Settings": [],
"ContentDelivery": [],
"Environments": [],
"EnvironmentAliases": []
},
"sys": {
"type": "Role",
"id": "09MWbiu0nlnFuYVtcAU3wf",
"version": 0,
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "p5asbbjx1p90"
}
},
"createdBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"createdAt": "2020-04-22T09:10:22Z",
"updatedBy": {
"sys": {
"type": "Link",
"linkType": "User",
"id": "066RqBikAjzKy0SWUEtFvH"
}
},
"updatedAt": "2020-04-22T09:10:22Z"
}
}
]
}
const spaceImport = require('contentful-import')
const exportFile = require('./export.json')
const [CONTENTFUL_SPACE_ID, CONTENTFUL_MANAGEMENT_TOKEN] = process.argv.slice(2)
if (!CONTENTFUL_SPACE_ID || !CONTENTFUL_MANAGEMENT_TOKEN) {
throw new Error(
[
'Parameters missing...',
'Please run the setup command as follows',
'CONTENTFUL_SPACE_ID=XXX CONTENTFUL_MANAGEMENT_TOKEN=CFPAT-XXX npm run setup',
].join('\n')
)
}
spaceImport({
spaceId: CONTENTFUL_SPACE_ID,
managementToken: CONTENTFUL_MANAGEMENT_TOKEN,
content: exportFile,
})
.then(() => console.log('The content model of your space is set up!'))
.catch(e => console.error(e))
......@@ -4,7 +4,8 @@
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
"start": "next start",
"setup": "node ./contentful/setup.js $CONTENTFUL_SPACE_ID $CONTENTFUL_MANAGEMENT_TOKEN"
},
"dependencies": {
"@contentful/rich-text-react-renderer": "13.4.0",
......@@ -17,6 +18,7 @@
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^2.1.0",
"contentful-import": "^7.7.12",
"dotenv": "8.2.0",
"postcss-preset-env": "^6.7.0",
"tailwindcss": "^1.2.0"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册