Rich-Harris / degit

Straightforward project scaffolding
MIT License
6.93k stars 242 forks source link

Trying to get a subdirectory in git mode with the js api #349

Open jeffpreussner opened 2 years ago

jeffpreussner commented 2 years ago

Working on a node application that pulls files from a specific directory of a monorepo. The repo is currently public but eventually would be switched to a private repo so i am planning to use git mode to allow for this. Passing the sub directory as detailed in the documentation "user/repo/subdir" doesn't work when using the emitter function with git mode enabled (tar and cli work fine). The sub directory is getting ignored and the function is cloning the entire repository. Is this a limitation of git mode?

my code:

const emitter = degit(< myuser/repo/subdir >', {
              cache: false,
              force: true,
              mode:"git",
              verbose: true
});

emitter.on('info', info => logStatus("Info", JSON.stringify(info)));
{"code":"DEST_IS_EMPTY","message":"destination directory is empty"}`
{"code":"SUCCESS",
"message":"cloned dest/path",
"repo":{
...,
...,
...,
...,
...,
...,
"subdir":"/packages/create-react-app-js",
"mode":"tar" <- mode is tar anyways?
},
"dest":"dest/path"}
nake89 commented 2 years ago

This issue has been fixed in community fork: https://github.com/tiged/tiged