Skip to content

Commit

Permalink
* (bluefox) Added log outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Sep 21, 2024
1 parent f9fefbe commit 141fb5c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export function npmInstall(
return new Promise((resolve, reject) => {
// Install node modules
const cwd = src.replace(/\\/g, '/');
const start = Date.now();

const cmd = `npm install${options?.force !== false ? ' --force' : ''}`;

Expand All @@ -212,7 +213,7 @@ export function npmInstall(
if (code && code !== 1) {
reject(`Cannot install: ${code}`);
} else {
console.log(`[${new Date().toISOString()}] "${cmd} in ${cwd} finished.`);
console.log(`[${new Date().toISOString()}] "${cmd}" in "${cwd}" finished in ${Date.now() - start}ms.`);
// command succeeded
resolve();
}
Expand Down Expand Up @@ -243,6 +244,7 @@ export function tsc(
stdio: 'pipe' as IOType,
cwd: src,
};
const start = Date.now();

let script;
script = `${src}/node_modules/typescript/bin/tsc`;
Expand All @@ -266,7 +268,7 @@ export function tsc(
child?.stderr?.on('data', data => console.log(`[${new Date().toISOString()}] ${data.toString()}`));

child.on('close', code => {
console.log(`[${new Date().toISOString()}] child process exited with code ${code}`);
console.log(`[${new Date().toISOString()}] child process exited with code ${code} after ${Date.now() - start}ms.`);
code ? reject(`Exit code: ${code}`) : resolve();
});
}
Expand Down Expand Up @@ -296,6 +298,7 @@ export function buildReact(
src = src.substring(0, src.length - 1);
}
let rootDir: string | undefined;
const start = Date.now();

// Copy version number from root directory to src directory
if (options?.rootDir) {
Expand Down Expand Up @@ -379,7 +382,7 @@ export function buildReact(
child?.stderr?.on('data', data => console.log(`[${new Date().toISOString()}] ${data.toString()}`));

child.on('close', code => {
console.log(`[${new Date().toISOString()}] child process exited with code ${code}`);
console.log(`[${new Date().toISOString()}] child process exited with code ${code} after ${Date.now() - start}ms.`);
code ? reject(`Exit code: ${code}`) : resolve();
});
}
Expand Down

0 comments on commit 141fb5c

Please sign in to comment.