-
Notifications
You must be signed in to change notification settings - Fork 29
/
start.ts
39 lines (34 loc) · 1.12 KB
/
start.ts
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
39
import { SwankyCommand } from "../../lib/swankyCommand.js";
import path from "node:path";
import { pathExistsSync } from "fs-extra/esm";
import { execaCommand } from "execa";
import { Flags } from "@oclif/core";
export class StartZombienet extends SwankyCommand<typeof StartZombienet> {
static description = "Start Zombienet";
static flags = {
"config-path": Flags.string({
char: "c",
required: false,
default: "./zombienet/config/zombienet.config.toml",
description: "Path to zombienet config",
}),
};
async run(): Promise<void> {
const { flags } = await this.parse(StartZombienet);
const projectPath = path.resolve();
const binPath = path.resolve(projectPath, "zombienet", "bin");
if (!pathExistsSync(path.resolve(binPath, "zombienet"))) {
this.error("Zombienet has not initialized. Run `swanky zombienet:init` first");
}
await execaCommand(
`./zombienet/bin/zombienet \
spawn --provider native \
${flags["config-path"]}
`,
{
stdio: "inherit",
}
);
this.log("ZombieNet started successfully");
}
}