Skip to content

Commit 7348f29

Browse files
authored
Refactor printer to use ora and add two new APIs (#2525)
* Refactor printer to use ora and add two new APIs * add logging for test failures * test with logs * update ci detection * update ci detection * update spinner apis to return a spinner id * add another non-tty test * change default color of ora spinner to white
1 parent cdb5156 commit 7348f29

File tree

8 files changed

+499
-133
lines changed

8 files changed

+499
-133
lines changed

.changeset/gold-crabs-cough.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@aws-amplify/cli-core': minor
3+
'create-amplify': patch
4+
---
5+
6+
Refactor printer to use ora and add two new APIs

package-lock.json

Lines changed: 141 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli-core/API.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,21 @@ export class PackageManagerControllerFactory {
8787

8888
// @public
8989
export class Printer {
90-
constructor(minimumLogLevel: LogLevel, stdout?: WriteStream | NodeJS.WritableStream, stderr?: WriteStream | NodeJS.WritableStream, refreshRate?: number);
91-
indicateProgress(message: string, callback: () => Promise<void>): Promise<void>;
92-
log(message: string, level?: LogLevel): void;
90+
constructor(minimumLogLevel: LogLevel, stdout?: WriteStream | NodeJS.WritableStream, stderr?: WriteStream | NodeJS.WritableStream, refreshRate?: number, enableTTY?: boolean);
91+
indicateProgress: (message: string, callback: () => Promise<void>, successMessage?: string) => Promise<void>;
92+
// (undocumented)
93+
isSpinnerRunning: (id: string) => boolean;
94+
log: (message: string, level?: LogLevel) => void;
9395
print: (message: string) => void;
9496
printNewLine: () => void;
97+
startSpinner: (message: string, options?: {
98+
timeoutSeconds: number;
99+
}) => string;
100+
stopSpinner: (id: string) => void;
101+
updateSpinner: (id: string, options: {
102+
message?: string;
103+
prefixText?: string;
104+
}) => void;
95105
}
96106

97107
// @public (undocumented)

packages/cli-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@inquirer/prompts": "^7.3.2",
2424
"execa": "^9.5.1",
2525
"kleur": "^4.1.5",
26+
"ora": "8.2.0",
2627
"zod": "^3.22.2"
2728
}
2829
}

0 commit comments

Comments
 (0)