Skip to content

Add support for deploy without build #5943

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shauns
Copy link
Contributor

@shauns shauns commented Jun 4, 2025

Add --no-build flag to shopify app deploy command. We've had feedback that some advanced workflows would benefit from being able to skip the build step.

--

WHY are these changes introduced?

This PR adds a new flag to the shopify app deploy command that allows users to skip the build step during deployment, which can be useful in CI/CD pipelines where builds are performed separately.

WHAT is this pull request doing?

  • Adds a new --no-build flag to the shopify app deploy command
  • Implements the logic to skip building extensions when the flag is enabled
  • Adds a new copyIntoBundle method to copy pre-built files instead of rebuilding them
  • Refactors the build logic to use a common buildMode method for determining the build type

How to test your changes?

  1. Build an app with shopify app build. Use a vast range of extension types.
  2. Deploy the app with shopify app deploy --no-build
  3. Verify that the deployment succeeds without rebuilding the extensions

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

shauns commented Jun 4, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shauns shauns marked this pull request as ready for review June 4, 2025 16:30
@shauns shauns requested review from a team as code owners June 4, 2025 16:30

This comment has been minimized.

Copy link
Contributor Author

shauns commented Jun 4, 2025

/snapit

Copy link
Contributor

github-actions bot commented Jun 4, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
77.93% (-0.13% 🔻)
12491/16029
🟡 Branches
72.07% (-0.16% 🔻)
6058/8406
🟡 Functions
78.22% (+0.02% 🔼)
3275/4187
🟡 Lines
78.35% (-0.14% 🔻)
11818/15083
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / extension-instance.ts
77.32% (-7.89% 🔻)
72.92% (-8.83% 🔻)
91.07% (-1.52% 🔻)
76.67% (-8.49% 🔻)
🟡
... / utils.ts
67.74% (-0.74% 🔻)
56.6% 73.33%
67.42% (-0.77% 🔻)
🟢
... / handlers.ts
97.3% (+5.49% 🔼)
66.67% (-8.33% 🔻)
100% (+11.11% 🔼)
97.22% (+5.56% 🔼)
🔴
... / draftable-extension.ts
25.93% (-2.07% 🔻)
25%
9.09% (-2.02% 🔻)
28% (-2.43% 🔻)
🟢
... / dev-session.ts
88.05% (-0.84% 🔻)
74.32%
92.68% (-4.46% 🔻)
88.81% (-0.97% 🔻)
🟡
... / developer-platform-client.ts
69.7% (-8.08% 🔻)
68.42% (-3.01% 🔻)
80% (-3.33% 🔻)
74.07% (-7.98% 🔻)
🔴
... / app-management-client.ts
46.2% (-0.36% 🔻)
41.43%
43.69% (+0.05% 🔼)
45.05% (-0.4% 🔻)
🔴
... / partners-client.ts
25.48% (-0.47% 🔻)
30%
16.67% (-1.37% 🔻)
25.17% (-0.49% 🔻)
🟢
... / api.ts
83.65% (-1.64% 🔻)
70.77% (-2.25% 🔻)
100%
83% (-1.69% 🔻)
🟢
... / graphql.ts
100%
75% (-13.89% 🔻)
100% 100%
🟢
... / dev-server-session.ts
79.31% (-0.69% 🔻)
50% 62.5%
82.14% (-0.62% 🔻)
🟢
... / actions.ts
80% (-3.33% 🔻)
100%
80% (-3.33% 🔻)
80% (-3.33% 🔻)
🟡
... / extensionServerReducer.ts
64.1% (-2.56% 🔻)
63.64% (-4.55% 🔻)
75%
63.64% (-3.03% 🔻)

Test suite run success

2875 tests passing in 1253 suites.

Report generated by 🧪jest coverage report action from f293a1f

Copy link
Contributor

github-actions bot commented Jun 4, 2025

🫰✨ Thanks @shauns! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/cli@0.0.0-snapshot-20250604163132

Tip

If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@shauns shauns force-pushed the shauns/06-04-add_support_for_deploy_without_build branch from 6495280 to d56d98a Compare June 5, 2025 11:02
@shauns shauns force-pushed the shauns/06-04-add_support_for_deploy_without_build branch from d56d98a to f293a1f Compare June 5, 2025 11:16
Copy link
Contributor

@gonzaloriestra gonzaloriestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working perfectly 👌

})
})

test('skips building extensions if skipBuild is true', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing an expectation here to check that it doesn't build, no? Also, it's just copying files around, couldn't we avoid mocks?

I'd also add tests to check the special behavior for functions and theme extensions.

await writeFile(this.outputPath, '(()=>{})();')
const mode = this.buildMode(options)

switch (mode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

Comment on lines +394 to +396
outputDebug(`Converting WASM ${this.outputPath} to base64`)
const base64Contents = await readFile(this.outputPath, {encoding: 'base64'})
await writeFile(this.outputPath, base64Contents)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we extract this to bundleFunctionExtension? I guess we are doing the same in other place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants