Skip to content

Conversation

@dgandhi62
Copy link
Contributor

@dgandhi62 dgandhi62 commented Oct 24, 2025

This PR creates a code generation system that transforms Amplify Gen 1 authentication configurations into Gen 2 TypeScript code. The added code files are copies of the old tool to maintain dependencies. They would be updated individually in future prs.

Currently, strict:false has been set for packages/amplify-cli/tsconfig.json. This is because this setting is required for codegen. The following issue would need to be resolved in future prs:

A separate typescript compilation would need to be configured for codegen. That is, a separate tsconfig file and jest config would be added. To accomodate the new tsconfig settings, the build script would be changed to compile and test codegen separately. If any changes to codegen name or placement would be made, the following points of change would be required:

packages/amplify-cli/package.json
Build script: tsc -p src/commands/../gen2-migration/NEW_NAME/tsconfig.json
Test script: jest --config src/commands/../gen2-migration/NEW_NAME/jest.config.js
testIgnorePathPatterns

packages/amplify-cli/tsconfig.json
Exclude pattern: "src/commands/gen2-migration/NEW_NAME"

.gitignore
packages/amplify-cli/src/commands/gen2-migration/NEW_NAME/lib

  • PR description included
  • yarn test passes

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

…tion

- add auth generator file to generate typescript asts
- add preliminary unit tests for the auth generator
- integrate the rest of the old migration tool to maintain dependencies
@dgandhi62 dgandhi62 requested a review from a team as a code owner October 24, 2025 14:04
Copy link
Contributor

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

…degen

- Add dual build process: main project with strict:true, gen2-migration with strict:false
- Update build script to compile both tsconfigs sequentially
- Exclude gen2-migration directory from main tsconfig to prevent double compilation
- Create separate Jest config for gen2-migration tests with relaxed TypeScript settings
- Update test script to run both Jest configurations
- Add gen2-migration lib directory to .gitignore to exclude compiled artifacts
- Configure gen2-migration tsconfig with strict:false, skipLibCheck, and proper paths

This allows the gen2-migration codegen to build and test with relaxed TypeScript
settings while maintaining strict type checking for the main codebase.
// CLI entry point - handles command line interface
// import { migrateToGen2 } from '../core/migration-pipeline';

export const run = async (args: string[]) => {

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable run.
@dgandhi62 dgandhi62 changed the title feat: add auth generator and codegen file structure feat: cumulative codegen structure Oct 26, 2025
@iliapolo iliapolo merged commit d9ef109 into aws-amplify:gen2-migration Oct 28, 2025
4 checks passed
iankhou pushed a commit that referenced this pull request Oct 28, 2025
* feat: add codegen auth v1

* chore: add a new tsconfig file for codegen tool

* chore: added codegen tsconfig reference in base tsconfig

* chore: add build artifacts

* feat: add comprehensive codegen tool for amplify gen 1 to gen 2 migration

- add auth generator file to generate typescript asts
- add preliminary unit tests for the auth generator
- integrate the rest of the old migration tool to maintain dependencies

* chore: updated dependencies

* chore: update dependencies

* fix: add proper exclusions for codegen tsconfig

* feat: configure separate TypeScript compilation for gen2-migration codegen

- Add dual build process: main project with strict:true, gen2-migration with strict:false
- Update build script to compile both tsconfigs sequentially
- Exclude gen2-migration directory from main tsconfig to prevent double compilation
- Create separate Jest config for gen2-migration tests with relaxed TypeScript settings
- Update test script to run both Jest configurations
- Add gen2-migration lib directory to .gitignore to exclude compiled artifacts
- Configure gen2-migration tsconfig with strict:false, skipLibCheck, and proper paths

This allows the gen2-migration codegen to build and test with relaxed TypeScript
settings while maintaining strict type checking for the main codebase.

* chore: change auth generator to the original tool

* chore: update jest.config.js

* chore: update jest.config.js

* feat: auth generator update v1

* chore: add separate command for running codegen tests

* fix: revert tsconfig and package.json changes and set strict:false for amplify-cli

* chore: update auth generator to original tool's code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants