serverless/scripts/postinstall.js
2019-10-15 12:41:21 +02:00

34 lines
943 B
JavaScript

'use strict';
const chalk = require('chalk');
/* eslint-disable no-console */
const truthyStr = val => val && !['0', 'false', 'f', 'n', 'no'].includes(val.toLowerCase());
const { CI, ADBLOCK, SILENT } = process.env;
if (!truthyStr(CI) && !truthyStr(ADBLOCK) && !truthyStr(SILENT)) {
console.log(
chalk.yellow(`\
+--------------------------------------------------+
| |
| Serverless Framework successfully installed! |
| To start your first project, run “serverless”. |
| |
+--------------------------------------------------+
`)
);
}
try {
const Serverless = require('../lib/Serverless');
const serverless = new Serverless();
(() =>
serverless
.init()
.then(() => serverless.utils.logStat(serverless, 'install'))
.catch(() => Promise.resolve()))();
} catch (error) {
// fail silently
}