From 6d6fceadda2a1b7a3837d227a39e9aa7a100decb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Wenzel?= Date: Thu, 7 Feb 2019 14:14:35 +0100 Subject: [PATCH] feat(new-application): fix format on log messages --- lib/ui.js | 5 ++++- lib/workflow/activities/project-install.js | 11 +++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/ui.js b/lib/ui.js index e2f3fc288..6dc52e6b3 100644 --- a/lib/ui.js +++ b/lib/ui.js @@ -33,7 +33,10 @@ exports.ConsoleUI = class { } } - log(text) { + log(text, createLinesIndentation) { + if (createLinesIndentation !== undefined) { + text = createLines(text, createLinesIndentation, this.getWidth()); + } return new Promise((resolve, reject) => { console.log(text); resolve(); diff --git a/lib/workflow/activities/project-install.js b/lib/workflow/activities/project-install.js index 8a7027d97..01f42cb8e 100644 --- a/lib/workflow/activities/project-install.js +++ b/lib/workflow/activities/project-install.js @@ -2,7 +2,6 @@ const os = require('os'); const UI = require('../../ui').UI; const transform = require('../../colors/transform'); -const createLines = require('../../string').createLines; const Yarn = require('../../package-managers/yarn').Yarn; const CLIOptions = require('../../cli-options').CLIOptions; const fs = require('../../file-system'); @@ -24,19 +23,19 @@ module.exports = class { const yarnLockExists = fs.existsSync(fs.join(workingDirectory, 'yarn.lock')); if (npmLockExists && yarnLockExists) { - this.ui.log(transform("WARNING: Found lock files for both npm and yarn! Lock files are not cross compatible between package managers. It's recommended to remove either package-lock.json (NPM) or yarn.lock (Yarn) from the project directory before installing new packages.\n")); + this.ui.log(transform("WARNING: Found lock files for both npm and yarn! Lock files are not cross compatible between package managers. It's recommended to remove either package-lock.json (NPM) or yarn.lock (Yarn) from the project directory before installing new packages.\n"), ''); } else if (npmLockExists) { - this.ui.log(transform('Note: Found NPM lock file. Recommend continued use of npm as package manager.\n')); + this.ui.log(transform('Note: Found NPM lock file. Recommend continued use of npm as package manager.\n'), ''); } else if (yarnLockExists) { - this.ui.log(transform('Note: Found Yarn lock file. Recommend continued use of yarn as package manager.\n')); + this.ui.log(transform('Note: Found Yarn lock file. Recommend continued use of yarn as package manager.\n'), ''); } let defaultIndex = 0; let yarn = new Yarn(); if (yarn.isAvailable(workingDirectory)) { if (!yarnLockExists) { - this.ui.log('Note: Lock files are not cross compatible between package managers. Choose Yarn here only if you intend to use Yarn for future package installs. Alternatively, remove either yarn.lock or package-lock.json from the project directory before installing new packages.'); + this.ui.log('Note: Lock files are not cross compatible between package managers. Choose Yarn here only if you intend to use Yarn for future package installs. Alternatively, remove either yarn.lock or package-lock.json from the project directory before installing new packages.', ''); } if (npmLockExists && !yarnLockExists) { defaultIndex = 1; @@ -118,7 +117,7 @@ module.exports = class { return this.ui.log(transform('Congratulations') + os.EOL + os.EOL) .then(() => this.ui.log(`Congratulations! Your Project "${project.model.name}" Has Been Created!` + os.EOL + os.EOL)) .then(() => project.renderManualInstructions()) - .then(() => this.ui.log(createLines(transform(message), '', this.ui.getWidth()))) + .then(() => this.ui.log(transform(message), '')) .then(() => this.ui.log(os.EOL + os.EOL + 'Happy Coding!')); } };