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

Extract common bundling functions for dev and deploy #5580

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

Conversation

gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Mar 28, 2025

WHY are these changes introduced?

Small refactor required for #5581

WHAT is this pull request doing?

Extract some common functions for dev and deploy to write the manifest and compress the bundle.

How to test your changes?

Dev and deploy

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
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

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

Copy link
Contributor Author

gonzaloriestra commented Mar 28, 2025

@gonzaloriestra gonzaloriestra marked this pull request as ready for review March 28, 2025 13:42
@gonzaloriestra gonzaloriestra requested a review from a team as a code owner March 28, 2025 13:42
Copy link
Contributor

We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.

@gonzaloriestra gonzaloriestra force-pushed the 03-28-extract_common_bundling_functions_for_dev_and_deploy branch from f957c43 to 6a9949f Compare March 28, 2025 13:53
Comment on lines +7 to +16
export async function writeManifestToBundle(app: AppInterface, bundlePath: string) {
const appManifest = await app.manifest()
const manifestPath = joinPath(bundlePath, 'manifest.json')
await writeFile(manifestPath, JSON.stringify(appManifest, null, 2))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth doing this now? because with incremental-dev we are going to have different ways to build the manifest for dev and deploy, and it won't be included in the zip file during dev 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if we send the manifest instead of the app? So that we can send different manifests

Copy link
Contributor

Choose a reason for hiding this comment

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

But we don't want to write the manifest to a file for the dev case right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aren't we going to do the same in both places? I don't think it's a good idea to keep two different bundle structures.

@gonzaloriestra gonzaloriestra force-pushed the 03-28-extract_common_bundling_functions_for_dev_and_deploy branch from 6a9949f to d4e959f Compare March 28, 2025 15:10
Copy link
Contributor

github-actions bot commented Mar 28, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
76.58% (-0.03% 🔻)
9399/12274
🟡 Branches
71.73% (-0.05% 🔻)
4607/6423
🟡 Functions
76.33% (-0.05% 🔻)
2441/3198
🟡 Lines
77.1% (-0.01% 🔻)
8887/11526
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / bundle.ts
78.57% 75% 80% 84.62%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app.ts
87.5%
70.33% (-1.1% 🔻)
92.98% 90.21%
🟢
... / extension-instance.ts
84.52% (-0.6% 🔻)
80.16% (-2.38% 🔻)
92.45% 85.06%
🟢
... / flow_action.ts
90% (-10% 🔻)
100%
75% (-25% 🔻)
90% (-10% 🔻)
🟢
... / dev-session.ts
81.45% (-0.99% 🔻)
64.52%
90% (-0.63% 🔻)
83.78% (-0.96% 🔻)
🟢
... / serialize-fields.ts
95% (-2.5% 🔻)
87.5% (-3.13% 🔻)
100% 97.44%
🔴
... / partners.ts
58.62% (-12.21% 🔻)
50% (-25% 🔻)
57.14%
57.14% (-12.42% 🔻)

Test suite run success

2171 tests passing in 953 suites.

Report generated by 🧪jest coverage report action from 02407e7

@gonzaloriestra gonzaloriestra force-pushed the 03-28-extract_common_bundling_functions_for_dev_and_deploy branch from d4e959f to 02407e7 Compare March 31, 2025 09:42
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/api/partners.d.ts
@@ -1,6 +1,6 @@
 import { GraphQLVariables, GraphQLResponse, CacheOptions } from './graphql.js';
-import { TypedDocumentNode } from '@graphql-typed-document-node/core';
 import { Variables } from 'graphql-request';
+import { TypedDocumentNode } from '@graphql-typed-document-node/core';
 /**
  * Executes a GraphQL query against the Partners API.
  *

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