fix netlify deploy output and uploads (#2107)
Co-authored-by: embire2 <ceo@openweb.co.za>
This commit is contained in:
@@ -395,7 +395,7 @@ export class ActionRunner {
|
||||
const buildProcess = await webcontainer.spawn('npm', ['run', 'build']);
|
||||
|
||||
let output = '';
|
||||
buildProcess.output.pipeTo(
|
||||
const outputPromise = buildProcess.output.pipeTo(
|
||||
new WritableStream({
|
||||
write(data) {
|
||||
output += data;
|
||||
@@ -404,8 +404,21 @@ export class ActionRunner {
|
||||
);
|
||||
|
||||
const exitCode = await buildProcess.exit;
|
||||
await outputPromise.catch(() => {
|
||||
// Ignore output piping errors; we still have whatever was captured
|
||||
});
|
||||
|
||||
let buildDir = '';
|
||||
|
||||
if (exitCode !== 0) {
|
||||
const buildResult = {
|
||||
path: buildDir,
|
||||
exitCode,
|
||||
output,
|
||||
};
|
||||
|
||||
this.buildOutput = buildResult;
|
||||
|
||||
// Trigger build failed alert
|
||||
this.onDeployAlert?.({
|
||||
type: 'error',
|
||||
@@ -435,8 +448,6 @@ export class ActionRunner {
|
||||
// Check for common build directories
|
||||
const commonBuildDirs = ['dist', 'build', 'out', 'output', '.next', 'public'];
|
||||
|
||||
let buildDir = '';
|
||||
|
||||
// Try to find the first existing build directory
|
||||
for (const dir of commonBuildDirs) {
|
||||
const dirPath = nodePath.join(webcontainer.workdir, dir);
|
||||
@@ -455,11 +466,15 @@ export class ActionRunner {
|
||||
buildDir = nodePath.join(webcontainer.workdir, 'dist');
|
||||
}
|
||||
|
||||
return {
|
||||
const buildResult = {
|
||||
path: buildDir,
|
||||
exitCode,
|
||||
output,
|
||||
};
|
||||
|
||||
this.buildOutput = buildResult;
|
||||
|
||||
return buildResult;
|
||||
}
|
||||
async handleSupabaseAction(action: SupabaseAction) {
|
||||
const { operation, content, filePath } = action;
|
||||
|
||||
Reference in New Issue
Block a user