Skip to content

Commit

Permalink
fix: fix provider regex matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 9, 2022
1 parent ce75c25 commit 3353d02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"giget": "jiti ./src/cli.ts",
"lint": "eslint --ext .ts,.js,.mjs,.cjs .",
"prepack": "unbuild",
"play": "DEBUG=1 pnpm giget unjs/template .tmp/clone --force-clean",
"play": "DEBUG=1 pnpm giget gh:unjs/template .tmp/clone --force-clean",
"release": "pnpm test && standard-version && git push --follow-tags && pnpm publish",
"test": "pnpm lint && vitest run --coverage"
},
Expand Down
4 changes: 2 additions & 2 deletions src/giget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface DownloadTemplateOptions {
registry?: false | string
}

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

export async function downloadTemplate (input: string, opts: DownloadTemplateOptions = {}) {
const registryProvider = opts.registry !== false ? createRegistryProvider(opts.registry) : null
Expand All @@ -35,7 +35,7 @@ export async function downloadTemplate (input: string, opts: DownloadTemplateOpt
if (!provider) {
throw new Error(`Unsupported provider: ${providerName}`)
}
const template = await provider(source).catch((err) => {
const template = await Promise.resolve().then(() => provider(source)).catch((err) => {
throw new Error(`Failed to download template from ${providerName}: ${err.message}`)
})
template.name = template.name.replace(/[^a-zA-Z0-9-]/g, '-')
Expand Down

0 comments on commit 3353d02

Please sign in to comment.