Skip to content

Commit 4e83ef6

Browse files
committed
Update prerelease template deps script
1 parent e6740b5 commit 4e83ef6

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ async function updateTemplate(templateName, branchName) {
2222
`cd ${templateDir} && git rev-parse --abbrev-ref HEAD`
2323
);
2424

25-
if (currentBranch !== "main") {
25+
if (currentBranch.trim() !== "main") {
2626
console.error(
27-
`Current branch is '${currentBranch}' for template '${templateName}'`
27+
`Current branch is '${currentBranch.trim()}' for template '${templateName}', exiting.`
2828
);
2929
return;
3030
}
@@ -109,11 +109,6 @@ async function execAsync(command) {
109109
}
110110

111111
async function main() {
112-
// Make a JSON request to https://app.trigger.dev/api/v1/templates and parse the response as an array of templates
113-
const templates = await fetch(
114-
"https://app.trigger.dev/api/v1/templates"
115-
).then((res) => res.json());
116-
117112
// Get the branch name from the args
118113
const branchName = process.argv[3];
119114

@@ -122,6 +117,23 @@ async function main() {
122117
process.exit(1);
123118
}
124119

120+
const templateSlug = process.argv[4];
121+
122+
if (templateSlug) {
123+
try {
124+
await updateTemplate(templateSlug, branchName);
125+
} catch (error) {
126+
console.log(`Failed to update template '${templateSlug}'`, error);
127+
}
128+
129+
return;
130+
}
131+
132+
// Make a JSON request to https://app.trigger.dev/api/v1/templates and parse the response as an array of templates
133+
const templates = await fetch(
134+
"https://app.trigger.dev/api/v1/templates"
135+
).then((res) => res.json());
136+
125137
for (const template of templates) {
126138
try {
127139
await updateTemplate(template.slug, branchName);

0 commit comments

Comments
 (0)