Skip to content
Permalink
Browse files

feat(new-application): fix format on log messages

  • Loading branch information...
jwx committed Feb 7, 2019
1 parent f05da1a commit 6d6fceadda2a1b7a3837d227a39e9aa7a100decb
Showing with 9 additions and 7 deletions.
  1. +4 −1 lib/ui.js
  2. +5 −6 lib/workflow/activities/project-install.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();
@@ -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("<red><bold>WARNING:</bold></red> 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("<red><bold>WARNING:</bold></red> 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('<bold>Note:</bold> Found NPM lock file. Recommend continued use of npm as package manager.\n'));
this.ui.log(transform('<bold>Note:</bold> Found NPM lock file. Recommend continued use of npm as package manager.\n'), '');
}
else if (yarnLockExists) {
this.ui.log(transform('<bold>Note:</bold> Found Yarn lock file. Recommend continued use of yarn as package manager.\n'));
this.ui.log(transform('<bold>Note:</bold> 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('<bgGreen><white><bold>Congratulations</bold></white></bgGreen>') + 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!'));
}
};

0 comments on commit 6d6fcea

Please sign in to comment.
You can’t perform that action at this time.