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

scriptype / writ-cms / 27870797006

20 Jun 2026 12:11PM UTC coverage: 54.94% (-0.01%) from 54.95%
27870797006

push

github

scriptype
Fix manual edits not updating cms state

As a leftover from experiments in 160e846c4b1c, watcher's onChange was
passing the build promise to the onChange callback. That logic is left
intact for the richer possibilities it provides. However, server now
awaits the promise before setting state, fixing the issue.

648 of 1178 branches covered (55.01%)

Branch coverage included in aggregate %.

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

2238 of 4075 relevant lines covered (54.92%)

1592.27 hits per line

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

0.0
/src/cms/api/models/ssg.js
1
const ssg = require('../../../ssg')
×
2

3
const createSSGModel = (state) => {
×
4
  return {
×
5
    async build({ mode, rootDirectory, refreshTheme, debug, cli }) {
6
      return state.setState(
×
7
        await ssg.build({
8
          mode,
9
          rootDirectory,
10
          refreshTheme,
11
          debug,
12
          cli
13
        })
14
      )
15
    },
16

17
    async watch({ mode, rootDirectory, refreshTheme, debug, cli }) {
18
      if (state.isWatching()) {
×
19
        if (state.isWatching(rootDirectory)) {
×
20
          console.log(`is already watching, not gonna do a thing (watching: ${rootDirectory})`)
×
21
          return false
×
22
        }
23
        console.log(`was watching another. stopping it so now watch: ${rootDirectory}`)
×
24
        await this.stopWatcher()
×
25
      }
26
      const { result, watcher } = await ssg.watch({
×
27
        mode,
28
        rootDirectory,
29
        refreshTheme,
30
        debug,
31
        cli,
32
        async onChange(buildPromise) {
NEW
33
          state.setState(await buildPromise)
×
34
        },
35
        skipRun: state.shouldSkipWatcherBuild
36
      })
37
      state.startWatcher({
×
38
        directory: rootDirectory,
39
        stop: watcher.stop
40
      })
41
      state.setState(result)
×
42
      return true
×
43
    },
44

45
    async stopWatcher() {
46
      if (!state.isWatching()) {
×
47
        return false
×
48
      }
49
      await state.stopWatcher()
×
50
      return true
×
51
    }
52
  }
53
}
54

55
module.exports = createSSGModel
×
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