Unverified Commit 98233b91 authored by Stefan Judis's avatar Stefan Judis Committed by GitHub

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

parent 5808221f
This diff is collapsed.
This diff is collapsed.
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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment