MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / createMockData

Function createMockData

packages/contentful-generator/src/index.ts:21–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19const lorem = new LoremIpsum()
20
21const createMockData = async () => {
22 const environment = await getEnvironment()
23
24 const numberOfEntriesToCreate = 13000
25 for (let i = 0; i < numberOfEntriesToCreate; i++) {
26 await environment.createEntry('post', {
27 fields: {
28 title: localized(lorem.generateWords(4)),
29 // introduction: localized(richText({ numSentences: 1 })),
30 introduction: localized(lorem.generateSentences(1)),
31 // body: localized(richText({ numSentences: 80 })),
32 body: localized(lorem.generateSentences(80)),
33 },
34 })
35 console.log(`Created ${i} / ${numberOfEntriesToCreate} entries.`)
36 }
37}
38
39const resetEnvironment = async () => {
40 const environment = await getEnvironment()

Callers 1

mainFunction · 0.85

Calls 2

localizedFunction · 0.85
getEnvironmentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…