More discreet post-install

This commit is contained in:
mde
2019-11-18 17:58:56 -08:00
parent bd3f7c8b2d
commit 228d8e45b7
3 changed files with 17 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ publishTask('ejs', ['build'], function () {
'README.md',
'LICENSE',
'package.json',
'postinstall.js',
'ejs.js',
'ejs.min.js',
'lib/**'

View File

@@ -32,6 +32,6 @@
"node": ">=0.10.0"
},
"scripts": {
"postinstall": "node -e \"console.log('Thank you for installing \\u001b[35mEJS\\u001b[0m: built with the \\u001b[32mJake\\u001b[0m JavaScript build tool (\\u001b[32mhttps://jakejs.com/\\u001b[0m)\\n');\""
"postinstall": "node ./postinstall.js"
}
}

15
postinstall.js Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env node
function isTrue(value) {
return !!value && value !== '0' && value !== 'false';
}
let envDisable = isTrue(process.env.DISABLE_OPENCOLLECTIVE) || isTrue(process.env.CI);
let logLevel = process.env.npm_config_loglevel;
let logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
if (!envDisable && !logLevelDisplay) {
console.log('Thank you for installing \u001b[35mEJS\u001b[0m: built with the \u001b[32mJake\u001b[0m JavaScript build tool (\u001b[32mhttps://jakejs.com/\u001b[0m)\n');
}