@jianyu/dl-template download-remote-project-template
Install
# set register
nrm use xxx
# install
yarn add @jianyu/dl-template
Examples
import DownloadRemoteProjectTemplate from '@jianyu/dl-template'
const dl = new DownloadRemoteProjectTemplate()
dl.get({
repository: 'gitlab:efe/template',
destinationFolder: './template-dir'
}).then(() => {
console.log('create template success')
})
DiyLinks Examples
import DownloadRemoteProjectTemplate from '@jianyu/dl-template'
const dl = new DownloadRemoteProjectTemplate({
getTransformLinks: (params: FormatParams) => {
let url = ''
switch (params.type) {
case 'gitlab-jh': {
url = `http://xxxxxx/${params.group}/${params.name}/-/archive/${params.checkout}/${params.name}-${params.checkout}.zip`
if (params.path) {
url += `?path=${params.path}`
}
break
}
}
return url
}
})
dl.get({
repository: 'gitlab-jh:efe/template',
destinationFolder: './template-dir'
}).then(() => {
console.log('create template success')
})
Hooks
option |
params |
describe |
default |
getOptions |
/ |
Get node-downloader-helper options |
() => { fileName: 'git-repo-code.zip' } |
getTransformLinks |
params: FormatParams |
Get URL according to the parameters |
(params) => '' |
doFilterFiles |
file: File |
Get decompress filter |
(file) => true |
Thank links