The omit-optional-deps flag of apify create registers no-optional as an alias (src/commands/create.ts):
'omit-optional-deps': Flags.boolean({
aliases: ['no-optional'],
...
}),
But the command parser runs node:util parseArgs with allowNegative: true, which rewrites --no-optional into a negation of optional before alias matching happens:
parseArgs({ args: ['--no-optional'], options: { 'omit-optional-deps': {...}, 'no-optional': {...} }, allowNegative: true })
// => { values: { optional: [false] } }
optional matches neither omit-optional-deps nor the no-optional alias in _parseFlags, so omitOptionalDeps stays undefined — --no-optional is accepted without error and optional dependencies get installed anyway. --omit-optional-deps works fine.
Likely broken since the migration from yargs to node:util parseArgs (yargs treated --no-optional as the literal alias). Possible fixes: rename the alias to something without the no- prefix, special-case negation-shadowed aliases in the parser, or drop the alias.
Found while working on #1345.
The
omit-optional-depsflag ofapify createregistersno-optionalas an alias (src/commands/create.ts):But the command parser runs
node:utilparseArgswithallowNegative: true, which rewrites--no-optionalinto a negation ofoptionalbefore alias matching happens:optionalmatches neitheromit-optional-depsnor theno-optionalalias in_parseFlags, soomitOptionalDepsstaysundefined—--no-optionalis accepted without error and optional dependencies get installed anyway.--omit-optional-depsworks fine.Likely broken since the migration from yargs to
node:utilparseArgs(yargs treated--no-optionalas the literal alias). Possible fixes: rename the alias to something without theno-prefix, special-case negation-shadowed aliases in the parser, or drop the alias.Found while working on #1345.