SalesforceCommerceCloud / sfcc-ci

Salesforce Commerce Cloud CLI
https://npmjs.com/package/sfcc-ci
BSD 3-Clause "New" or "Revised" License
231 stars 93 forks source link

Add SLAS `setup` command #283

Open johnboxall opened 2 years ago

johnboxall commented 2 years ago

When you're first setting up SLAS for use with PWA Kit (or another headless storefront) it might be nice if there was a fast path "setup" (or similar) command that asked you for the minimal amount of information needed to get started.

It might work something like this:

$ sfcc-ci slas:setup

> What instance will you use? (zzrf_sbx, zzrf_dev, zzrf_stg, zzrf_prd) zzrf_001
> What sites will you use? (RefArch, RefArchGlobal) RefArch
> Will you use it with PWA Kit? (Y/n) Y
> Will you use it with SFRA? (Y/n) Y
> Do you want the default shopper scopes? (Y/n)

Done. You're Client ID is aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.

Answering this way would create a tenant like this:

{
    "instance": "zzrf_001",
    "merchantName": "blank",
    "description": null,
    "contact": null,
    "emailAddress": "jboxall@salesforce.com",
    "phoneNo": null
}

And a client like this:

{
    "clientId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
    "name": "Retail React App",
    "scopes": [
      "sfcc.shopper-myaccount.baskets",
      "sfcc.shopper-baskets-orders.rw",
      "sfcc.shopper-baskets-orders",
      "sfcc.shopper-categories",
      "sfcc.shopper-customers.login",
      "sfcc.shopper-customers.register",
      "sfcc.shopper-discovery-search",
      "sfcc.shopper-gift-certificates",
      "sfcc.shopper-myaccount.addresses.rw",
      "sfcc.shopper-myaccount.addresses",
      "sfcc.shopper-myaccount.orders",
      "sfcc.shopper-myaccount.paymentinstruments.rw",
      "sfcc.shopper-myaccount.paymentinstruments",
      "sfcc.shopper-myaccount.productlists.rw",
      "sfcc.shopper-myaccount.productlists",
      "sfcc.shopper-myaccount.rw",
      "sfcc.shopper-myaccount",
      "sfcc.shopper-product-search",
      "sfcc.shopper-productlists",
      "sfcc.shopper-products",
      "sfcc.shopper-promotions"
    ],
    "redirectUri": [
      "http://127.0.0.1:3000/callback",
      "http://localhost:3000/callback",
      "https://*.mobify-storefront.com/callback",
    ],
    "channels": ["RefArch"],
    "isPrivateClient": false
  }

Where clientId is a generated UUID.

hnestmann commented 2 years ago

This is a great idea

tobiaslohr commented 2 years ago

Thanks for suggesting @johnboxall ! I like the approach for adding meaningful interactive commands like this one. Do you happen to have a PR for this at that time? 😄