MCPcopy Create free account
hub / github.com/TanStack/cli / rebuild

Method rebuild

packages/cli/src/dev-watch.ts:199–432  ·  view source on GitHub ↗
(changes: Set<string>)

Source from the content-addressed store, hash-verified

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(

Callers 1

constructorMethod · 0.95

Calls 12

registerFrameworkFunction · 0.90
getFrameworkByIdFunction · 0.90
finalizeAddOnsFunction · 0.90
createAppFunction · 0.90
createUIEnvironmentFunction · 0.85
nowMethod · 0.80
testMethod · 0.80
logMethod · 0.80
errorMethod · 0.80
replaceMethod · 0.65
syncMethod · 0.65

Tested by

no test coverage detected