Support Projects-compatible theme boilerplate#632
Conversation
packages/cli-lib/projects.js
Outdated
| if (releaseType === GITHUB_RELEASE_TYPES.REPOSITORY) { | ||
| logger.log(`Fetching ${releaseType} with name ${repoName}...`); | ||
| zipUrl = `https://api.github.com/repos/HubSpot/${repoName}/zipball`; | ||
| zipUrl = `https://api.github.com/repos/HubSpot/${repoName}/zipball/${ref}`; |
There was a problem hiding this comment.
The github api supports passing in a branch name to specify which branch to download (it defaults to "main" or "master" I think). That means we won't be using any sort of published release when we download the project-compatible version of the boilerplate. Whatever is currently in that branch will get downloaded.
The alternative route is to create a separate repo for the project-compatible version of the boilerplate, with its own release. IMO downloading the branch should be okay, but I figured I should still mention the alternative.
There was a problem hiding this comment.
I think we should account for ref = undefined when building this string. Otherwise, you get a 404 running hs create api-sample.
Otherwise, I think this approach works!
There was a problem hiding this comment.
I was looking more into this, and realized there's another option. We could tag the latest commit in the boilerplate branch (w/out linking it to a new release), and then the CLI would download that specific tagged commit. I still think what we have in place now is totally fine since it will be easier to iterate on the boilerplate project. Maybe down the road we could update the flow to use a tagged commit if we're running into issues.
| }; | ||
|
|
||
| const getProjectConfig = async _dir => { | ||
| const getIsInProject = async _dir => { |
anthmatic
left a comment
There was a problem hiding this comment.
Code lgtm and tested old v. new flow, works good!
Description and Context
Relevant cms-theme-boilerplate branch: HubSpot/cms-theme-boilerplate#404
This updates the
hs create website-themecommand to dynamically download the Projects-compatible version of the theme boilerplate repo if the destination folder is within a Project.I also added a
getIsInProjectutil because I think that will be useful to have.Screenshots
TODO
Who to Notify
cc/ @jasonnrosa