refactor: move generateEnv script inside folder

This commit is contained in:
2024-06-03 09:15:02 -04:00
parent f2b9d10a16
commit 5e0de6387d
2 changed files with 34 additions and 19 deletions

23
src/libs/logStep.ts Normal file
View File

@@ -0,0 +1,23 @@
export async function logStep<T = void>(
inProgressText: string,
step: () => Promise<T> | T,
): Promise<T>;
export async function logStep<T = void>(
inProgressText: string,
step: () => Promise<T> | T,
doneText: string,
): Promise<T>;
export async function logStep<T = void>(
inProgressText: string,
step: () => Promise<T> | T,
doneText: string = `Completed step "${inProgressText}"`,
) {
console.time(doneText);
console.log(`${inProgressText}...`);
return Promise.resolve(step()).then((value) => {
console.timeEnd(doneText);
return value;
});
}