Copy templates into CLI dist folder#326
Conversation
This comment has been minimized.
This comment has been minimized.
| mv templates/demo-store-ts packages/cli/dist/templates/demo-store | ||
| mv templates/hello-world-ts packages/cli/dist/templates/hello-world |
There was a problem hiding this comment.
Only moving the TS versions because the CLI can already generate JS versions on the fly using Remix, right?
There was a problem hiding this comment.
Yep. We only really need to generate the JS versions for use in Oxygen Admin or StackBlitz
| const defaultTemplate = new URL('./dist/templates/demo-store', import.meta.url) | ||
| .pathname; |
There was a problem hiding this comment.
TIL using URL this way for local paths 💯
|
@jplhomer Random thought: perhaps can keep this binary executable in the long run instead of having it as temporary? |
| @@ -1,17 +1,20 @@ | |||
| import {resolve} from 'path'; | |||
There was a problem hiding this comment.
I don't think so, as I believe calling a bin file from NPM will likely call it as node <FILE>. Gonna be a little bit of trial and error here, though.
Our H2 CLI is kinda tricky to use today. It's an oclif plugin which is meant to be executed by
npx @shopify/hydrogenthe official CLI, which requires you to install it as a plugin (and then remember to uninstall it for localdev).It's also super clunky trying to init a template. Because our repo is not open-source, it requires a GitHub
tokenargument, and then you have to hunt down that token.Instead, as a temporary workaround, I've done the following:
distfolderAfter publishing, this means creating a new H2 app will be as easy as:
This also makes it trivial to share our progress with external parties without granting them access to our GitHub repos.
We can throw all of this code away once we're open source 👍