From a0fa0424df99769df5c14f48ebf7fa3ae190e0ce Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:16:01 -0500 Subject: [PATCH] chore(cli): update documentation for generated files (#33421) We've moved some files around and the generated files point to the wrong place for the source of truth --- packages/aws-cdk/lib/cli/convert-to-user-input.ts | 2 +- packages/aws-cdk/lib/cli/parse-command-line-arguments.ts | 2 +- packages/aws-cdk/lib/cli/user-input.ts | 2 +- .../user-input-gen/lib/convert-to-user-input-gen.ts | 4 ++-- tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts | 4 ++-- tools/@aws-cdk/user-input-gen/lib/util.ts | 2 ++ tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts | 4 ++-- .../user-input-gen/test/convert-to-user-input-gen.test.ts | 2 +- tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts | 6 +++--- tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts | 6 +++--- 10 files changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/aws-cdk/lib/cli/convert-to-user-input.ts b/packages/aws-cdk/lib/cli/convert-to-user-input.ts index f5f454521d29f..de4ee42e69d88 100644 --- a/packages/aws-cdk/lib/cli/convert-to-user-input.ts +++ b/packages/aws-cdk/lib/cli/convert-to-user-input.ts @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------- -// GENERATED FROM packages/aws-cdk/lib/config.ts. +// GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ diff --git a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts index 927025daeaf60..6c4eae3ff34ba 100644 --- a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------- -// GENERATED FROM packages/aws-cdk/lib/config.ts. +// GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ diff --git a/packages/aws-cdk/lib/cli/user-input.ts b/packages/aws-cdk/lib/cli/user-input.ts index 04b3b27b27147..56c93df7cf64f 100644 --- a/packages/aws-cdk/lib/cli/user-input.ts +++ b/packages/aws-cdk/lib/cli/user-input.ts @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------- -// GENERATED FROM packages/aws-cdk/lib/config.ts. +// GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ diff --git a/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts b/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts index 80ed9755a44f1..b4f2c49eb0eef 100644 --- a/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts +++ b/tools/@aws-cdk/user-input-gen/lib/convert-to-user-input-gen.ts @@ -1,7 +1,7 @@ import { code, FreeFunction, Module, SelectiveModuleImport, Type, TypeScriptRenderer } from '@cdklabs/typewriter'; import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; -import { kebabToCamelCase } from './util'; +import { kebabToCamelCase, SOURCE_OF_TRUTH } from './util'; import { CliAction, CliConfig } from './yargs-types'; const CLI_ARG_NAME = 'args'; @@ -11,7 +11,7 @@ export async function renderUserInputFuncs(config: CliConfig): Promise { const scope = new Module('aws-cdk'); scope.documentation.push( '-------------------------------------------------------------------------------------------'); - scope.documentation.push('GENERATED FROM packages/aws-cdk/lib/config.ts.'); + scope.documentation.push(`GENERATED FROM ${SOURCE_OF_TRUTH}.`); scope.documentation.push('Do not edit by hand; all changes will be overwritten at build time from the config file.'); scope.documentation.push('-------------------------------------------------------------------------------------------'); diff --git a/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts b/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts index 084750b7ced41..57512fd3bffbd 100644 --- a/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts +++ b/tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts @@ -1,14 +1,14 @@ import { Module, SelectiveModuleImport, StructType, Type, TypeScriptRenderer } from '@cdklabs/typewriter'; import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; -import { kebabToCamelCase, kebabToPascal } from './util'; +import { kebabToCamelCase, kebabToPascal, SOURCE_OF_TRUTH } from './util'; import { CliConfig } from './yargs-types'; export async function renderUserInputType(config: CliConfig): Promise { const scope = new Module('aws-cdk'); scope.documentation.push( '-------------------------------------------------------------------------------------------'); - scope.documentation.push('GENERATED FROM packages/aws-cdk/lib/config.ts.'); + scope.documentation.push(`GENERATED FROM ${SOURCE_OF_TRUTH}.`); scope.documentation.push('Do not edit by hand; all changes will be overwritten at build time from the config file.'); scope.documentation.push('-------------------------------------------------------------------------------------------'); diff --git a/tools/@aws-cdk/user-input-gen/lib/util.ts b/tools/@aws-cdk/user-input-gen/lib/util.ts index babc21eb61ab0..a2c11aa818267 100644 --- a/tools/@aws-cdk/user-input-gen/lib/util.ts +++ b/tools/@aws-cdk/user-input-gen/lib/util.ts @@ -1,5 +1,7 @@ import { code, Expression } from '@cdklabs/typewriter'; +export const SOURCE_OF_TRUTH = 'packages/aws-cdk/lib/cli/cli-config.ts'; + export function lit(value: any): Expression { switch (value) { case undefined: diff --git a/tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts b/tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts index fd237a4cf7c98..2b92e34fd716a 100644 --- a/tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts +++ b/tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts @@ -1,7 +1,7 @@ import { $E, Expression, ExternalModule, FreeFunction, IScope, Module, SelectiveModuleImport, Statement, ThingSymbol, Type, TypeScriptRenderer, code, expr } from '@cdklabs/typewriter'; import { EsLintRules } from '@cdklabs/typewriter/lib/eslint-rules'; import * as prettier from 'prettier'; -import { lit } from './util'; +import { lit, SOURCE_OF_TRUTH } from './util'; import { CliConfig, CliOption, YargsOption } from './yargs-types'; // to import lodash.clonedeep properly, we would need to set esModuleInterop: true @@ -24,7 +24,7 @@ export async function renderYargs(config: CliConfig, helpers: CliHelpers): Promi const scope = new Module('aws-cdk'); scope.documentation.push( '-------------------------------------------------------------------------------------------'); - scope.documentation.push('GENERATED FROM packages/aws-cdk/lib/config.ts.'); + scope.documentation.push(`GENERATED FROM ${SOURCE_OF_TRUTH}.`); scope.documentation.push('Do not edit by hand; all changes will be overwritten at build time from the config file.'); scope.documentation.push('-------------------------------------------------------------------------------------------'); diff --git a/tools/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts b/tools/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts index 179d15294e0e2..b6b676429b0e3 100644 --- a/tools/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts +++ b/tools/@aws-cdk/user-input-gen/test/convert-to-user-input-gen.test.ts @@ -45,7 +45,7 @@ describe('render', () => { expect(await renderUserInputFuncs(config)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ diff --git a/tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts b/tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts index bf217b7a7b77e..b5566f84b6b04 100644 --- a/tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts +++ b/tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts @@ -45,7 +45,7 @@ describe('render', () => { expect(await renderUserInputType(config)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ @@ -154,7 +154,7 @@ describe('render', () => { expect(await renderUserInputType(config)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ @@ -236,7 +236,7 @@ describe('render', () => { expect(await renderUserInputType(config)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ diff --git a/tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts b/tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts index ee0e48070be83..5040c5e7ed249 100644 --- a/tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts +++ b/tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts @@ -25,7 +25,7 @@ describe('render', () => { expect(await renderYargs(config, YARGS_HELPERS)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ @@ -91,7 +91,7 @@ describe('render', () => { expect(await renderYargs(config, YARGS_HELPERS)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */ @@ -176,7 +176,7 @@ describe('render', () => { expect(await renderYargs(config, YARGS_HELPERS)).toMatchInlineSnapshot(` "// ------------------------------------------------------------------------------------------- - // GENERATED FROM packages/aws-cdk/lib/config.ts. + // GENERATED FROM packages/aws-cdk/lib/cli/cli-config.ts. // Do not edit by hand; all changes will be overwritten at build time from the config file. // ------------------------------------------------------------------------------------------- /* eslint-disable @stylistic/max-len */