File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ const getTar = ({
30
30
user,
31
31
repo,
32
32
path = '' ,
33
- name
33
+ name,
34
+ depth = 3
34
35
} ) => {
35
36
const url = `https://codeload.github.com/${ user } /${ repo } /tar.gz/master`
36
- const cmd = `curl ${ url } | tar -xz -C ${ name } --strip=3 ${ repo } -master/${ path } `
37
+ const cmd = `curl ${ url } | tar -xz -C ${ name } --strip=${ depth } ${ repo } -master/${ path } `
37
38
exec ( cmd , { stdio : 'inherit' } )
38
39
}
39
40
@@ -51,14 +52,16 @@ const create = async (opts = {}) => {
51
52
const dirname = path . resolve ( opts . name )
52
53
const name = path . basename ( dirname )
53
54
const [ user , repo , ...paths ] = opts . template . split ( '/' )
55
+ const depth = opts . templateDepth
54
56
55
57
fs . ensureDirSync ( name )
56
58
57
59
getTar ( Object . assign ( { } , opts , {
58
60
name,
59
61
user,
60
62
repo,
61
- path : paths . join ( '/' )
63
+ path : paths . join ( '/' ) ,
64
+ depth
62
65
} ) )
63
66
64
67
const templatePkg = require (
You can’t perform that action at this time.
0 commit comments