(changes: Set<string>)
| 197 | } |
| 198 | |
| 199 | private async rebuild(changes: Set<string>): Promise<void> { |
| 200 | if (this.isBuilding) { |
| 201 | this.log.warning('Build already in progress, skipping...') |
| 202 | return |
| 203 | } |
| 204 | |
| 205 | this.isBuilding = true |
| 206 | this.buildCount++ |
| 207 | const buildId = this.buildCount |
| 208 | |
| 209 | try { |
| 210 | this.log.section(`build #${buildId}`) |
| 211 | const startTime = Date.now() |
| 212 | |
| 213 | let refreshedFramework: FrameworkDefinition | null | undefined = |
| 214 | this.createFrameworkDefinitionFromWatchPath() |
| 215 | |
| 216 | if (!refreshedFramework && this.options.frameworkDefinitionInitializers) { |
| 217 | const refreshedFrameworks = |
| 218 | this.options.frameworkDefinitionInitializers.map( |
| 219 | (frameworkInitalizer) => frameworkInitalizer(), |
| 220 | ) |
| 221 | |
| 222 | refreshedFramework = refreshedFrameworks.find( |
| 223 | (f) => f.id === this.options.framework.id, |
| 224 | ) |
| 225 | } |
| 226 | |
| 227 | if (!refreshedFramework) { |
| 228 | throw new Error( |
| 229 | 'Could not refresh framework from watch path or framework initializers', |
| 230 | ) |
| 231 | } |
| 232 | |
| 233 | // Update the chosen addons to use the latest code |
| 234 | const chosenAddonIds = this.options.cliOptions.chosenAddOns.map( |
| 235 | (m) => m.id, |
| 236 | ) |
| 237 | // Create temp directory for this build using tempy |
| 238 | this.tempDir = temporaryDirectory() |
| 239 | |
| 240 | // Register the scanned framework |
| 241 | registerFramework({ |
| 242 | ...refreshedFramework, |
| 243 | id: `${refreshedFramework.id}-updated`, |
| 244 | }) |
| 245 | |
| 246 | // Get the registered framework |
| 247 | const registeredFramework = getFrameworkById( |
| 248 | `${refreshedFramework.id}-updated`, |
| 249 | ) |
| 250 | if (!registeredFramework) { |
| 251 | throw new Error( |
| 252 | `Failed to register framework: ${this.options.framework.id}`, |
| 253 | ) |
| 254 | } |
| 255 | |
| 256 | const updatedChosenAddons = await finalizeAddOns( |
no test coverage detected