From 8b84495b70174d49f5867ceedcd44e65a443ece1 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sun, 10 Nov 2024 10:12:11 -0500 Subject: [PATCH 1/2] Add update script --- package.json | 1 + scripts/update-litegraph.js | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 scripts/update-litegraph.js diff --git a/package.json b/package.json index b1b11e4cf..a318a36dd 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "build": "npm run typecheck && vite build", "deploy": "npm run build && node scripts/deploy.js", "release": "node scripts/release.js", + "update-litegraph": "node scripts/update-litegraph.js", "zipdist": "node scripts/zipdist.js", "typecheck": "tsc --noEmit && tsc-strict", "format": "prettier --write './**/*.{js,ts,tsx,vue}'", diff --git a/scripts/update-litegraph.js b/scripts/update-litegraph.js new file mode 100644 index 000000000..93af9af2c --- /dev/null +++ b/scripts/update-litegraph.js @@ -0,0 +1,39 @@ +import { execSync } from 'child_process' +import { readFileSync } from 'fs' + +try { + // Create a new branch + console.log('Creating new branch...') + const date = new Date().toISOString().split('T')[0] + const timestamp = new Date().getTime() + const branchName = `update-litegraph-${date}-${timestamp}` + execSync(`git checkout -b ${branchName} -t origin/main`, { stdio: 'inherit' }) + + // Update litegraph + console.log('Updating litegraph...') + execSync('npm install @comfyorg/litegraph@latest', { stdio: 'inherit' }) + + // Get the new version from package.json + const packageLock = JSON.parse(readFileSync('./package-lock.json', 'utf8')) + const newVersion = + packageLock.packages['node_modules/@comfyorg/litegraph'].version + + // Stage changes + execSync('git add package.json package-lock.json', { stdio: 'inherit' }) + execSync('git commit -m "chore: update litegraph to ' + newVersion + '"', { + stdio: 'inherit' + }) + + // Create the PR + console.log('Creating PR...') + execSync( + `gh pr create --title "Update litegraph ${newVersion}" --label "Dependencies" --body "Automated update of litegraph to version ${newVersion}"`, + { stdio: 'inherit' } + ) + + console.log( + `✅ Successfully created PR for litegraph update to ${newVersion}` + ) +} catch (error) { + console.error('❌ Error during update process:', error.message) +} From 4d44fda62db0fa30fb534d175fcf92ed15c5293d Mon Sep 17 00:00:00 2001 From: huchenlei Date: Sun, 10 Nov 2024 10:15:02 -0500 Subject: [PATCH 2/2] nit --- scripts/update-litegraph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-litegraph.js b/scripts/update-litegraph.js index 93af9af2c..4e2612435 100644 --- a/scripts/update-litegraph.js +++ b/scripts/update-litegraph.js @@ -27,7 +27,7 @@ try { // Create the PR console.log('Creating PR...') execSync( - `gh pr create --title "Update litegraph ${newVersion}" --label "Dependencies" --body "Automated update of litegraph to version ${newVersion}"`, + `gh pr create --title "Update litegraph ${newVersion}" --label "dependencies" --body "Automated update of litegraph to version ${newVersion}"`, { stdio: 'inherit' } )