Skip to content

Commit

Permalink
fix: node add call triggers no prompt found for local-build-path erro… (
Browse files Browse the repository at this point in the history
#517)

Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Aug 27, 2024
1 parent d5acbe3 commit e97c37f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/commands/flags.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,17 @@ export const allFlags = [
valuesFile
]

/**
* Resets the definition.disablePrompt for all flags
*/
export function resetDisabledPrompts () {
allFlags.forEach(f => {
if (f.definition.disablePrompt) {
delete f.definition.disablePrompt
}
})
}

export const allFlagsMap = new Map(allFlags.map(f => [f.name, f]))

export const nodeConfigFileFlags = new Map([
Expand Down
4 changes: 3 additions & 1 deletion src/commands/node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,8 @@ export class NodeCommand extends BaseCommand {
// disable the prompts that we don't want to prompt the user for
prompts.disablePrompts([
flags.devMode,
flags.force
flags.force,
flags.localBuildPath
])

await prompts.execute(task, self.configManager, NodeCommand.REFRESH_FLAGS_LIST)
Expand Down Expand Up @@ -1452,6 +1453,7 @@ export class NodeCommand extends BaseCommand {
flags.endpointType,
flags.force,
flags.fstChartVersion,
flags.localBuildPath,
flags.gossipEndpoints,
flags.grpcEndpoints
])
Expand Down
2 changes: 2 additions & 0 deletions src/commands/prompts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { FullstackTestingError, IllegalArgumentError } from '../core/errors.mjs'
import { ConfigManager, constants } from '../core/index.mjs'
import * as flags from './flags.mjs'
import * as helpers from '../core/helpers.mjs'
import { resetDisabledPrompts } from './flags.mjs'

async function prompt (type, task, input, defaultValue, promptMessage, emptyCheckMessage, flagName) {
try {
Expand Down Expand Up @@ -531,6 +532,7 @@ export async function execute (task, configManager, flagList = []) {
* @param {CommandFlag[]} flags list of flags to disable prompts for
*/
export function disablePrompts (flags) {
resetDisabledPrompts()
for (const flag of flags) {
if (flag.definition) {
flag.definition.disablePrompt = true
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/commands/node-add.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Node add', () => {
flags.devMode.constName
])
await nodeCmd.accountManager.close()
}, 600000)
}, 800000)

balanceQueryShouldSucceed(nodeCmd.accountManager, nodeCmd, namespace)

Expand Down

0 comments on commit e97c37f

Please sign in to comment.