diff --git a/scripts/build.sh b/scripts/build.sh index 2bcfc057..347d4136 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -28,7 +28,6 @@ cd web-app yarn build cd .. -# For Windows build: switch the next 2 lines echo "Bundling webapp..." if [[ "$OSTYPE" == "msys" ]]; then # linux subsystem on windows selected diff --git a/src/services/hooks/utils/runCommands.ts b/src/services/hooks/utils/runCommands.ts index f64090dd..0593755a 100644 --- a/src/services/hooks/utils/runCommands.ts +++ b/src/services/hooks/utils/runCommands.ts @@ -11,11 +11,15 @@ const runCommands = async (commands: string[] = []): Promise => { title: command, description: 'Running process...', } + logger(`Command: ${command}`) send({ type: 'COMMAND_START', payload: { process: { ...process, status: 'RUNNING' } } }) let result: { stdout: string; stderr: string } try { result = await exec({ command }) - logger(`Command output: ${JSON.stringify(result)}`) + if (result.stderr) { + throw new Error(result.stderr) + } + logger(`Command output: ${result.stdout}`) } catch (error: any) { logger(`Command failed: ${error.message}`) send({ type: '', payload: { process: { ...process, status: 'FAIL' } } }) diff --git a/src/services/node/index.ts b/src/services/node/index.ts index 822445de..3d4a2bcc 100644 --- a/src/services/node/index.ts +++ b/src/services/node/index.ts @@ -17,24 +17,32 @@ interface ExecParams { // correct paths to be from workspace root rather than extension folder const getWorkspacePath = (...paths: string[]) => { - return join(WORKSPACE_ROOT, ...paths) + const workspacePath = join(WORKSPACE_ROOT, ...paths) + logger(`Workspace path: ${workspacePath}`) + return workspacePath } export const exec = (params: ExecParams): Promise<{ stdout: string; stderr: string }> | never => { const cwd = join(WORKSPACE_ROOT, params.dir || '') + logger(`Calling command: ${params.command}`) return asyncExec(params.command, { cwd }) } export const exists = (...paths: string[]): boolean | never => { - return fs.existsSync(getWorkspacePath(...paths)) + const filePath = getWorkspacePath(...paths) + logger(`Check file exists: ${filePath}`) + return fs.existsSync(filePath) } export const removeFile = (...paths: string[]) => { - return asyncRemoveFile(getWorkspacePath(...paths)) + const filePath = getWorkspacePath(...paths) + logger(`Removing file: ${filePath}`) + return asyncRemoveFile(filePath) } export const readFile = (...paths: string[]): Promise => { const filePath = getWorkspacePath(...paths) + logger(`Reading file: ${filePath}`) return asyncReadFile(getWorkspacePath(...paths), 'utf8').catch((err) => { logger(`Failed to read from ${filePath}: ${err.message}`) }) @@ -42,6 +50,7 @@ export const readFile = (...paths: string[]): Promise => { export const writeFile = (data: any, ...paths: string[]): Promise => { const filePath = getWorkspacePath(...paths) + logger(`Writing file: ${filePath}`) return asyncWriteFile(filePath, data).catch((err) => { logger(`Failed to write to ${filePath}: ${err.message}`) })