diff --git a/cli/build/index.js b/cli/build/index.js index 589b80a..0d4ddcd 100755 --- a/cli/build/index.js +++ b/cli/build/index.js @@ -60,6 +60,12 @@ run(async () => { // @type { quotes: Quote[], authors: Author[], tags: Tag[] } const db = parseDataFiles(DEST) + Object.keys(src).forEach(key => { + if (typeof db.key === 'undefined') { + db[key] = [] + } + }) + // Apply transforms to the source data to create the generated data files // This will add computed properties that are not included in the source // data files. diff --git a/cli/sync/README.md b/cli/sync/README.md index 091e8d3..75ebf2f 100644 --- a/cli/sync/README.md +++ b/cli/sync/README.md @@ -14,7 +14,7 @@ Before running this command, make sure you run the build command to create / upd ## Usage ```sh -$ node cli/syncData [] [..options] +$ node cli/sync [] [..options] ``` ## Options diff --git a/cli/sync/index.js b/cli/sync/index.js index a8f28fd..2cbb83b 100644 --- a/cli/sync/index.js +++ b/cli/sync/index.js @@ -33,7 +33,8 @@ try { await testConnection() log.newLine() - const dataFiles = parseDataFiles(dataDir.generated) + const dataSrc = args.d || args.dest || dataDir.generated + const dataFiles = parseDataFiles(dataSrc) // Connect to the database await client.connect()