Skip to content

Commit 7c8741e

Browse files
committed
feat(create-project): cleaner post-create message
1 parent 6d9b7df commit 7c8741e

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

lib/commands/create-project.ts

+26-10
Original file line numberDiff line numberDiff line change
@@ -340,19 +340,35 @@ can skip this prompt next time using the --template option, or the --ng, --react
340340
}
341341

342342
public async postCommandAction(args: string[]): Promise<void> {
343-
const { projectDir } = this.createdProjectData;
343+
const { projectDir, projectName } = this.createdProjectData;
344344
const relativePath = path.relative(process.cwd(), projectDir);
345-
this.$logger.printMarkdown(
346-
`Now you can navigate to your project with \`$ cd ${relativePath}\` and then:`
347-
);
348-
this.$logger.printMarkdown(
345+
346+
const greyDollarSign = "$".grey;
347+
this.$logger.clearScreen();
348+
this.$logger.info(
349349
[
350-
`- Run the project on iOS \`$ ns run ios\``,
351-
`- Run the project on Android \`$ ns run android\``,
352-
`- Debug the project on iOS \`$ ns debug ios\``,
353-
`- Debug the project on Android \`$ ns debug android\``,
350+
[
351+
`Project`.green,
352+
projectName.cyan,
353+
`was successfully created.`.green,
354+
].join(" "),
355+
"",
356+
`Now you can navigate to your project with ${
357+
`cd ${relativePath}`.cyan
358+
} and then:`,
359+
"",
360+
`Run the project on multiple devices:`,
361+
"",
362+
` ${greyDollarSign} ${"ns run ios".green}`,
363+
` ${greyDollarSign} ${"ns run android".green}`,
364+
"",
365+
"Debug the project with Chrome DevTools:",
366+
"",
367+
` ${greyDollarSign} ${"ns debug ios".green}`,
368+
` ${greyDollarSign} ${"ns debug android".green}`,
354369
``,
355-
`For more options consult the docs or run \`$ ns --help\``,
370+
`For more options consult the docs or run ${"ns --help".green}`,
371+
"",
356372
].join("\n")
357373
);
358374
// Commented as we may bring this back with a playground revision/rewrite

lib/common/definitions/logger.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ declare global {
2727
printMarkdown(...args: any[]): void;
2828
prepare(item: any): string;
2929
isVerbose(): boolean;
30+
clearScreen(): void;
3031
}
3132

3233
interface Log4JSAppenderConfiguration extends Configuration {

lib/common/logger/logger.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as log4js from "log4js";
22
import * as util from "util";
3+
import * as readline from "readline";
34
import * as stream from "stream";
45
import * as marked from "marked";
56
import * as _ from "lodash";
@@ -158,6 +159,14 @@ export class Logger implements ILogger {
158159
return log4js.levels.DEBUG.isGreaterThanOrEqualTo(this.getLevel());
159160
}
160161

162+
public clearScreen() {
163+
const repeatCount = process.stdout.rows - 2;
164+
const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
165+
console.log(blank);
166+
readline.cursorTo(process.stdout, 0, 0);
167+
readline.clearScreenDown(process.stdout);
168+
}
169+
161170
private logMessage(inputData: any[], logMethod: string): void {
162171
this.initialize();
163172

0 commit comments

Comments
 (0)