Files
mini-loader/packages/cli/src/utils/step.ts
2024-01-12 14:14:40 +01:00

16 lines
314 B
TypeScript

import ora from 'ora';
const step = async <T>(message: string, fn: () => Promise<T>): Promise<T> => {
const spinner = ora(message).start();
try {
const result = await fn();
await spinner.succeed();
return result;
} catch (err) {
await spinner.fail();
throw err;
}
};
export { step };