Skip to content

Commit

Permalink
fix(docz-core): prevent crash when not have cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Aug 13, 2018
1 parent 6a3e718 commit cd3609a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/docz-core/src/DataServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class DataServer {

constructor(server?: any, port?: number, host?: string) {
this.states = new Set()
this.cached = fs.readJsonSync(paths.db)
this.cached = fs.readJsonSync(paths.db, { throws: false })
this.state = {}

if (server) {
Expand Down
2 changes: 1 addition & 1 deletion packages/docz-core/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const build = async (args: Config) => {
try {
dataServer.register([states.entries(config), states.config(config)])

await dataServer.init()
await Entries.writeApp(config)
await dataServer.init()

await run('onPreBuild')
await bundler.build(await bundler.getConfig(env))
Expand Down
2 changes: 1 addition & 1 deletion packages/docz-core/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const dev = async (args: Config) => {
try {
dataServer.register([states.entries(newConfig), states.config(newConfig)])

await Entries.writeApp(newConfig, true)
await dataServer.init()
await dataServer.listen()
await Entries.writeApp(newConfig, true)
} catch (err) {
logger.fatal('Failed to process your server:', err)
process.exit(1)
Expand Down

0 comments on commit cd3609a

Please sign in to comment.