Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update-litegraph script #1495

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}'",
Expand Down
39 changes: 39 additions & 0 deletions scripts/update-litegraph.js
Original file line number Diff line number Diff line change
@@ -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)
}
Loading