diff --git a/check.js b/check.js index 09e4766..ae75a2e 100644 --- a/check.js +++ b/check.js @@ -1,6 +1,9 @@ var fs = require('fs'); const disabledForMachine = process.env.npm_package_config_disabled; +const greetingLogged = process.env.npm_package_config_greeting_logged; +const optoutLogged = process.env.npm_package_config_optout_logged; + let disabledForProject = false; if (fs.existsSync("../../../package.json")) { @@ -12,11 +15,11 @@ if (fs.existsSync("../../../package.json")) { if (disabledForMachine || disabledForProject) { if (disabledForMachine) { - console.log(` + !optoutLogged && console.log(` You have disabled Vaadin development time usage statistics collection. To re-enable, run: npm explore @vaadin/vaadin-usage-statistics -- npm run enable For more details, see https://github.com/vaadin/vaadin-usage-statistics -`); + `); } else { console.log(` You have disabled Vaadin development time usage statistics collection. To re-enable, remove: @@ -33,7 +36,7 @@ if (disabledForMachine || disabledForProject) { throw err; } } else { - console.log(` + !greetingLogged && console.log(` Vaadin collects development time usage statistics to improve this product. To opt-out, either run: npm explore @vaadin/vaadin-usage-statistics -- npm run disable to store disable statistics for the machine, or add diff --git a/magi-p3-post.json b/magi-p3-post.json index 945dec3..a334db8 100644 --- a/magi-p3-post.json +++ b/magi-p3-post.json @@ -4,6 +4,6 @@ "\"license\": \"Apache-2.0\"," ], "to": [ - "\"license\": \"Apache-2.0\",\n\"scripts\": {\n\"postinstall\": \"node check.js\",\n\"disable\": \"npm config set @vaadin/vaadin-usage-statistics:disabled true && npm run postinstall\",\n\"enable\": \"npm config set @vaadin/vaadin-usage-statistics:disabled false && npm run postinstall\"\n}," + "\"license\": \"Apache-2.0\",\n\"scripts\": {\n\"postinstall\": \"node check.js && npm config set @vaadin/vaadin-usage-statistics:greeting-logged true\",\n\"disable\": \"npm config set @vaadin/vaadin-usage-statistics:disabled true && npm run postinstall && npm config set @vaadin/vaadin-usage-statistics:optout-logged true\",\n\"enable\": \"npm config set @vaadin/vaadin-usage-statistics:disabled false && npm config set @vaadin/vaadin-usage-statistics:greeting-logged false && npm config set @vaadin/vaadin-usage-statistics:optout-logged false && npm run postinstall\"\n}," ] }