Files
dify/e2e/scripts/prepare-external-runtime.ts
yyh 1b3e8e9943 chore(agent-v2): sync daily changes (#38298)
Signed-off-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: 盐粒 Yanli <mail@yanli.one>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: zyssyz123 <916125788@qq.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: 盐粒 Yanli <yanli@dify.ai>
Co-authored-by: 林玮 (Jade Lin) <linw1995@icloud.com>
2026-07-05 08:09:38 +00:00

39 lines
1.1 KiB
TypeScript

import { e2eDir, isMainModule, runCommandOrThrow } from './common'
import './env-register'
const defaultExternalRuntimeSeedSpecs = 'agent-v2:external-runtime'
const parseSeedSpecs = (value: string) =>
value
.split(',')
.map(entry => entry.trim())
.filter(Boolean)
.map((entry) => {
const [pack, profile = 'full'] = entry.split(':').map(part => part.trim())
if (!pack)
throw new Error(`Invalid external runtime seed spec "${entry}". Expected "pack" or "pack:profile".`)
return { pack, profile }
})
const main = async () => {
const seedSpecs = parseSeedSpecs(
process.env.E2E_EXTERNAL_RUNTIME_SEED_SPECS?.trim() || defaultExternalRuntimeSeedSpecs,
)
for (const { pack, profile } of seedSpecs) {
await runCommandOrThrow({
command: 'npx',
args: ['tsx', './scripts/seed.ts', '--pack', pack, '--profile', profile],
cwd: e2eDir,
})
}
}
if (isMainModule(import.meta.url)) {
void main().catch((error) => {
console.error(error instanceof Error ? error.message : String(error))
process.exit(1)
})
}