Skip to content

Commit c490b84

Browse files
committed
chore: improve spinner-ci example
1 parent 8617eeb commit c490b84

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/basic/spinner-ci.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import * as p from '@clack/prompts';
22

33
const s = p.spinner();
4+
let progress = 0;
45
let counter = 0;
56
let loop: NodeJS.Timer;
67

78
p.intro('Running spinner in CI environment');
89
s.start('spinner.start');
910
new Promise((resolve) => {
1011
loop = setInterval(() => {
11-
counter++;
12+
if (progress % 1000 === 0) {
13+
counter++;
14+
}
15+
progress += 100;
1216
s.message(`spinner.message [${counter}]`);
1317
if (counter > 6) {
1418
clearInterval(loop);
1519
resolve(true);
1620
}
17-
}, 1000);
21+
}, 100);
1822
}).then(() => {
1923
s.stop('spinner.stop');
2024
p.outro('Done');

packages/prompts/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { cursor, erase } from 'sisteransi';
1616

1717
export { isCancel } from '@clack/core';
1818

19-
2019
const unicode = isUnicodeSupported();
2120
const s = (c: string, fallback: string) => (unicode ? c : fallback);
2221
const S_STEP_ACTIVE = s('◆', '*');

0 commit comments

Comments
 (0)