Skip to content

Commit

Permalink
Merge pull request #449 from kadirahq/fix-db-404
Browse files Browse the repository at this point in the history
Create empty db file for static build
  • Loading branch information
Muhammed Thanish committed Sep 14, 2016
2 parents a2f1dbe + 8b973a3 commit 45d207f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/server/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ if (_commander2.default.staticDir) {
// It should be enabled with the --enable-db for dev server
if (_commander2.default.enableDb) {
var dbPath = _commander2.default.dbPath || _path2.default.resolve(configDir, 'addon-db.json');
// create addon-db.json file if it's missing to avoid the 404 error
if (!_fs2.default.existsSync(dbPath)) {
_fs2.default.writeFileSync(dbPath, '{}');
}
_shelljs2.default.cp(dbPath, outputDir);
}

Expand Down
4 changes: 4 additions & 0 deletions src/server/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ if (program.staticDir) {
// It should be enabled with the --enable-db for dev server
if (program.enableDb) {
const dbPath = program.dbPath || path.resolve(configDir, 'addon-db.json');
// create addon-db.json file if it's missing to avoid the 404 error
if (!fs.existsSync(dbPath)) {
fs.writeFileSync(dbPath, '{}');
}
shelljs.cp(dbPath, outputDir);
}

Expand Down

0 comments on commit 45d207f

Please sign in to comment.