File size: 1,186 Bytes
654654e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
const { spawnSync } = require('child_process')
const { existsSync, writeFileSync } = require('fs')
const SESSION_ID = 'levanter_177e8a2538e2a94654a118869b3d60927d' // Edit this line only, don't remove ' <- this symbol
if (!existsSync('levanter')) {
console.log('Cloning the repository...')
const cloneResult = spawnSync(
'git',
['clone', 'https://github.com/lyfe00011/levanter.git', 'levanter'],
{
stdio: 'inherit',
}
)
if (cloneResult.error) {
throw new Error(`Failed to clone the repository: ${cloneResult.error.message}`)
}
const configPath = 'levanter/config.env'
try {
console.log('Writing to config.env...')
writeFileSync(configPath, `VPS=true\nSESSION_ID=${SESSION_ID}`)
} catch (err) {
throw new Error(`Failed to write to config.env: ${err.message}`)
}
console.log('Installing dependencies...')
const installResult = spawnSync('yarn', ['install', '--network-concurrency', '3'], {
cwd: 'levanter',
stdio: 'inherit',
})
if (installResult.error) {
throw new Error(`Failed to install dependencies: ${installResult.error.message}`)
}
}
spawnSync('node', ['.'], { cwd: 'levanter', stdio: 'inherit' }) |