cli icon indicating copy to clipboard operation
cli copied to clipboard

Renames default_placement_reference extension toml property to default_placement

Open PSalmers opened this issue 1 year ago • 2 comments

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.

  • checkout-ui-extension-dev is a good constellation to use.
  • On the instance in the shopify repo run the following
bin/rails dev:betas:enable SHOP_ID=<id of developer store you want to put extension on> BETA=checkout_one_editor_next,checkout_branding_settings_api,force_checkout_one,force_checkout_branding_api,checkout_one_merchant_rollout_controls,checkout_one_osp_extensibility,plus_staff_demo_branding_enabled,checkout_one_typ_merchant_rollout_controls,checkout_one_typ_osp_upgrade_revert_experience,customer_account_checkout_ui_extensions,checkout_one_osp_extensibility,checkout_one_editor_next,force_checkout_one,customer_account_checkout_ui_extensions,gsd36857
  • Also enable the app flag enable_ui_extension_default_placement_references
  • your local CLI branch should be ps/rename-default-placement

Scaffold a new app ui extension using the CLI,

SHOPIFY_CLI_1P_DEV=1 SPIN_INSTANCE={instance name} SHOPIFY_SERVICE_ENV=spin pnpm create @shopify/app 

In the new app directory:

SPIN_INSTANCE={instance name) 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={instance name} SHOPIFY_SERVICE_ENV=spin pnpm shopify app dev --path /Users/johnking/src/github.com/Shopify/cli/default-placements 

deploy the app

SPIN_INSTANCE={instance name} SHOPIFY_SERVICE_ENV=spin pnpm shopify app deploy --path /Users/johnking/src/github.com/Shopify/cli/default-placements 

The app should deploy successfully.

Post-release steps

n/a

Measuring impact

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

  • [x] 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

  • [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • [x] I've considered possible documentation changes
  • [x] I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

PSalmers avatar May 14 '24 23:05 PSalmers

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

github-actions[bot] avatar May 14 '24 23:05 github-actions[bot]

Coverage report

St.:grey_question:
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 95d53438742bc67c4e03f26032e8fb87daf0430d

github-actions[bot] avatar May 15 '24 00:05 github-actions[bot]

We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** 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.

github-actions[bot] avatar May 22 '24 20:05 github-actions[bot]