Skip to content

Commit 83f5878

Browse files
committed
fix: user template branch
1 parent b41509a commit 83f5878

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@
515515
"repoURL": {
516516
"type": "string",
517517
"description": "Repo URL of the template."
518+
},
519+
"branch": {
520+
"type": "string",
521+
"description": "Branch of the template."
518522
}
519523
},
520524
"required": [
@@ -1125,4 +1129,4 @@
11251129
"uglify-js@<2.4.24": ">=2.4.24"
11261130
}
11271131
}
1128-
}
1132+
}

src/commands/Project.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const fetchUserTemplates = async (): Promise<UserProjectTemplate[]> => {
3434
name: item.name,
3535
repoURL: item.repoURL,
3636
description: item.description,
37+
branch: item.branch,
3738
} as UserProjectTemplate));
3839
return userTemplates;
3940
} catch (error) {
@@ -60,8 +61,13 @@ const fetchUserTemplate = async (template: UserProjectTemplate, path: string, pr
6061
window.showErrorMessage(`Failed to parse ${template.name} repo URL`);
6162
return;
6263
} else {
64+
6365
const { provider, owner, repo } = parsedURL;
64-
let normalizedURL = `${owner}/${repo}${template.branch ? `#${template.branch}` : ''}`;
66+
67+
let normalizedURL = `${owner}/${repo}${template.branch !== undefined ? `#${template.branch}` : ''}`;
68+
69+
console.log('template', template);
70+
console.log('normalizedURL', normalizedURL);
6571

6672
try {
6773
await downloadTemplate(normalizedURL, {
@@ -75,8 +81,6 @@ const fetchUserTemplate = async (template: UserProjectTemplate, path: string, pr
7581
window.showErrorMessage(`Failed to fetch ${template.name} template`);
7682
}
7783
}
78-
79-
8084
};
8185

8286

0 commit comments

Comments
 (0)