Skip to content

Commit edcd360

Browse files
feat: display progress
1 parent fcf3e98 commit edcd360

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/commands/clear.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {deleteAssets} from '@junobuild/core';
22
import {red} from 'kleur';
3+
import ora from 'ora';
34
import {DAPP_COLLECTION} from '../constants/constants';
45
import {junoConfigExist, readSatelliteConfig} from '../utils/satellite.config.utils';
56
import {satelliteParameters} from '../utils/satellite.utils';
@@ -12,8 +13,14 @@ export const clear = async () => {
1213

1314
const {satelliteId} = await readSatelliteConfig();
1415

15-
await deleteAssets({
16-
collection: DAPP_COLLECTION,
17-
satellite: satelliteParameters(satelliteId)
18-
});
16+
const spinner = ora('Clearing dapp assets...').start();
17+
18+
try {
19+
await deleteAssets({
20+
collection: DAPP_COLLECTION,
21+
satellite: satelliteParameters(satelliteId)
22+
});
23+
} finally {
24+
spinner.stop();
25+
}
1926
};

src/commands/deploy.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {lstatSync, readdirSync} from 'fs';
77
import {readFile} from 'fs/promises';
88
import mime from 'mime-types';
99
import minimatch from 'minimatch';
10+
import ora from 'ora';
1011
import {basename, extname, join} from 'path';
1112
import {DAPP_COLLECTION, SOURCE} from '../constants/constants';
1213
import {SatelliteConfigHeaders} from '../types/satellite.config';
@@ -58,8 +59,14 @@ export const deploy = async () => {
5859
});
5960
};
6061

61-
const promises = sourceFiles.map(upload);
62-
await Promise.all(promises);
62+
const spinner = ora(`Uploading...`).start();
63+
64+
try {
65+
const promises = sourceFiles.map(upload);
66+
await Promise.all(promises);
67+
} finally {
68+
spinner.stop();
69+
}
6370
};
6471

6572
const configHeaders = ({

0 commit comments

Comments
 (0)