Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create empty db file for static build #449

Merged
merged 1 commit into from
Sep 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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