Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sites): clone the generated repo #4411 #4427

Merged
merged 12 commits into from
Mar 8, 2022
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ tests/integration/hugo-site/out
tests/integration/hugo-site/.hugo_build.lock
_test_out/**

# cloned templates
git-clones

11 changes: 11 additions & 0 deletions npm-shrinkwrap.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
"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",
"graphql": "^16.1.0",
Expand Down
10 changes: 10 additions & 0 deletions src/commands/sites/sites-create-template.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check

const clone = require('git-clone')
const inquirer = require('inquirer')
const pick = require('lodash/pick')
const prettyjson = require('prettyjson')
Expand Down Expand Up @@ -116,6 +117,15 @@ const sitesCreateTemplate = async (options, command) => {
name: siteName,
},
})
const { cloneConfirm } = await inquirer.prompt({
type: 'confirm',
name: 'cloneConfirm',
message: `Do you want to clone the repository? You will find it in the git-clones folder`,
default: false,
})
if (cloneConfirm) {
clone(repoResp.html_url, `git-clones/${repoResp.name}`)
erezrokah marked this conversation as resolved.
Show resolved Hide resolved
}
}
} catch (error_) {
if (error_.status === 422 || error_.message === 'Duplicate repo') {
Expand Down