Skip to content

Commit 9155120

Browse files
committed
1 parent b7ec9ae commit 9155120

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [0.8.17][2016-07-25]
4+
5+
* Fix snapshot creation for JS files (ex: `json-server generator.js`)
6+
37
## [0.8.16][2016-07-11]
48

59
* Support `x-www-form-urlencoded`

src/cli/run.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,9 @@ module.exports = function (argv) {
134134
if (chunk.trim().toLowerCase() === 's') {
135135
var filename = 'db-' + Date.now() + '.json'
136136
var file = path.join(argv.snapshots, filename)
137-
app
138-
.db
139-
.write(file)
140-
.then(function () {
141-
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
142-
})
137+
var state = app.db.getState()
138+
fs.writeFileSync(file, JSON.stringify(state, null, 2), 'utf-8')
139+
console.log(' Saved snapshot to ' + path.relative(process.cwd(), file) + '\n')
143140
}
144141
})
145142

0 commit comments

Comments
 (0)