-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
183 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"no-use-before-define": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { Box } from 'ink'; | ||
import { Header } from '@boost/cli'; | ||
import BuildList from './BuildList'; | ||
import Packemon from '../Packemon'; | ||
import Build from '../Build'; | ||
|
||
export interface BuildPhaseProps { | ||
packemon: Packemon; | ||
onBuilt: () => void; | ||
} | ||
|
||
export default function BuildPhase({ packemon, onBuilt }: BuildPhaseProps) { | ||
const [errors, setErrors] = useState<Error[]>([]); | ||
|
||
// Start building packages on mount | ||
useEffect(() => { | ||
void packemon.build().then((result) => { | ||
setTimeout(() => { | ||
if (result.errors.length > 0) { | ||
setErrors(result.errors); | ||
} else { | ||
onBuilt(); | ||
} | ||
}, 1000); | ||
}); | ||
}, [packemon, onBuilt]); | ||
|
||
// Update and sort build list states | ||
const pendingBuilds: Build[] = []; | ||
const runningBuilds: Build[] = []; | ||
|
||
packemon.builds.forEach((build) => { | ||
if (build.status === 'building') { | ||
runningBuilds.push(build); | ||
} else if (build.status === 'pending') { | ||
pendingBuilds.push(build); | ||
} | ||
}); | ||
|
||
// Bubble up errors to the main application | ||
if (errors.length > 0) { | ||
throw errors[0]; | ||
} | ||
|
||
// Phase label | ||
let label = `Building ${runningBuilds.length} packages`; | ||
|
||
if (pendingBuilds.length > 0) { | ||
label += ` (${pendingBuilds.length} pending)`; | ||
} | ||
|
||
return ( | ||
<Box flexDirection="column"> | ||
<Header label={label} /> | ||
<BuildList builds={runningBuilds} /> | ||
</Box> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.