• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

scriptype / writ-cms / 21308122939

24 Jan 2026 03:05AM UTC coverage: 38.719%. Remained the same
21308122939

push

github

scriptype
Switch to js-yaml for easy flow formatting

attributes:
 foo: bar
 articles: [+Article:author]

is much better than:

attributes:
 foo: bar
 articles:
 - +Article:author

Fix was thanks to the flowLevel option in js-yaml

621 of 3672 branches covered (16.91%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

2171 of 3539 relevant lines covered (61.35%)

1769.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/cms/api/models/contentTypes.js
1
const { join } = require('path')
×
2
const { mkdir, writeFile } = require('fs/promises')
×
NEW
3
const { dump } = require('js-yaml')
×
4

5
const createContentTypesModel = ({ getSettings, getContentTypes }) => {
×
6
  const createContentType = async ({ name, description = '', attributes, ...config }) => {
×
7
    const { rootDirectory } = getSettings()
×
8
    const schemaDirectory = join(rootDirectory, 'schema')
×
9
    const filePath = join(schemaDirectory, `${name}.md`)
×
NEW
10
    const frontMatter = dump({
×
11
      name,
12
      attributes,
13
      ...config
14
    }, {
15
      flowLevel: 2
16
    })
17
    const fileContent = ['---', frontMatter.replace(/\s+$/, ''), '---', description].join('\n')
×
18
    await mkdir(schemaDirectory, { recursive: true })
×
19
    await writeFile(filePath, fileContent)
×
20
    return { ok: true }
×
21
  }
22

23
  return {
×
24
    get: getContentTypes,
25
    create: createContentType
26
  }
27
}
28

29
module.exports = createContentTypesModel
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc