Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lodash _.join with native array.join #7805

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/classes/PluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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] || {};
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
Expand Down
15 changes: 6 additions & 9 deletions lib/plugins/aws/provider/awsProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/log/fileLog.js
Original file line number Diff line number Diff line change
@@ -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;