From 505be85840d3739371445e3a152568528464dde1 Mon Sep 17 00:00:00 2001 From: Matt Roberts Date: Fri, 7 Jun 2019 23:06:23 +0100 Subject: [PATCH] feat(templateloader): Cache external models Signed-off-by: Matt Roberts --- packages/cicero-cli/index.js | 8 ++++---- packages/cicero-core/package.json | 1 + packages/cicero-core/src/templateloader.js | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/cicero-cli/index.js b/packages/cicero-cli/index.js index c5a17e084..6f407e906 100755 --- a/packages/cicero-cli/index.js +++ b/packages/cicero-cli/index.js @@ -46,7 +46,7 @@ require('yargs') argv = Commands.validateParseArgs(argv); return Commands.parse(argv.template, argv.sample, argv.out, argv.currentTime) .then((result) => { - Logger.info(JSON.stringify(result)); + if(result) {Logger.info(JSON.stringify(result));} }) .catch((err) => { Logger.error(err.message); @@ -78,7 +78,7 @@ require('yargs') argv = Commands.validateGenerateTextArgs(argv); return Commands.generateText(argv.template, argv.data, argv.out) .then((result) => { - Logger.info(result); + if(result) {Logger.info(JSON.stringify(result));} }) .catch((err) => { Logger.error(err.message); @@ -147,7 +147,7 @@ require('yargs') argv = Commands.validateExecuteArgs(argv); return Commands.execute(argv.template, argv.sample, argv.request, argv.state, argv.currentTime) .then((result) => { - Logger.info(JSON.stringify(result)); + if(result) {Logger.info(JSON.stringify(result));} }) .catch((err) => { Logger.error(err.message); @@ -176,7 +176,7 @@ require('yargs') argv = Commands.validateInitArgs(argv); return Commands.init(argv.template, argv.sample, argv.currentTime) .then((result) => { - Logger.info(JSON.stringify(result)); + if(result) {Logger.info(JSON.stringify(result));} }) .catch((err) => { Logger.error(err.message); diff --git a/packages/cicero-core/package.json b/packages/cicero-core/package.json index e6aa43b60..4c356735f 100644 --- a/packages/cicero-core/package.json +++ b/packages/cicero-core/package.json @@ -17,6 +17,7 @@ "scripts": { "webpack": "webpack --config webpack.config.js --mode production", "build": "babel src -d lib --copy-files && nearleyc ./src/tdl.ne -o ./lib/tdl.js && node scripts/nunjucks-precompile.js", + "build:watch": "babel src -d lib --copy-files --watch", "prepublishOnly": "npm run build && npm run webpack", "prepare": "npm run build", "pretest": "npm run lint", diff --git a/packages/cicero-core/src/templateloader.js b/packages/cicero-core/src/templateloader.js index acd25e834..de847a56f 100644 --- a/packages/cicero-core/src/templateloader.js +++ b/packages/cicero-core/src/templateloader.js @@ -259,7 +259,6 @@ class TemplateLoader { * @return {Promise