1 | 'use strict';
|
2 |
|
3 | const boxen = require('boxen');
|
4 | const chalk = require('chalk');
|
5 | const isStandaloneExecutable = require('../lib/utils/isStandaloneExecutable');
|
6 |
|
7 | const isWindows = process.platform === 'win32';
|
8 |
|
9 | const truthyStr = val => val && !['0', 'false', 'f', 'n', 'no'].includes(val.toLowerCase());
|
10 | const { CI, ADBLOCK, SILENT } = process.env;
|
11 | if (!truthyStr(CI) && !truthyStr(ADBLOCK) && !truthyStr(SILENT)) {
|
12 | const messageTokens = ['Serverless Framework successfully installed!'];
|
13 | if (isStandaloneExecutable && !isWindows) {
|
14 | messageTokens.push(
|
15 | 'To start your first project, please open another terminal and run “serverless”.',
|
16 | 'You can uninstall at anytime by running “serverless uninstall”.'
|
17 | );
|
18 | } else {
|
19 | messageTokens.push("To start your first project run 'serverless'.");
|
20 | }
|
21 | const message = messageTokens.join('\n\n');
|
22 | process.stdout.write(
|
23 | `${
|
24 | isStandaloneExecutable && isWindows
|
25 | ? message
|
26 | : boxen(chalk.yellow(message), {
|
27 | padding: 1,
|
28 | margin: 1,
|
29 | borderColor: 'yellow',
|
30 | })
|
31 | }\n`
|
32 | );
|
33 | }
|
34 |
|
35 | try {
|
36 | const Serverless = require('../lib/Serverless');
|
37 | const serverless = new Serverless();
|
38 |
|
39 | serverless
|
40 | .init()
|
41 | .then(() => serverless.utils.logStat(serverless, 'install'))
|
42 | .catch(() => {});
|
43 | } catch (error) {
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | }
|