Skip to content

Commit 6d6fcea

Browse files
committed
feat(new-application): fix format on log messages
1 parent f05da1a commit 6d6fcea

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/ui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ exports.ConsoleUI = class {
3333
}
3434
}
3535

36-
log(text) {
36+
log(text, createLinesIndentation) {
37+
if (createLinesIndentation !== undefined) {
38+
text = createLines(text, createLinesIndentation, this.getWidth());
39+
}
3740
return new Promise((resolve, reject) => {
3841
console.log(text);
3942
resolve();

lib/workflow/activities/project-install.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
const os = require('os');
33
const UI = require('../../ui').UI;
44
const transform = require('../../colors/transform');
5-
const createLines = require('../../string').createLines;
65
const Yarn = require('../../package-managers/yarn').Yarn;
76
const CLIOptions = require('../../cli-options').CLIOptions;
87
const fs = require('../../file-system');
@@ -24,19 +23,19 @@ module.exports = class {
2423
const yarnLockExists = fs.existsSync(fs.join(workingDirectory, 'yarn.lock'));
2524

2625
if (npmLockExists && yarnLockExists) {
27-
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"));
26+
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"), '');
2827
}
2928
else if (npmLockExists) {
30-
this.ui.log(transform('<bold>Note:</bold> Found NPM lock file. Recommend continued use of npm as package manager.\n'));
29+
this.ui.log(transform('<bold>Note:</bold> Found NPM lock file. Recommend continued use of npm as package manager.\n'), '');
3130
}
3231
else if (yarnLockExists) {
33-
this.ui.log(transform('<bold>Note:</bold> Found Yarn lock file. Recommend continued use of yarn as package manager.\n'));
32+
this.ui.log(transform('<bold>Note:</bold> Found Yarn lock file. Recommend continued use of yarn as package manager.\n'), '');
3433
}
3534
let defaultIndex = 0;
3635
let yarn = new Yarn();
3736
if (yarn.isAvailable(workingDirectory)) {
3837
if (!yarnLockExists) {
39-
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.');
38+
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.', '');
4039
}
4140
if (npmLockExists && !yarnLockExists) {
4241
defaultIndex = 1;
@@ -118,7 +117,7 @@ module.exports = class {
118117
return this.ui.log(transform('<bgGreen><white><bold>Congratulations</bold></white></bgGreen>') + os.EOL + os.EOL)
119118
.then(() => this.ui.log(`Congratulations! Your Project "${project.model.name}" Has Been Created!` + os.EOL + os.EOL))
120119
.then(() => project.renderManualInstructions())
121-
.then(() => this.ui.log(createLines(transform(message), '', this.ui.getWidth())))
120+
.then(() => this.ui.log(transform(message), ''))
122121
.then(() => this.ui.log(os.EOL + os.EOL + 'Happy Coding!'));
123122
}
124123
};

0 commit comments

Comments
 (0)