diff --git a/src/commands/node/chopsticks/init.ts b/src/commands/node/chopsticks/init.ts index fc811e3b..51f4ce86 100644 --- a/src/commands/node/chopsticks/init.ts +++ b/src/commands/node/chopsticks/init.ts @@ -23,7 +23,7 @@ export class InitChopsticks extends SwankyCommand { await this.spinner.runCommand( () => copyChopsticksTemplateFile(chopsticksTemplatePath, configPath), - "Copying template files", + "Copying Chopsticks template files...", ); await this.spinner.runCommand(async () => { @@ -31,7 +31,7 @@ export class InitChopsticks extends SwankyCommand { .addChopsticks(path.resolve(projectPath, "node", "config", chopsticksConfig)) .build(); await this.storeConfig(newLocalConfig, "local"); - }, "Writing config"); + }, "Updating Swanky configuration with Chopsticks settings..."); this.log("Chopsticks config initialized successfully"); } diff --git a/src/commands/node/chopsticks/start.ts b/src/commands/node/chopsticks/start.ts index dc706d76..6b2b9af0 100644 --- a/src/commands/node/chopsticks/start.ts +++ b/src/commands/node/chopsticks/start.ts @@ -1,7 +1,7 @@ import { Flags } from "@oclif/core"; import { execaCommand } from "execa"; import { SwankyCommand } from "../../../lib/swankyCommand.js"; -import { pathExistsSync } from "fs-extra/esm"; +import { pathExists } from "fs-extra/esm"; import { ConfigError, FileError } from "../../../lib/errors.js"; import { ensureSwankyNodeInstalled } from "../../../lib/config.js"; export class StartChopsticks extends SwankyCommand { @@ -18,16 +18,18 @@ export class StartChopsticks extends SwankyCommand { ensureSwankyNodeInstalled(this.swankyConfig); - if(!this.swankyConfig.node.chopsticks && !flags.chopsticksConfigPath) { + const chopsticksConfigPath = flags.config ?? this.swankyConfig.node.chopsticks?.configPath; + + if(!chopsticksConfigPath) { throw new ConfigError("Chopsticks config not set in swanky config. Please set it in swanky config or provide the path to the chopsticks config file using --config flag."); } - if (flags.chopsticksConfigPath && !pathExistsSync(flags.chopsticksConfigPath)) { - throw new FileError(`Chopsticks config file not found at ${flags.chopsticksConfigPath}`); + if (!(await pathExists(chopsticksConfigPath))) { + throw new FileError(`Chopsticks config file not found at ${flags.config}`); } await execaCommand( - `npx @acala-network/chopsticks@latest --config=${flags.chopsticksConfigPath ?? this.swankyConfig.node.chopsticks!.configPath}`, + `npx @acala-network/chopsticks@latest --config=${chopsticksConfigPath}`, { stdio: "inherit", }