diff --git a/scripts/releaseTemplateDependencies.js b/scripts/prereleaseTemplateDependencies.js similarity index 90% rename from scripts/releaseTemplateDependencies.js rename to scripts/prereleaseTemplateDependencies.js index 83f3b3e92..5d1246f8e 100644 --- a/scripts/releaseTemplateDependencies.js +++ b/scripts/prereleaseTemplateDependencies.js @@ -22,9 +22,9 @@ async function updateTemplate(templateName, branchName) { `cd ${templateDir} && git rev-parse --abbrev-ref HEAD` ); - if (currentBranch !== "main") { + if (currentBranch.trim() !== "main") { console.error( - `Current branch is '${currentBranch}' for template '${templateName}'` + `Current branch is '${currentBranch.trim()}' for template '${templateName}', exiting.` ); return; } @@ -109,11 +109,6 @@ async function execAsync(command) { } async function main() { - // Make a JSON request to https://app.trigger.dev/api/v1/templates and parse the response as an array of templates - const templates = await fetch( - "https://app.trigger.dev/api/v1/templates" - ).then((res) => res.json()); - // Get the branch name from the args const branchName = process.argv[3]; @@ -122,6 +117,23 @@ async function main() { process.exit(1); } + const templateSlug = process.argv[4]; + + if (templateSlug) { + try { + await updateTemplate(templateSlug, branchName); + } catch (error) { + console.log(`Failed to update template '${templateSlug}'`, error); + } + + return; + } + + // Make a JSON request to https://app.trigger.dev/api/v1/templates and parse the response as an array of templates + const templates = await fetch( + "https://app.trigger.dev/api/v1/templates" + ).then((res) => res.json()); + for (const template of templates) { try { await updateTemplate(template.slug, branchName);