Skip to content

Commit

Permalink
tar-subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangnanscu committed Feb 14, 2024
1 parent 600829a commit f1fc890
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xiangnanscu/degit",
"version": "2.20.0",
"version": "2.21.0",
"engines": {
"node": ">=8.0.0"
},
Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,16 @@ class Degit extends EventEmitter {

mkdirp(dest);
await untar(file, dest, subdir);
await this.gitStuff(dest)
}

async _cloneWithGit(dir, dest) {
await exec(`git clone ${this.repo.ssh} ${dest}`);
await exec(`rm -rf ${path.resolve(dest, ".git")}`);
await this.gitStuff(dest)
}

async gitStuff(dest) {
if (this.github && getGhConfig()) {
const repo_name = dest === '.' ? path.basename(path.resolve(dest)): dest
await exec(`cd ${dest} && \
Expand All @@ -321,7 +326,7 @@ git push --set-upstream origin master`)
} else if (this.git) {
await exec(`git init ${dest}`)
}
}
}
}

const supported = new Set(["github", "gitlab", "bitbucket", "git.sr.ht"]);
Expand Down

0 comments on commit f1fc890

Please sign in to comment.