From 8b973a302a2d79c8d8193acf785a610d4e29ea1b Mon Sep 17 00:00:00 2001 From: Muhammed Thanish Date: Tue, 13 Sep 2016 18:23:07 +0530 Subject: [PATCH] Create empty db file for static build --- dist/server/build.js | 4 ++++ src/server/build.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dist/server/build.js b/dist/server/build.js index 11af1e285162..04c885a07a45 100644 --- a/dist/server/build.js +++ b/dist/server/build.js @@ -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); } diff --git a/src/server/build.js b/src/server/build.js index 31d3d61b7997..c37d257d1dfe 100644 --- a/src/server/build.js +++ b/src/server/build.js @@ -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); }