Skip to content

Commit

Permalink
feat(new-application): fix format on log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jwx committed Feb 7, 2019
1 parent f05da1a commit 6d6fcea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion lib/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 5 additions & 6 deletions lib/workflow/activities/project-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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;
Expand Down Expand Up @@ -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.