Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable] Only build flow template extensions during deploy #3885

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-fans-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': patch
---

Fix issue when dev'ing flow extensions
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