Skip to content

Commit

Permalink
chore(cli): update documentation for generated files (#33421)
Browse files Browse the repository at this point in the history
We've moved some files around and the generated files point to the wrong place for the source of truth
  • Loading branch information
kaizencc authored Feb 12, 2025
1 parent ccd5f38 commit a0fa042
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cli/convert-to-user-input.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cli/parse-command-line-arguments.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cli/user-input.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,7 +11,7 @@ export async function renderUserInputFuncs(config: CliConfig): Promise<string> {
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('-------------------------------------------------------------------------------------------');

Expand Down
4 changes: 2 additions & 2 deletions tools/@aws-cdk/user-input-gen/lib/user-input-gen.ts
Original file line number Diff line number Diff line change
@@ -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<string> {
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('-------------------------------------------------------------------------------------------');

Expand Down
2 changes: 2 additions & 0 deletions tools/@aws-cdk/user-input-gen/lib/util.ts
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tools/@aws-cdk/user-input-gen/lib/yargs-gen.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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('-------------------------------------------------------------------------------------------');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions tools/@aws-cdk/user-input-gen/test/user-input-gen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions tools/@aws-cdk/user-input-gen/test/yargs-gen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit a0fa042

Please sign in to comment.