Skip to content

Commit

Permalink
Merge pull request #3884 from Shopify/fix-flow-templates-dev-crash
Browse files Browse the repository at this point in the history
Only build flow template extensions during deploy
  • Loading branch information
isaacroldan authored May 10, 2024
2 parents 2787780 + 4299ad2 commit 4aa2c0b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi
return buildFunctionExtension(this, options)
} else if (this.features.includes('esbuild')) {
return buildUIExtension(this, options)
} else if (this.specification.identifier === 'flow_template') {
} else if (this.specification.identifier === 'flow_template' && options.environment === 'production') {
return buildFlowTemplateExtension(this, options)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/services/build/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function buildFlowTemplateExtension(
options: ExtensionBuildOptions,
): Promise<void> {
options.stdout.write(`Building Flow Template extension ${extension.localIdentifier}...`)
await bundleFlowTemplateExtension(extension, options)
await bundleFlowTemplateExtension(extension)
options.stdout.write(`${extension.localIdentifier} successfully built`)
}

Expand Down
7 changes: 2 additions & 5 deletions packages/app/src/cli/services/extensions/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,14 @@ export async function bundleThemeExtension(
)
}

export async function bundleFlowTemplateExtension(
extension: ExtensionInstance,
options: ExtensionBuildOptions,
): Promise<void> {
options.stdout.write(`Bundling Flow Template extension ${extension.localIdentifier}...`)
export async function bundleFlowTemplateExtension(extension: ExtensionInstance): Promise<void> {
const files = await flowTemplateExtensionFiles(extension)

await Promise.all(
files.map(function (filepath) {
const relativePathName = relativePath(extension.directory, filepath)
const outputFile = joinPath(extension.outputPath, relativePathName)
if (filepath === outputFile) return
return copyFile(filepath, outputFile)
}),
)
Expand Down

0 comments on commit 4aa2c0b

Please sign in to comment.