Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,18 @@ | ||
const Cosmic = require('cosmicjs') | ||
const api = Cosmic() | ||
const COSMIC_BUCKET = process.env.COSMIC_BUCKET || 'node-starter' | ||
const bucket = api.bucket({ | ||
slug: COSMIC_BUCKET | ||
}) | ||
const default_objects = require('./objects') | ||
const default_object_type = require('./object-type') | ||
const importObjects = async () => { | ||
const res = await bucket.getObjects() | ||
if(res.status === 'empty') { | ||
bucket.addObjectType(default_object_type) | ||
default_objects.forEach(object => { | ||
bucket.addObject(object) | ||
}) | ||
} | ||
} | ||
importObjects() |
This file contains 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,5 @@ | ||
{ | ||
"title": "Pages", | ||
"slug": "pages", | ||
"singular": "page" | ||
} |
This file contains 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,20 @@ | ||
[ | ||
{ | ||
"title": "Home", | ||
"slug": "home", | ||
"content": "This is the home page content.", | ||
"type_slug": "pages" | ||
}, | ||
{ | ||
"title": "About", | ||
"slug": "about", | ||
"content": "This is the about page content.", | ||
"type_slug": "pages" | ||
}, | ||
{ | ||
"title": "Contact", | ||
"slug": "contact", | ||
"content": "This is the contact page content.", | ||
"type_slug": "pages" | ||
} | ||
] |