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

Renames default_placement_reference extension toml property to default_placement #3897

Merged
merged 3 commits into from
May 27, 2024

Conversation

PSalmers
Copy link
Contributor

@PSalmers PSalmers commented May 14, 2024

WHY are these changes introduced?

Fixes https://github.com/Shopify/core-issues/issues/70722
Homogenizing the terminology to "placement" instead of "placement_reference" et al.

WHAT is this pull request doing?

Just renames the key used by developers. This is an unreleased feature (not yet enabled in core), so we want to get the terminology correct before release. Does not rename the values passed on to core.

How to test your changes?

The process is to have a local copy of CLI point at an spin instance, and then to deploy a locally developed ui extension on that instance.

  • use my instance "rename-default-placement-3"
SHOPIFY_CLI_1P_DEV=1 SPIN_INSTANCE=rename-default-placement-3 SHOPIFY_SERVICE_ENV=spin pnpm create @shopify/app 

In the new app directory:

SPIN_INSTANCE=rename-default-placement-3 SHOPIFY_SERVICE_ENV=spin pnpm shopify app generate extension


Configure your extension toml to include default_placement. ex:

[[extensions.targeting]]
module = "./src/Banner.tsx"
target = "purchase.checkout.block.render"
default_placement = "order_summary2"

back in your CLI directory start the server. ex:

SPIN_INSTANCE=rename-default-placement-3 SHOPIFY_SERVICE_ENV=spin pnpm shopify app dev --path /Users/johnking/src/github.com/Shopify/cli/default-placements 

deploy the app

SPIN_INSTANCE=rename-default-placement-3 SHOPIFY_SERVICE_ENV=spin pnpm shopify app deploy --path /Users/johnking/src/github.com/Shopify/cli/default-placements 

The app should deploy successfully. Or if you use an invalid value for default_placement you should get an error.

Post-release steps

n/a

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
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

Copy link
Contributor

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-management

Copy link
Contributor

github-actions bot commented May 15, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 71.83% 7127/9922
🟡 Branches 69.12% 3519/5091
🟡 Functions 71.47% 1906/2667
🟡 Lines 73.1% 6708/9177

Test suite run success

1662 tests passing in 771 suites.

Report generated by 🧪jest coverage report action from 95d5343

@PSalmers PSalmers changed the title default_placement_reference -> default_placement Renames default_placement_reference extension toml property to default_placement May 15, 2024
@PSalmers PSalmers force-pushed the ps/rename-default-placement branch from 538494c to abe3c22 Compare May 22, 2024 18:13
@PSalmers PSalmers marked this pull request as ready for review May 22, 2024 20:43

This comment has been minimized.

@@ -31,7 +31,7 @@ const NewExtensionPointSchema = zod.object({
target: zod.string(),
module: zod.string(),
metafields: zod.array(MetafieldSchema).optional(),
default_placement_reference: zod.string().optional(),
default_placement: zod.string().optional(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this already changed in core?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is separate from the core changes for which I have created an issue here https://github.com/orgs/Shopify/projects/3111/views/88?pane=issue&itemId=64006155

This PR just aliases "default_placement" in the toml to "default_placement_reference" when it passes it to the backend.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense!

Copy link
Contributor

@oluwatimio oluwatimio left a comment

Choose a reason for hiding this comment

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

Make sure to add a changeset before you ship this PR

@PSalmers PSalmers force-pushed the ps/rename-default-placement branch from 0aedc17 to 95d5343 Compare May 27, 2024 12:56
@PSalmers PSalmers added this pull request to the merge queue May 27, 2024
Merged via the queue into main with commit 1921b6b May 27, 2024
32 checks passed
@PSalmers PSalmers deleted the ps/rename-default-placement branch May 27, 2024 13:06
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.

None yet

3 participants