diff --git a/packages/aws-cdk-lib/core/test/aspect.test.ts b/packages/aws-cdk-lib/core/test/aspect.test.ts index 865f17b031dc0..3adf27d7b27a7 100644 --- a/packages/aws-cdk-lib/core/test/aspect.test.ts +++ b/packages/aws-cdk-lib/core/test/aspect.test.ts @@ -316,8 +316,11 @@ describe('aspect', () => { ])('Error is not thrown if Aspects.applied does not exist (stabilization: $stabilization)', ({ stabilization }) => { const app = new App({ context: { '@aws-cdk/core:aspectStabilization': stabilization } }); const root = new Stack(app, 'My-Stack'); + const child = new Bucket(root, 'my-bucket', { + bucketName: 'my-bucket', + }); - Aspects.of(root).add(new Tag('AspectA', 'Visited')); + Aspects.of(root).add(new Tag('AspectA', 'Visited'), { priority: 10 }); // "Monkey patching" - Override `applied` to simulate its absence Object.defineProperty(Aspects.prototype, 'applied', { diff --git a/tools/@aws-cdk/yargs-gen/lib/index.d.ts b/tools/@aws-cdk/yargs-gen/lib/index.d.ts deleted file mode 100644 index 9e1623713b0a3..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './yargs-gen'; -export * from './yargs-types'; diff --git a/tools/@aws-cdk/yargs-gen/lib/index.js b/tools/@aws-cdk/yargs-gen/lib/index.js deleted file mode 100644 index 460dd829fad47..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./yargs-gen"), exports); -__exportStar(require("./yargs-types"), exports); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsOENBQTRCO0FBQzVCLGdEQUE4QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4veWFyZ3MtZ2VuJztcbmV4cG9ydCAqIGZyb20gJy4veWFyZ3MtdHlwZXMnO1xuIl19 \ No newline at end of file diff --git a/tools/@aws-cdk/yargs-gen/lib/yargs-gen.d.ts b/tools/@aws-cdk/yargs-gen/lib/yargs-gen.d.ts deleted file mode 100644 index 306c2ac0e53ba..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/yargs-gen.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Expression, ExternalModule } from '@cdklabs/typewriter'; -import { CliConfig } from './yargs-types'; -export declare class CliHelpers extends ExternalModule { - readonly browserForPlatform: import("@cdklabs/typewriter").ExpressionProxy; - readonly cliVersion: import("@cdklabs/typewriter").ExpressionProxy; - readonly isCI: import("@cdklabs/typewriter").ExpressionProxy; - readonly yargsNegativeAlias: import("@cdklabs/typewriter").ExpressionProxy; -} -export declare function renderYargs(config: CliConfig, helpers: CliHelpers): Promise; diff --git a/tools/@aws-cdk/yargs-gen/lib/yargs-gen.js b/tools/@aws-cdk/yargs-gen/lib/yargs-gen.js deleted file mode 100644 index 13f394fcbee20..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/yargs-gen.js +++ /dev/null @@ -1,165 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CliHelpers = void 0; -exports.renderYargs = renderYargs; -const typewriter_1 = require("@cdklabs/typewriter"); -const eslint_rules_1 = require("@cdklabs/typewriter/lib/eslint-rules"); -const prettier = require("prettier"); -// to import lodash.clonedeep properly, we would need to set esModuleInterop: true -// however that setting does not work in the CLI, so we fudge it. -// eslint-disable-next-line @typescript-eslint/no-require-imports -const cloneDeep = require('lodash.clonedeep'); -class CliHelpers extends typewriter_1.ExternalModule { - constructor() { - super(...arguments); - this.browserForPlatform = makeCallableExpr(this, 'browserForPlatform'); - this.cliVersion = makeCallableExpr(this, 'cliVersion'); - this.isCI = makeCallableExpr(this, 'isCI'); - this.yargsNegativeAlias = makeCallableExpr(this, 'yargsNegativeAlias'); - } -} -exports.CliHelpers = CliHelpers; -function makeCallableExpr(scope, name) { - return (0, typewriter_1.$E)(typewriter_1.expr.sym(new typewriter_1.ThingSymbol(name, scope))); -} -async function renderYargs(config, helpers) { - const scope = new typewriter_1.Module('aws-cdk'); - scope.documentation.push('-------------------------------------------------------------------------------------------'); - scope.documentation.push('GENERATED FROM packages/aws-cdk/lib/config.ts.'); - scope.documentation.push('Do not edit by hand; all changes will be overwritten at build time from the config file.'); - scope.documentation.push('-------------------------------------------------------------------------------------------'); - scope.addImport(new typewriter_1.SelectiveModuleImport(scope, 'yargs', ['Argv'])); - helpers.import(scope, 'helpers'); - // 'https://github.com/yargs/yargs/issues/1929', - // 'https://github.com/evanw/esbuild/issues/1492', - scope.addInitialization(typewriter_1.code.comment('eslint-disable-next-line @typescript-eslint/no-require-imports')); - scope.addInitialization(typewriter_1.code.stmt.constVar(typewriter_1.code.expr.ident('yargs'), typewriter_1.code.expr.directCode("require('yargs')"))); - const parseCommandLineArguments = new typewriter_1.FreeFunction(scope, { - name: 'parseCommandLineArguments', - export: true, - returnType: typewriter_1.Type.ANY, - parameters: [ - { name: 'args', type: typewriter_1.Type.arrayOf(typewriter_1.Type.STRING) }, - ], - }); - parseCommandLineArguments.addBody(makeYargs(config, helpers)); - const ts = new typewriter_1.TypeScriptRenderer({ - disabledEsLintRules: [ - eslint_rules_1.EsLintRules.COMMA_DANGLE, - eslint_rules_1.EsLintRules.COMMA_SPACING, - eslint_rules_1.EsLintRules.MAX_LEN, - eslint_rules_1.EsLintRules.QUOTES, - eslint_rules_1.EsLintRules.QUOTE_PROPS, - ], - }).render(scope); - return prettier.format(ts, { - parser: 'typescript', - printWidth: 150, - singleQuote: true, - }); -} -// Use the following configuration for array arguments: -// -// { type: 'array', default: [], nargs: 1, requiresArg: true } -// -// The default behavior of yargs is to eat all strings following an array argument: -// -// ./prog --arg one two positional => will parse to { arg: ['one', 'two', 'positional'], _: [] } (so no positional arguments) -// ./prog --arg one two -- positional => does not help, for reasons that I can't understand. Still gets parsed incorrectly. -// -// By using the config above, every --arg will only consume one argument, so you can do the following: -// -// ./prog --arg one --arg two position => will parse to { arg: ['one', 'two'], _: ['positional'] }. -function makeYargs(config, helpers) { - let yargsExpr = typewriter_1.code.expr.ident('yargs'); - yargsExpr = yargsExpr - .callMethod('env', lit('CDK')) - .callMethod('usage', lit('Usage: cdk -a COMMAND')); - // we must compute global options first, as they are not part of an argument to a command call - yargsExpr = makeOptions(yargsExpr, config.globalOptions, helpers); - for (const command of Object.keys(config.commands)) { - const commandFacts = config.commands[command]; - const commandArg = commandFacts.arg - ? ` [${commandFacts.arg?.name}${commandFacts.arg?.variadic ? '..' : ''}]` - : ''; - const aliases = commandFacts.aliases - ? commandFacts.aliases.map((alias) => `, '${alias}${commandArg}'`) - : ''; - // must compute options before we compute the full command, because in yargs, the options are an argument to the command call. - let optionsExpr = typewriter_1.code.expr.directCode('(yargs: Argv) => yargs'); - optionsExpr = makeOptions(optionsExpr, commandFacts.options ?? {}, helpers); - const commandCallArgs = []; - if (aliases) { - commandCallArgs.push(typewriter_1.code.expr.directCode(`['${command}${commandArg}'${aliases}]`)); - } - else { - commandCallArgs.push(typewriter_1.code.expr.directCode(`'${command}${commandArg}'`)); - } - commandCallArgs.push(lit(commandFacts.description)); - if (commandFacts.options) { - commandCallArgs.push(optionsExpr); - } - yargsExpr = yargsExpr.callMethod('command', ...commandCallArgs); - } - return typewriter_1.code.stmt.ret(makeEpilogue(yargsExpr, helpers)); -} -function makeOptions(prefix, options, helpers) { - let optionsExpr = prefix; - for (const option of Object.keys(options)) { - const theOption = options[option]; - const optionProps = cloneDeep(theOption); - const optionArgs = {}; - // Array defaults - if (optionProps.type === 'array') { - optionProps.nargs = 1; - optionProps.requiresArg = true; - } - for (const optionProp of Object.keys(optionProps).filter(opt => !['negativeAlias'].includes(opt))) { - const optionValue = optionProps[optionProp]; - if (optionValue instanceof typewriter_1.Expression) { - optionArgs[optionProp] = optionValue; - } - else { - optionArgs[optionProp] = lit(optionValue); - } - } - // Register the option with yargs - optionsExpr = optionsExpr.callMethod('option', lit(option), typewriter_1.code.expr.object(optionArgs)); - // Special case for negativeAlias - // We need an additional option and a middleware: - // .option('R', { type: 'boolean', hidden: true }).middleware(yargsNegativeAlias('R', 'rollback'), true) - if (theOption.negativeAlias) { - const middleware = helpers.yargsNegativeAlias.call(lit(theOption.negativeAlias), lit(option)); - optionsExpr = optionsExpr.callMethod('option', lit(theOption.negativeAlias), typewriter_1.code.expr.lit({ - type: 'boolean', - hidden: true, - })); - optionsExpr = optionsExpr.callMethod('middleware', middleware, lit(true)); - } - } - return optionsExpr; -} -function makeEpilogue(prefix, helpers) { - let completeDefinition = prefix.callMethod('version', helpers.cliVersion()); - completeDefinition = completeDefinition.callMethod('demandCommand', lit(1), lit('')); // just print help - completeDefinition = completeDefinition.callMethod('recommendCommands'); - completeDefinition = completeDefinition.callMethod('help'); - completeDefinition = completeDefinition.callMethod('alias', lit('h'), lit('help')); - completeDefinition = completeDefinition.callMethod('epilogue', lit([ - 'If your app has a single stack, there is no need to specify the stack name', - 'If one of cdk.json or ~/.cdk.json exists, options specified there will be used as defaults. Settings in cdk.json take precedence.', - ].join('\n\n'))); - completeDefinition = completeDefinition.callMethod('parse', typewriter_1.code.expr.ident('args')); - return completeDefinition; -} -function lit(value) { - switch (value) { - case undefined: - return typewriter_1.code.expr.UNDEFINED; - case null: - return typewriter_1.code.expr.NULL; - default: - return typewriter_1.code.expr.lit(value); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieWFyZ3MtZ2VuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsieWFyZ3MtZ2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQXFCQSxrQ0F5Q0M7QUE5REQsb0RBQXdMO0FBQ3hMLHVFQUFtRTtBQUNuRSxxQ0FBcUM7QUFHckMsa0ZBQWtGO0FBQ2xGLGlFQUFpRTtBQUNqRSxpRUFBaUU7QUFDakUsTUFBTSxTQUFTLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUM7QUFFOUMsTUFBYSxVQUFXLFNBQVEsMkJBQWM7SUFBOUM7O1FBQ2tCLHVCQUFrQixHQUFHLGdCQUFnQixDQUFDLElBQUksRUFBRSxvQkFBb0IsQ0FBQyxDQUFDO1FBQ2xFLGVBQVUsR0FBRyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsWUFBWSxDQUFDLENBQUM7UUFDbEQsU0FBSSxHQUFHLGdCQUFnQixDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsQ0FBQztRQUN0Qyx1QkFBa0IsR0FBRyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsb0JBQW9CLENBQUMsQ0FBQztJQUNwRixDQUFDO0NBQUE7QUFMRCxnQ0FLQztBQUVELFNBQVMsZ0JBQWdCLENBQUMsS0FBYSxFQUFFLElBQVk7SUFDbkQsT0FBTyxJQUFBLGVBQUUsRUFBQyxpQkFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLHdCQUFXLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNwRCxDQUFDO0FBRU0sS0FBSyxVQUFVLFdBQVcsQ0FBQyxNQUFpQixFQUFFLE9BQW1CO0lBQ3RFLE1BQ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gYSBzaW5nbGUgc3RhY2ssIHRoZXJlIGlzIG5vIG5lZWQgdG8gc3BlY2lmeSB0aGUgc3RhY2sgbmFtZScsXG4gICAgJ0lmIG9uZSBvZiBjZGsuanNvbiBvciB+Ly5jZGsuanNvbiBleGlzdHMsIG9wdGlvbnMgc3BlY2lmaWVkIHRoZXJlIHdpbGwgYmUgdXNlZCBhcyBkZWZhdWx0cy4gU2V0dGluZ3MgaW4gY2RrLmpzb24gdGFrZSBwcmVjZWRlbmNlLicsXG4gIF0uam9pbignXFxuXFxuJykpKTtcblxuICBjb21wbGV0ZURlZmluaXRpb24gPSBjb21wbGV0ZURlZmluaXRpb24uY2FsbE1ldGhvZCgncGFyc2UnLCBjb2RlLmV4cHIuaWRlbnQoJ2FyZ3MnKSk7XG5cbiAgcmV0dXJuIGNvbXBsZXRlRGVmaW5pdGlvbjtcbn1cblxuZnVuY3Rpb24gbGl0KHZhbHVlOiBhbnkpOiBFeHByZXNzaW9uIHtcbiAgc3dpdGNoICh2YWx1ZSkge1xuICAgIGNhc2UgdW5kZWZpbmVkOlxuICAgICAgcmV0dXJuIGNvZGUuZXhwci5VTkRFRklORUQ7XG4gICAgY2FzZSBudWxsOlxuICAgICAgcmV0dXJuIGNvZGUuZXhwci5OVUxMO1xuICAgIGRlZmF1bHQ6XG4gICAgICByZXR1cm4gY29kZS5leHByLmxpdCh2YWx1ZSk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/tools/@aws-cdk/yargs-gen/lib/yargs-types.d.ts b/tools/@aws-cdk/yargs-gen/lib/yargs-types.d.ts deleted file mode 100644 index 501d28aac31f2..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/yargs-types.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -interface YargsCommand { - description: string; - options?: { - [optionName: string]: YargsOption; - }; - aliases?: string[]; - arg?: YargsArg; -} -interface CliAction extends YargsCommand { - options?: { - [optionName: string]: CliOption; - }; -} -interface YargsArg { - name: string; - variadic: boolean; -} -export interface YargsOption { - type: 'string' | 'array' | 'number' | 'boolean' | 'count'; - desc?: string; - default?: any; - deprecated?: boolean | string; - choices?: ReadonlyArray; - alias?: string | string[]; - conflicts?: string | readonly string[] | { - [key: string]: string | readonly string[]; - }; - nargs?: number; - requiresArg?: boolean; - hidden?: boolean; - count?: boolean; -} -export interface CliOption extends Omit { - negativeAlias?: string; -} -export interface Middleware { - callback: string; - args: string[]; - applyBeforeValidation?: boolean; -} -export interface CliConfig { - globalOptions: { - [optionName: string]: CliOption; - }; - commands: { - [commandName: string]: CliAction; - }; -} -/** - * The result of a DynamicValue call - */ -export interface DynamicResult { - dynamicType: 'parameter' | 'function'; - dynamicValue: string; -} -export {}; diff --git a/tools/@aws-cdk/yargs-gen/lib/yargs-types.js b/tools/@aws-cdk/yargs-gen/lib/yargs-types.js deleted file mode 100644 index 7300cc3e5b1b6..0000000000000 --- a/tools/@aws-cdk/yargs-gen/lib/yargs-types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieWFyZ3MtdHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ5YXJncy10eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW50ZXJmYWNlIFlhcmdzQ29tbWFuZCB7XG4gIGRlc2NyaXB0aW9uOiBzdHJpbmc7XG4gIG9wdGlvbnM/OiB7IFtvcHRpb25OYW1lOiBzdHJpbmddOiBZYXJnc09wdGlvbiB9O1xuICBhbGlhc2VzPzogc3RyaW5nW107XG4gIGFyZz86IFlhcmdzQXJnO1xufVxuXG5pbnRlcmZhY2UgQ2xpQWN0aW9uIGV4dGVuZHMgWWFyZ3NDb21tYW5kIHtcbiAgb3B0aW9ucz86IHsgW29wdGlvbk5hbWU6IHN0cmluZ106IENsaU9wdGlvb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vbiB9O1xuICBjb21tYW5kczogeyBbY29tbWFuZE5hbWU6IHN0cmluZ106IENsaUFjdGlvbiB9O1xufVxuXG4vKipcbiAqIFRoZSByZXN1bHQgb2YgYSBEeW5hbWljVmFsdWUgY2FsbFxuICovXG5leHBvcnQgaW50ZXJmYWNlIER5bmFtaWNSZXN1bHQge1xuICBkeW5hbWljVHlwZTogJ3BhcmFtZXRlcicgfCAnZnVuY3Rpb24nO1xuICBkeW5hbWljVmFsdWU6IHN0cmluZztcbn1cbiJdfQ== \ No newline at end of file diff --git a/tools/@aws-cdk/yargs-gen/test/cli.test.d.ts b/tools/@aws-cdk/yargs-gen/test/cli.test.d.ts deleted file mode 100644 index cb0ff5c3b541f..0000000000000 --- a/tools/@aws-cdk/yargs-gen/test/cli.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/tools/@aws-cdk/yargs-gen/test/cli.test.js b/tools/@aws-cdk/yargs-gen/test/cli.test.js deleted file mode 100644 index 942e5f68ea529..0000000000000 --- a/tools/@aws-cdk/yargs-gen/test/cli.test.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const typewriter_1 = require("@cdklabs/typewriter"); -const lib_1 = require("../lib"); -const YARGS_HELPERS = new lib_1.CliHelpers('./util/yargs-helpers'); -describe('render', () => { - test('can generate global options', async () => { - const config = { - globalOptions: { - one: { - type: 'string', - alias: 'o', - desc: 'text for one', - requiresArg: true, - }, - two: { type: 'number', desc: 'text for two' }, - three: { - type: 'array', - alias: 't', - desc: 'text for three', - }, - }, - commands: {}, - }; - expect(await (0, lib_1.renderYargs)(config, YARGS_HELPERS)).toMatchInlineSnapshot(` - "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. - // Do not edit by hand; all changes will be overwritten at build time from the config file. - // ------------------------------------------------------------------------------------------- - /* eslint-disable @typescript-eslint/comma-dangle, comma-spacing, max-len, quotes, quote-props */ - import { Argv } from 'yargs'; - import * as helpers from './util/yargs-helpers'; - - // @ts-ignore TS6133 - export function parseCommandLineArguments(args: Array): any { - return yargs - .env('CDK') - .usage('Usage: cdk -a COMMAND') - .option('one', { - type: 'string', - alias: 'o', - desc: 'text for one', - requiresArg: true, - }) - .option('two', { - type: 'number', - desc: 'text for two', - }) - .option('three', { - type: 'array', - alias: 't', - desc: 'text for three', - nargs: 1, - requiresArg: true, - }) - .version(helpers.cliVersion()) - .demandCommand(1, '') - .recommendCommands() - .help() - .alias('h', 'help') - .epilogue( - 'If your app has a single stack, there is no need to specify the stack name\\n\\nIf one of cdk.json or ~/.cdk.json exists, options specified there will be used as defaults. Settings in cdk.json take precedence.' - ) - .parse(args); - } // eslint-disable-next-line @typescript-eslint/no-require-imports - const yargs = require('yargs'); - " - `); - }); - test('can generate negativeAlias', async () => { - const config = { - globalOptions: {}, - commands: { - test: { - description: 'the action under test', - options: { - one: { - type: 'boolean', - alias: 'o', - desc: 'text for one', - negativeAlias: 'O', - }, - }, - }, - }, - }; - expect(await (0, lib_1.renderYargs)(config, YARGS_HELPERS)).toMatchInlineSnapshot(` - "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. - // Do not edit by hand; all changes will be overwritten at build time from the config file. - // ------------------------------------------------------------------------------------------- - /* eslint-disable @typescript-eslint/comma-dangle, comma-spacing, max-len, quotes, quote-props */ - import { Argv } from 'yargs'; - import * as helpers from './util/yargs-helpers'; - - // @ts-ignore TS6133 - export function parseCommandLineArguments(args: Array): any { - return yargs - .env('CDK') - .usage('Usage: cdk -a COMMAND') - .command('test', 'the action under test', (yargs: Argv) => - yargs - .option('one', { - type: 'boolean', - alias: 'o', - desc: 'text for one', - }) - .option('O', { type: 'boolean', hidden: true }) - .middleware(helpers.yargsNegativeAlias('O', 'one'), true) - ) - .version(helpers.cliVersion()) - .demandCommand(1, '') - .recommendCommands() - .help() - .alias('h', 'help') - .epilogue( - 'If your app has a single stack, there is no need to specify the stack name\\n\\nIf one of cdk.json or ~/.cdk.json exists, options specified there will be used as defaults. Settings in cdk.json take precedence.' - ) - .parse(args); - } // eslint-disable-next-line @typescript-eslint/no-require-imports - const yargs = require('yargs'); - " - `); - }); - test('can pass-through expression unchanged', async () => { - const config = { - globalOptions: {}, - commands: { - test: { - description: 'the action under test', - options: { - one: { - type: 'boolean', - default: (0, typewriter_1.$E)(typewriter_1.expr - .sym(new typewriter_1.ThingSymbol('banana', YARGS_HELPERS)) - .call(typewriter_1.expr.lit(1), typewriter_1.expr.lit(2), typewriter_1.expr.lit(3))), - }, - }, - }, - }, - }; - expect(await (0, lib_1.renderYargs)(config, YARGS_HELPERS)).toContain('default: helpers.banana(1, 2, 3)'); - }); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJjbGkudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG9EQUE0RDtBQUM1RCxnQ0FBNEQ7QUFFNUQsTUFBTSxhQUFhLEdBQUcsSUFBSSxnQkFBVSxDQUFDLHNCQUFzQixDQUFDLENBQUM7QUFFN0QsUUFBUSxDQUFDLFFBQVEsRUFBRSxHQUFHLEVBQUU7SUFDdEIsSUFBSSxDQUFDLDZCQUE2QixFQUFFLEtBQUssSUFBSSxFQUFFO1FBQzdDLE1BQU0sTUFBTSxHQUFjO1lBQ3hCLGFBQWEsRUFBRTtnQkFDYixHQUFHLEVBQUU7b0JBQ0gsSUFBSSxFQUFFLFFBQVE7b0JBQ2QsS0FBSyxFQUFFLEdBQUc7b0JBQ1YsSUFBSSxFQUFFLGNBQWM7b0JBQ3BCLFdBQVcsRUFBRSxJQUFJO2lCQUNsQjtnQkFDRCxHQUFHLEVBQUUsRUFBRSxJQUFJLEVBQUUsUUFBUSxFQUFFLElBQUksRUFBRSxjQUFjLEVBQUU7Z0JBQzdDLEtBQUssRUFBRTtvQ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LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAgICAgLyogZXNsaW50LWRpc2FibGUgQHR5cGVzY3JpcHQtZXNsaW50L2NvbW1hLWRhbmdsZSwgY29tbWEtc3BhY2luZywgbWF4LWxlbiwgcXVvdGVzLCBxdW90ZS1wcm9wcyAqL1xuICAgICAgaW1wb3J0IHsgQXJndiB9IGZyb20gJ3lhcmdzJztcbiAgICAgIGltcG9ydCAqIGFzIGhlbHBlcnMgZnJvbSAnLi91dGlsL3lhcmdzLWhlbHBlcnMnO1xuXG4gICAgICAvLyBAdHMtaWdub3JlIFRTNjEzM1xuICAgICAgZXhwb3J0IGZ1bmN0aW9uIHBhcnNlQ29tbWFuZExpbmVBcmd1bWVudHMoYXJnczogQXJyYXk8c3RyaW5nPik6IGFueSB7XG4gICAgICAgIHJldHVybiB5YXJnc1xuICAgICAgICAgIC5lbnYoJ0NESycpXG4gICAgICAgICAgLnVzYWdlKCdVc2FnZTogY2RrIC1hIDxjZGstYXBwPiBDT01NQU5EJylcbiAgICAgICAgICAub3B0aW9uKCdvbmUnLCB7XG4gICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgIGFsaWFzOiAnbycsXG4gICAgICAgICAgICBkZXNjOiAndGV4dCBmb3Igb25lJyxcbiAgICAgICAgICAgIHJlcXVpcmVzQXJnOiB0cnVlLFxuICAgICAgICAgIH0pXG4gICAgICAgICAgLm9wdGlvbigndHdvJywge1xuICAgICAgICAgICAgdHlwZTogJ251bWJlcicsXG4gICAgICAgICAgICBkZXNjOiAndGV4dCBmb3IgdHdvJyxcbiAgICAgICAgICB9KVxuICAgICAgICAgIC5vcHRpb24oJ3RocmVlJywge1xuICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICAgIGFsaWFzOiAndCcsXG4gICAgICAgICAgICBkZXNjOiAndGV4dCBmb3IgdGhyZWUnLFx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gfSBmcm9tICd5YXJncyc7XG4gICAgICBpbXBvcnQgKiBhcyBoZWxwZXJzIGZyb20gJy4vdXRpbC95YXJncy1oZWxwZXJzJztcblxuICAgICAgLy8gQHRzLWlnbm9yZSBUUzYxMzNcbiAgICAgIGV4cG9ydCBmdW5jdGlvbiBwYXJzZUNvbW1hbmRMaW5lQXJndW1lbnRzKGFyZ3M6IEFycmF5PHN0cmluZz4pOiBhbnkge1xuICAgICAgICByZXR1cm4geWFyZ3NcbiAgICAgICAgICAuZW52KCdDREsnKVxuICAgICAgICAgIC51c2FnZSgnVXNhZ2U6IGNkayAtYSA8Y2RrLWFwcD4gQ09NTUFORCcpXG4gICAgICAgICAgLmNvbW1hbmQoJ3Rlc3QnLCAndGhlIGFjdGlvbiB1bmRlciB0ZXN0JywgKHlhcmdzOiBBcmd2KSA9PlxuICAgICAgICAgICAgeWFyZ3NcbiAgICAgICAgICAgICAgLm9wdGlvbignb25lJywge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgICAgICBhbGlhczogJ28nLFxuICAgICAgICAgICAgICAgIGRlc2M6ICd0ZXh0IGZvciBvbmUnLFxuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAub3B0aW9uKCdPJywgeyB0eXBlOiAnYm9vbGVhbicsIGhpZGRlbjogdHJ1ZSB9KVxuICAgICAgICAgICAgICAubWlkZGxld2FyZShoZWxwZXJzLnlhcmdzTmVnYXRpdmVBbGlhcygnTycsICdvbmUnKSwgdHJ1ZSlcbiAgICAgICAgICApXG4gICAgICAgICAgLnZlcnNpb24oaGVscGVycy5jbGlWZXJzaW9uKCkpXG4gICAgICAgICAgLmRlbWFuZENvbW1hbmQoMSwgJycpXG4gICAgICAgICAgLnJlY29tbWVuZENvbW1hbmRzKClcbiAgICAgICAgICAuaGVscCgpXG4gICAgICAgICAgLmFsaWFzKCdoJywgJ2hlbHAnKVxuICAgICAgICAgIC5lcGlsb2d1ZShcbiAgICAgICA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ksIGV4cHIubGl0KDIpLCBleHByLmxpdCgzKSksXG4gICAgICAgICAgICAgICksXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgIH07XG5cbiAgICBleHBlY3QoYXdhaXQgcmVuZGVyWWFyZ3MoY29uZmlnLCBZQVJHU19IRUxQRVJTKSkudG9Db250YWluKCdkZWZhdWx0OiBoZWxwZXJzLmJhbmFuYSgxLCAyLCAzKScpO1xuICB9KTtcbn0pO1xuIl19 \ No newline at end of file