Skip to content

Commit

Permalink
fix: fix type for downloadTemplate to return template info params
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 10, 2022
1 parent 9e1a34a commit 24e34d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/giget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { resolve, dirname } from 'pathe'
import { download, debug } from './_utils'
import { providers } from './providers'
import { registryProvider } from './registry'
import type { TemplateProvider } from './types'
import type { TemplateInfo, TemplateProvider } from './types'

export interface DownloadTemplateOptions {
provider?: string
Expand All @@ -22,7 +22,9 @@ export interface DownloadTemplateOptions {

const sourceProtoRe = /^([\w-.]+):/

export async function downloadTemplate (input: string, opts: DownloadTemplateOptions = {}) {
export type DownloadTemplateResult = Omit<TemplateInfo, 'dir' | 'source'> & { dir: string, source: string }

export async function downloadTemplate (input: string, opts: DownloadTemplateOptions = {}): Promise<DownloadTemplateResult> {
const registry = opts.registry !== false ? registryProvider(opts.registry) : null
let providerName: string = opts.provider || (registryProvider ? 'registry' : 'github')
let source: string = input
Expand Down

0 comments on commit 24e34d4

Please sign in to comment.