Bez popisu

zhangyuhan 6ffdab3032 docs: add icon před 3 roky
src 6ffdab3032 docs: add icon před 3 roky
test 04ea1688fc feat: change packageName and add options strip před 3 roky
.gitignore eecf45d21e feat: add download-remote-project-template před 3 roky
LICENSE eecf45d21e feat: add download-remote-project-template před 3 roky
README.md 04ea1688fc feat: change packageName and add options strip před 3 roky
package.json 6ffdab3032 docs: add icon před 3 roky
tsconfig.json eecf45d21e feat: add download-remote-project-template před 3 roky
yarn.lock b80de270b5 feat: extract success remove zip před 3 roky

README.md

@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