-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed postinstall to pipe out file
- Loading branch information
Showing
1 changed file
with
68 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,73 @@ | ||
const { spawnSync } = require("child_process"); | ||
const { spawnSync } = require('child_process'); | ||
const os = require('os'); | ||
const process = require("process"); | ||
const process = require('process'); | ||
|
||
async function postInstall() { | ||
const firstInstallOnToDesktopServers = | ||
process.env.TODESKTOP_CI && process.env.TODESKTOP_INITIAL_INSTALL_PHASE; | ||
|
||
console.log('Post Install' , os.platform()); | ||
if (!firstInstallOnToDesktopServers) return; | ||
|
||
if (os.platform() === "win32") | ||
{ | ||
// Change stdio to get back the logs if there are issues. | ||
const resultUpgradePip = spawnSync(`py`, ['-3.12', '-m', 'pip' ,'install' ,'--upgrade pip'],{shell:true,stdio: 'ignore'}).toString(); | ||
const resultInstallComfyCLI = spawnSync(`py`, ['-3.12 ','-m' ,'pip' ,'install comfy-cli'], {shell:true,stdio: 'ignore'}).toString(); | ||
console.log("Finish PIP & ComfyCLI Install"); | ||
const resultComfyManagerInstall = spawnSync('set PATH=C:\\hostedtoolcache\\windows\\Python\\3.12.7\\x64\\Scripts;%PATH% && yarn run make:assets:nvidia' ,[''],{shell:true,stdio: 'inherit'}).toString(); | ||
console.log("Finish Comfy Manager Install and Rehydration"); | ||
} | ||
|
||
if (os.platform() === "darwin") { | ||
|
||
const resultUpgradePip = spawnSync(`py`, ['-3.12', '-m', 'pip' ,'install' ,'--upgrade pip'],{shell:true,stdio: 'ignore'}).toString(); | ||
const resultInstallComfyCLI = spawnSync(`py`, ['-3.12 ','-m' ,'pip' ,'install comfy-cli'], {shell:true,stdio: 'ignore'}).toString(); | ||
const resultComfyManagerInstall = spawnSync('yarn run make:assets:macos' ,[''],{shell:true,stdio: 'inherit'}).toString(); | ||
|
||
// Do not delete, useful if there are build issues with mac | ||
// TODO: Consider making a global build log as ToDesktop logs can be hit or miss | ||
/* | ||
fs.createFileSync('./src/macpip.txt'); | ||
fs.writeFileSync('./src/macpip.txt',JSON.stringify({ | ||
log: result.stdout.toString(), | ||
err:result.stderr.toString() | ||
})); | ||
*/ | ||
console.log("Finish Python & Comfy Install for Mac"); | ||
} | ||
}; | ||
const firstInstallOnToDesktopServers = process.env.TODESKTOP_CI && process.env.TODESKTOP_INITIAL_INSTALL_PHASE; | ||
|
||
console.log('Post Install', os.platform()); | ||
if (!firstInstallOnToDesktopServers) return; | ||
|
||
if (os.platform() === 'win32') { | ||
// Change stdio to get back the logs if there are issues. | ||
const resultUpgradePip = spawnSync(`py`, ['-3.12', '-m', 'pip', 'install', '--upgrade pip'], { | ||
shell: true, | ||
stdio: 'ignore', | ||
}).toString(); | ||
const resultInstallComfyCLI = spawnSync(`py`, ['-3.12 ', '-m', 'pip', 'install comfy-cli'], { | ||
shell: true, | ||
stdio: 'ignore', | ||
}).toString(); | ||
console.log('Finish PIP & ComfyCLI Install'); | ||
const resultComfyManagerInstall = spawnSync( | ||
'set PATH=C:\\hostedtoolcache\\windows\\Python\\3.12.7\\x64\\Scripts;%PATH% && yarn run make:assets:nvidia', | ||
[''], | ||
{ shell: true, stdio: 'inherit' } | ||
).toString(); | ||
console.log('Finish Comfy Manager Install and Rehydration'); | ||
} | ||
|
||
if (os.platform() === 'darwin') { | ||
const resultUpgradePip = spawnSync(`py`, ['-3.12', '-m', 'pip', 'install', '--upgrade pip'], { | ||
shell: true, | ||
stdio: 'pipe', | ||
encoding: 'utf-8', | ||
}); | ||
const resultInstallComfyCLI = spawnSync(`py`, ['-3.12 ', '-m', 'pip', 'install comfy-cli'], { | ||
shell: true, | ||
stdio: 'pipe', | ||
encoding: 'utf-8', | ||
}); | ||
const resultComfyManagerInstall = spawnSync('yarn run make:assets:macos', [''], { | ||
shell: true, | ||
stdio: 'pipe', | ||
encoding: 'utf-8', | ||
}); | ||
|
||
// Do not delete, useful if there are build issues with mac | ||
// TODO: Consider making a global build log as ToDesktop logs can be hit or miss | ||
|
||
fs.createFileSync('./assets/macpip.json'); | ||
fs.writeFileSync( | ||
'./assets/macpip.json', | ||
JSON.stringify({ | ||
upgradeOut: { | ||
log: resultUpgradePip.stdout, | ||
err: resultUpgradePip.stderr, | ||
}, | ||
installComfOut: { | ||
log: resultInstallComfyCLI.stdout, | ||
err: resultInstallComfyCLI.stderr, | ||
}, | ||
ComfManInstallOut: { | ||
log: resultComfyManagerInstall.stdout, | ||
err: resultComfyManagerInstall.stderr, | ||
}, | ||
}) | ||
); | ||
|
||
console.log('Finish Python & Comfy Install for Mac'); | ||
} | ||
} | ||
|
||
postInstall(); |