prismicio / prismic-cli

Prismic command line tool
40 stars 14 forks source link

[RFC] Automatically add users to an SM Repo #63

Closed phillysnow closed 3 years ago

phillysnow commented 4 years ago

Can we update the CLI so that users are automatically added to the correct cluster so that we can use prismic theme with SM?

arnaudlewis commented 4 years ago

To create a new project on the right cluster with the theme command, we need to add a property: appCtx in the theme command. In https://github.com/prismicio/prismic-cli/blob/master/lib/commands/index.js: Inside the context of the theme command:

context: {
  appCtx: 'slicemachine'
}

And then we need to figure out how to replace the different endpoints in a slicemachine project. The theme command wasn't meant for that in the beginning.

phillysnow commented 4 years ago

@arnaudlewis we would use --conf sm.json to replace that endpoint and import the endpoint in to the nuxt.config from there, no?

arnaudlewis commented 4 years ago

yes if we can, that would be perfect

samlfair commented 4 years ago

@arnaudlewis On this branch, --conf sm.json now seems to be working:

https://github.com/samlfair/nuxtjs-website/tree/smjson

The Prismic endpoint in nuxt.config.js points to sm.json, and the theme command updates the endpoint in sm.json just fine. The repo still doesn’t get put on the right cluster, but when I moved my repo to a SM cluster in Manage V2, prismic sm --create-slice worked.

To test it out:

prismic theme --theme-url https://github.com/samlfair/nuxtjs-website/archive/smjson.zip --conf sm.json
arnaudlewis commented 4 years ago

yes @samlfair, someone from the dev team needs to add the line of code I specified in my first comment, but it's inside the CLI.

phillysnow commented 3 years ago

This is done on the latest beta of the CLI.