Skip to content

Commit

Permalink
fix: make git clone work in sites:create-template (#4772)
Browse files Browse the repository at this point in the history
`git_url` from the github api contains the plaintext git:// url which
github itself does not support anymore. Instead use the `clone_url`

Also switch to use `execa` instead of `git-clone` to save on dependency
  • Loading branch information
danez committed Jul 6, 2022
1 parent 21a5d0c commit 74527f4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
11 changes: 0 additions & 11 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -258,7 +258,6 @@
"fuzzy": "^0.1.3",
"get-port": "^5.1.0",
"gh-release-fetch": "^3.0.0",
"git-clone": "^0.2.0",
"git-repo-info": "^2.1.0",
"gitconfiglocal": "^2.1.0",
"hasbin": "^1.2.3",
Expand Down
5 changes: 2 additions & 3 deletions src/commands/sites/sites-create-template.js
@@ -1,12 +1,11 @@
// @ts-check

const clone = require('git-clone/promise')
const inquirer = require('inquirer')
const pick = require('lodash/pick')
const parseGitHubUrl = require('parse-github-url')
const prettyjson = require('prettyjson')

const { chalk, error, getRepoData, getTerminalLink, log, logJson, track, warn } = require('../../utils')
const { chalk, error, execa, getRepoData, getTerminalLink, log, logJson, track, warn } = require('../../utils')
const { configureRepo } = require('../../utils/init/config')
const { getGitHubToken } = require('../../utils/init/config-github')
const { createRepo, getTemplatesFromGitHub, validateTemplate } = require('../../utils/sites/utils')
Expand Down Expand Up @@ -190,7 +189,7 @@ const sitesCreateTemplate = async (repository, options, command) => {
})
if (cloneConfirm) {
log()
await clone(repoResp.git_url, `${repoResp.name}`)
await execa('git', ['clone', repoResp.clone_url, `${repoResp.name}`])
log(`🚀 Repository cloned successfully. You can find it under the ${chalk.magenta(repoResp.name)} folder`)
}

Expand Down

1 comment on commit 74527f4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 227 MB

Please sign in to comment.