mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
refactor: Replace _.join with array.join (#7805)
This commit is contained in:
parent
c575f7aecb
commit
5cf46bf109
@ -33,9 +33,8 @@ const requireServicePlugin = (servicePath, pluginPath, localPluginsPath) => {
|
||||
*/
|
||||
class TerminateHookChain extends Error {
|
||||
constructor(commands) {
|
||||
const commandChain = _.join(commands, ':');
|
||||
const commandChain = commands.join(':');
|
||||
const message = `Terminating ${commandChain}`;
|
||||
|
||||
super(message);
|
||||
this.message = message;
|
||||
this.name = 'TerminateHookChain';
|
||||
@ -367,7 +366,7 @@ class PluginManager {
|
||||
return;
|
||||
}
|
||||
if (alias.command) {
|
||||
const commandPath = _.join(_.split(alias.command, ':'), '.commands.');
|
||||
const commandPath = _.split(alias.command, ':').join('.commands.');
|
||||
_.set(target, name, _.get(this.commands, commandPath));
|
||||
} else {
|
||||
target[name] = target[name] || {};
|
||||
@ -480,7 +479,7 @@ class PluginManager {
|
||||
const hooks = this.getHooks(events);
|
||||
|
||||
if (process.env.SLS_DEBUG) {
|
||||
this.serverless.cli.log(`Invoke ${_.join(commandsArray, ':')}`);
|
||||
this.serverless.cli.log(`Invoke ${commandsArray.join(':')}`);
|
||||
if (hooks.length === 0) {
|
||||
const warningMessage = 'Warning: The command you entered did not catch on any hooks';
|
||||
this.serverless.cli.log(warningMessage);
|
||||
@ -491,7 +490,7 @@ class PluginManager {
|
||||
TerminateHookChain,
|
||||
() => {
|
||||
if (process.env.SLS_DEBUG) {
|
||||
this.serverless.cli.log(`Terminate ${_.join(commandsArray, ':')}`);
|
||||
this.serverless.cli.log(`Terminate ${commandsArray.join(':')}`);
|
||||
}
|
||||
return BbPromise.resolve();
|
||||
}
|
||||
|
||||
@ -255,15 +255,12 @@ class AwsProvider {
|
||||
const backOff = BASE_BACKOFF + jitter;
|
||||
|
||||
that.serverless.cli.log(
|
||||
_.join(
|
||||
[
|
||||
`Recoverable error occurred (${e.message}), sleeping for ~${Math.round(
|
||||
backOff / 1000
|
||||
)} seconds.`,
|
||||
`Try ${nextTryNum} of ${MAX_TRIES}`,
|
||||
],
|
||||
' '
|
||||
)
|
||||
[
|
||||
`Recoverable error occurred (${e.message}), sleeping for ~${Math.round(
|
||||
backOff / 1000
|
||||
)} seconds.`,
|
||||
`Try ${nextTryNum} of ${MAX_TRIES}`,
|
||||
].join(' ')
|
||||
);
|
||||
setTimeout(doCall, backOff, nextTryNum);
|
||||
} else {
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const fileLog = function(...args) {
|
||||
// TODO BRN: This does not guarantee order, is not multi process safe,
|
||||
// TODO BRN: and is not guaranteed to complete before exit.
|
||||
fs.appendFileSync(path.join(process.cwd(), 'sls.log'), `${_.join(args)}\n`);
|
||||
fs.appendFileSync(path.join(process.cwd(), 'sls.log'), `${args.join()}\n`);
|
||||
};
|
||||
|
||||
module.exports = fileLog;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user