Skip to content

Commit

Permalink
refactor(CLI): Modern log for local version fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Sep 29, 2021
1 parent e070110 commit 231095d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Serverless.js
Expand Up @@ -245,7 +245,8 @@ class Serverless {
}
logDeprecation.defaultMode = 'warn';
logDeprecation.flushBuffered();
this.cli.log('Running "serverless" installed locally (in service node_modules)');
legacy.log('Running "serverless" installed locally (in service node_modules)');
log.notice('Running "serverless" from node_modules');
// TODO: Replace below fallback logic with more straightforward one at top of the CLI
// when we willl drop support for the "disableLocalInstallationFallback" setting
this.isOverridenByLocal = true;
Expand Down
5 changes: 4 additions & 1 deletion lib/cli/render-version.js
Expand Up @@ -5,6 +5,7 @@ const { version } = require('../../package');
const { version: dashboardPluginVersion } = require('@serverless/dashboard-plugin/package');
const { version: componentsVersion } = require('@serverless/components/package');
const { platformClientVersion } = require('@serverless/dashboard-plugin');
const { legacy, log } = require('@serverless/utils/log');
const isStandaloneExecutable = require('../utils/isStandaloneExecutable');
const resolveLocalServerlessPath = require('./resolve-local-serverless-path');
const chalk = require('chalk');
Expand All @@ -21,11 +22,13 @@ module.exports = async () => {
const isLocal = serverlessPath === localServerlessPath;
if (!isLocal) {
// Attempt to resolve version with local Serverless instance
process.stdout.write(
legacy.write(
`Serverless: ${chalk.yellow(
'Running "serverless" installed locally (in service node_modules)'
)}\n`
);
log.notice('Running "serverless" from node_modules');
log.notice();

try {
try {
Expand Down

0 comments on commit 231095d

Please sign in to comment.