From 43dc76a20502d7ca3440a75b15fe9c521b43f137 Mon Sep 17 00:00:00 2001 From: sw-yx Date: Wed, 10 Jul 2019 13:43:50 -0400 Subject: [PATCH 1/2] warn before running funciton buidler --- src/commands/dev/index.js | 7 +++++++ src/function-builder-detectors/netlify-lambda.js | 1 + 2 files changed, 8 insertions(+) diff --git a/src/commands/dev/index.js b/src/commands/dev/index.js index 8578c77..781dd38 100644 --- a/src/commands/dev/index.js +++ b/src/commands/dev/index.js @@ -232,6 +232,13 @@ class DevCommand extends Command { if (functionsDir) { const functionBuilder = await detectFunctionsBuilder(settings); if (functionBuilder) { + this.log( + `running npm script ${chalk.yellow( + functionBuilder.npmScript + )} with detected function builder ${chalk.yellow( + functionBuilder.builderName + )}` + ); await functionBuilder.build(); const functionWatcher = chokidar.watch(functionBuilder.src); functionWatcher.on("add", functionBuilder.build); diff --git a/src/function-builder-detectors/netlify-lambda.js b/src/function-builder-detectors/netlify-lambda.js index 79500a9..55fba88 100644 --- a/src/function-builder-detectors/netlify-lambda.js +++ b/src/function-builder-detectors/netlify-lambda.js @@ -35,6 +35,7 @@ module.exports = function() { if (settings.npmScript) { settings.build = () => execa(yarnExists ? "yarn" : "npm", ["run", settings.npmScript]); + settings.builderName = "netlify-lambda"; return settings; } }; From e90213aa5f12e81b207147f30b69823afedd0873 Mon Sep 17 00:00:00 2001 From: sw-yx Date: Wed, 10 Jul 2019 13:51:53 -0400 Subject: [PATCH 2/2] better warning --- src/commands/dev/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/commands/dev/index.js b/src/commands/dev/index.js index 781dd38..aa94adc 100644 --- a/src/commands/dev/index.js +++ b/src/commands/dev/index.js @@ -233,12 +233,15 @@ class DevCommand extends Command { const functionBuilder = await detectFunctionsBuilder(settings); if (functionBuilder) { this.log( - `running npm script ${chalk.yellow( - functionBuilder.npmScript - )} with detected function builder ${chalk.yellow( + `${NETLIFYDEVLOG} Function builder ${chalk.yellow( functionBuilder.builderName + )} detected: Running npm script ${chalk.yellow( + functionBuilder.npmScript )}` ); + this.warn( + `${NETLIFYDEVWARN} This is a beta feature, please give us feedback on how to improve at https://github.com/netlify/netlify-dev-plugin/` + ); await functionBuilder.build(); const functionWatcher = chokidar.watch(functionBuilder.src); functionWatcher.on("add", functionBuilder.build);