Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Mar 20, 2025

Hopefully the final big code re-org in the CLI before we move code into the shared package.

This move focuses on moving top-level files into commands and cli respectively, to indicate they will stay within the CLI package.
Also removes the toolkit/error.ts re-export, which causes many of the import changes.

Includes a non-consequential bug fix, to the init command and how it's finding the new .init-version.json and .recommended-feature-flags.json files. This was incorrect before and would happened to work because init.ts was in the same directory as index.ts. However because the code is bundled, we need to address the init-templates (and the new files) from the project root location. This is already done for the templates themselves, but was missed for .init-version.json and .recommended-feature-flags.json.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Mar 20, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team March 20, 2025 10:54
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only larger code change in this PR

*/
async function loadInitVersions(): Promise<Versions> {
const initVersionFile = path.join(__dirname, './init-templates/.init-version.json');
const initVersionFile = path.join(cliRootDir(), 'lib', 'init-templates', '.init-version.json');
Copy link
Contributor Author

@mrgrain mrgrain Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect before and would have broken the toolkit-lib and cli-lib-alpha and integ-runner and cdk-cli-wrapper if they were supporting init command.

Because the code is bundled, we need to address the init-templates from the project root location. This is already done elsewhere in this file, just was missed for .init-version.json and .recommended-feature-flags.json

*/
export async function currentlyRecommendedAwsCdkLibFlags() {
const recommendedFlagsFile = path.join(__dirname, './init-templates/.recommended-feature-flags.json');
const recommendedFlagsFile = path.join(cliRootDir(), 'lib', 'init-templates', '.recommended-feature-flags.json');
Copy link
Contributor Author

@mrgrain mrgrain Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect before and would have broken the toolkit-lib and cli-lib-alpha and integ-runner and cdk-cli-wrapper if they were supporting init command.

Because the code is bundled, we need to address the init-templates from the project root location. This is already done elsewhere in this file, just was missed for .init-version.json and .recommended-feature-flags.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fixes surfaced because the file moved to a subdirectory.

@mrgrain mrgrain force-pushed the mrgrain/chore/organize-files branch from 3f7b8a3 to fdb96d8 Compare March 20, 2025 10:58
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now import directly from the shared library

@mrgrain mrgrain force-pushed the mrgrain/chore/organize-files branch from fdb96d8 to cd52c09 Compare March 20, 2025 11:07
@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.32%. Comparing base (4635d02) to head (49518cf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #265      +/-   ##
==========================================
+ Coverage   84.89%   85.32%   +0.43%     
==========================================
  Files         218      219       +1     
  Lines       36585    36577       -8     
  Branches     4550     4599      +49     
==========================================
+ Hits        31058    31211     +153     
+ Misses       5380     5224     -156     
+ Partials      147      142       -5     
Flag Coverage Δ
suite.unit 85.32% <100.00%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrgrain mrgrain force-pushed the mrgrain/chore/organize-files branch from 6c644b2 to 49518cf Compare March 20, 2025 12:48
@mrgrain mrgrain added the pr/exempt-integ-test Skips the integ test steps if set. label Mar 20, 2025
@mrgrain mrgrain closed this Mar 20, 2025
auto-merge was automatically disabled March 20, 2025 13:13

Pull request was closed

@mrgrain mrgrain reopened this Mar 20, 2025
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Mar 20, 2025
Merged via the queue into main with commit 174c2e7 Mar 20, 2025
23 of 24 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/chore/organize-files branch March 20, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2 pr/exempt-integ-test Skips the integ test steps if set.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants