mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Remove autocomplete setup from postinstall script
This commit is contained in:
parent
6e55723505
commit
f4dfbdfcba
@ -1,12 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const chalk = require('chalk');
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const execSync = require('child_process').execSync;
|
||||
|
||||
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)) {
|
||||
@ -30,30 +27,7 @@ try {
|
||||
serverless
|
||||
.init()
|
||||
.then(() => serverless.utils.logStat(serverless, 'install'))
|
||||
.then(() => setupAutocomplete())
|
||||
.catch(() => Promise.resolve()))();
|
||||
} catch (error) {
|
||||
// fail silently
|
||||
}
|
||||
|
||||
function setupAutocomplete() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const indexRegex = new RegExp(path.join(path.sep, 'index.js'));
|
||||
const tabtabPath = require.resolve('tabtab').replace(indexRegex, '');
|
||||
const tabtabCliPath = path.join(tabtabPath, 'src', 'cli.js');
|
||||
|
||||
try {
|
||||
execSync(`node "${tabtabCliPath}" install --name serverless --auto`);
|
||||
execSync(`node "${tabtabCliPath}" install --name sls --auto`);
|
||||
execSync(`node "${tabtabCliPath}" install --name slss --auto`);
|
||||
return resolve();
|
||||
} catch (error) {
|
||||
execSync(`node "${tabtabCliPath}" install --name serverless --stdout`);
|
||||
execSync(`node "${tabtabCliPath}" install --name sls --stdout`);
|
||||
execSync(`node "${tabtabCliPath}" install --name slss --stdout`);
|
||||
console.log('Could not auto-install serverless autocomplete script.');
|
||||
console.log('Please copy / paste the script above into your shell.');
|
||||
return reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user