diff --git a/.eslintignore b/.eslintignore index 9e2cea19ff3..f9be8b1dd54 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,11 +1,19 @@ -node_modules/** -dist/** +node_modules/ +dist/ src.gen/** **/*.json +**/*.gen.ts +types/*.d.ts + +# Duplicate entries because prettier can be ran from root or within the workspace/subpackage. +# TODO: Avoid this. src/shared/telemetry/clienttelemetry.d.ts src/codewhisperer/client/codewhispererclient.d.ts src/codewhisperer/client/codewhispereruserclient.d.ts src/amazonqFeatureDev/client/featuredevproxyclient.d.ts -**/*.gen.ts src/testFixtures/** -types/*.d.ts +packages/toolkit/src/shared/telemetry/clienttelemetry.d.ts +packages/toolkit/src/codewhisperer/client/codewhispererclient.d.ts +packages/toolkit/src/codewhisperer/client/codewhispereruserclient.d.ts +packages/toolkit/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts +packages/toolkit/src/testFixtures/** diff --git a/.eslintrc.js b/.eslintrc.js index 4d573bb0504..3121a6bee60 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,7 @@ module.exports = { parserOptions: { ecmaVersion: 'latest', sourceType: 'module', - project: './tsconfig.json', + project: ['./packages/*/tsconfig.json', './plugins/*/tsconfig.json'], tsconfigRootDir: __dirname, }, env: { diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 27179c277bb..427ef5acee1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ * @aws/aws-ides-team -src/codewhisperer/ @aws/codewhisperer-team -src/amazonqFeatureDev/ @aws/earlybird -src/codewhispererChat/ @aws/aws-mynah -src/amazonq/ @aws/aws-mynah +packages/toolkit/src/codewhisperer/ @aws/codewhisperer-team +packages/toolkit/src/amazonqFeatureDev/ @aws/earlybird +packages/toolkit/src/codewhispererChat/ @aws/aws-mynah +packages/toolkit/src/amazonq/ @aws/aws-mynah diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4e58e7899fc..0fc44ac4610 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,7 @@ version: 2 updates: - package-ecosystem: 'npm' - directory: '/' # Location of package manifests. + directory: './packages/toolkit/' # Location of package manifests. target-branch: 'master' # Avoid updates to "staging". commit-message: prefix: 'deps' @@ -25,7 +25,7 @@ updates: - '@smithy*' - 'smithy*' - package-ecosystem: 'github-actions' - directory: '/' + directory: './packages/toolkit/' target-branch: 'master' # Avoid updates to "staging". commit-message: prefix: 'deps' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a7e63b5a5e..b63ebdfd03b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: - name: vsix run: | npm run createRelease # Generate CHANGELOG.md - npm run generateNonCodeFiles + npm run generateNonCodeFiles -w packages/toolkit cp ./README.quickstart.vscode.md ./README.md npm run package -- --feature "$FEAT_NAME" - uses: actions/upload-artifact@v4 diff --git a/.gitignore b/.gitignore index 416ac20f07d..caa4923591f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ out dist node_modules -.vscode-test/ -coverage/ +.vscode-test +coverage *.vsix *.bk **/.DS_Store @@ -12,34 +12,40 @@ quickStart*.html README.quickstart.cloud9.md README.quickstart.vscode.md .gitcommit -resources/debugger/__pycache__ +__pycache__ # Generated if running the `depcruise` command from the documentation example /dependency-graph.svg # Auto generated definitions -src/**/*.gen.ts +packages/toolkit/src/**/*.gen.ts src.gen/* # Telemetry definition for testing adding telemetry -src/shared/telemetry/vscodeTelemetry.json +packages/toolkit/src/shared/telemetry/vscodeTelemetry.json # Test reports -.test-reports/ +.test-reports # Auto generated type definitions -src/shared/telemetry/clienttelemetry.d.ts -src/codewhisperer/client/codewhispererclient.d.ts -src/codewhisperer/client/codewhispereruserclient.d.ts -src/amazonqFeatureDev/client/featuredevproxyclient.d.ts +packages/toolkit/src/shared/telemetry/clienttelemetry.d.ts +packages/toolkit/src/codewhisperer/client/codewhispererclient.d.ts +packages/toolkit/src/codewhisperer/client/codewhispereruserclient.d.ts +packages/toolkit/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts # Generated by tests -src/testFixtures/**/bin -src/testFixtures/**/obj +packages/toolkit/src/testFixtures/**/bin +packages/toolkit/src/testFixtures/**/obj + +# Generated by copyFiles.ts +packages/toolkit/README* +packages/toolkit/CHANGELOG.md +packages/toolkit/LICENSE +packages/toolkit/NOTICE # Icons -resources/icons/cloud9/generated/** -resources/fonts/aws-toolkit-icons.woff -resources/css/icons.css +packages/toolkit/resources/icons/cloud9/generated/** +packages/toolkit/resources/fonts/aws-toolkit-icons.woff +packages/toolkit/resources/css/icons.css # local configuration .local.env diff --git a/.prettierignore b/.prettierignore index 16f7af38fb6..c7b34ad2f10 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,12 +1,15 @@ out -resources/endpoints.json CHANGELOG.md -src/shared/telemetry/service-2.json .changes -src/testFixtures/** *.d.ts *.gen.ts -dist/** -types/*.d.ts +dist src.gen/** -plugins/*/dist/** + +# Duplicate entries because prettier can be ran from root or within the workspace/subpackage. +# TODO: Avoid this. +src/shared/telemetry/service-2.json +src/testFixtures/** + +packages/toolkit/src/shared/telemetry/service-2.json +packages/toolkit/src/testFixtures/** diff --git a/.vscode/settings.json b/.vscode/settings.json index d5240393191..f954c48cf36 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,6 @@ }, "typescript.preferences.importModuleSpecifier": "relative", "javascript.preferences.importModuleSpecifier": "relative", - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + "npm.packageManager": "npm" } diff --git a/.vscodeignore b/.vscodeignore deleted file mode 100644 index 86b0cff0376..00000000000 --- a/.vscodeignore +++ /dev/null @@ -1,20 +0,0 @@ -# Ignore everything by default. #1899 -* -*/** - -# Allowlist -!dist/* -!dist/libs -!dist/*/!(testFixtures|test)/**/!(*.*.map) -!dist/*/!(*.*.map) -!resources/** -!syntaxes/** -!templates/** -!types/** -!LICENSE -!NOTICE -!package.json -!package.nls.json -!quickStart** -!README.** -!CHANGELOG.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c048ee10a68..b009dfdc2ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,10 @@ codebase and sending pull requests. ## Getting Started +This project is set up as a typescript monorepo. The documentation throughout this project +is referring to the subproject in [`packages/toolkit/`](./packages/toolkit/). For more information, +see [ARCHITECTURE.md](./docs/ARCHITECTURE.md#monorepo-structure) + ### Find things to do If you're looking for ideas about where to contribute, consider @@ -35,6 +39,9 @@ Then clone the repository and install NPM packages: ### Run +Due to the monorepo structure of the project, you can run the extension in VSCode by either opening the +`aws-toolkit-vscode/packages/toolkit` folder directly, or adding it as a root folder in the VSCode Workspace. + To run the extension from VSCode as a Node.js app: 1. Select the Run panel from the sidebar. @@ -153,7 +160,9 @@ See [browser.md](./docs/browser.md) for working with the browser implementation See [TESTPLAN.md](./docs/TESTPLAN.md) to understand the project's test structure, mechanics and philosophy. -You can run tests directly from VSCode: +You can run tests directly from VSCode. Due to the monorepo structure of the project, you must either open +the `aws-toolkit-vscode/packages/toolkit/` folder directly, or add it as a root folder in the VSCode Workspace. +Then: 1. Select `View > Debug`, or select the Debug pane from the sidebar. 2. From the dropdown at the top of the Debug pane, select the `Extension Tests` configuration. @@ -208,7 +217,7 @@ To run tests against a specific folder in VSCode, do any one of: Running the extension in the browser (eg: [vscode.dev](https://vscode.dev/)). -[See documentation here](./src/browser/README.md). +[See documentation here](./packages/toolkit/src/browser/README.md). ### Coverage report diff --git a/buildspec/packageTestVsix.yml b/buildspec/packageTestVsix.yml index 44ae94f521e..f6710783fb6 100644 --- a/buildspec/packageTestVsix.yml +++ b/buildspec/packageTestVsix.yml @@ -27,7 +27,7 @@ phases: - export HOME=/home/codebuild-user # Generate CHANGELOG.md - npm run createRelease - - npm run generateNonCodeFiles + - npm run generateNonCodeFiles -w packages/toolkit - cp ./README.quickstart.vscode.md ./README.md - npm run package diff --git a/codecov.yml b/codecov.yml index 3b44b7a1b42..4c4129c979e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -38,7 +38,7 @@ github_checks: flags: codewhisperer: paths: - - src/codewhisperer/ + - packages/toolkit/src/codewhisperer/ amazonqFeatureDev: paths: - - src/amazonqFeatureDev/ + - packages/toolkit/src/amazonqFeatureDev/ diff --git a/designs/credentials/credentials-management.md b/designs/credentials/credentials-management.md index 3c9daf2e4a3..f6b6701f24b 100644 --- a/designs/credentials/credentials-management.md +++ b/designs/credentials/credentials-management.md @@ -31,11 +31,11 @@ A formatted version of the Credentials Provider Id may be surfaced to users, how When the user connects to AWS in the Toolkit, a Credentials Provider is requested, which is then used to obtain credentials. The toolkit requests a Credentials Provider by checking which credentials provider factories support the provider's credentials type. The factories of interest are queried to see which (if any) have the requested Credentials Provider. -At the time this document was written, Shared Credentials are the only supported Credentials. Additional credentials providers will reside at [/src/credentials/providers](/src/credentials/providers) as they are implemented. +At the time this document was written, Shared Credentials are the only supported Credentials. Additional credentials providers will reside at [/src/credentials/providers](/packages/toolkit/src/credentials/providers) as they are implemented. ### Shared Credentials Profiles -Profiles are retrieved from the user's shared credentials files. The profile is handled and validated differently based on which fields are present. Handling and validation logic can be found in [sharedCredentialsProvider.ts](/src/credentials/providers/sharedCredentialsProvider.ts). +Profiles are retrieved from the user's shared credentials files. The profile is handled and validated differently based on which fields are present. Handling and validation logic can be found in [sharedCredentialsProvider.ts](/packages/toolkit/src/credentials/providers/sharedCredentialsProvider.ts). Only profiles that are considered valid are provided to the toolkit. When validation issues are detected, they are written to the logs to help users understand why the toolkit is having difficulties with a profile. Users running the 'Connect to AWS' command will not see invalid profiles in the list of Credentials. diff --git a/designs/modify-resources-attached-to-code-pipeline.md b/designs/modify-resources-attached-to-code-pipeline.md index 8b8960ac471..3da351d72e7 100644 --- a/designs/modify-resources-attached-to-code-pipeline.md +++ b/designs/modify-resources-attached-to-code-pipeline.md @@ -150,7 +150,7 @@ The confirmation prompt can be implemented using one of two UI facilities: ### API Client -The `ResourceGroupsTaggingAPI` service client will be used. The client will be set up in a manner consistent with the Lambda and CloudFormation clients, allowing the clients to be stubbed out in unit tests. See the Toolkit's Lambda Client [Interface](/src/shared/clients/lambdaClient.ts) and [Implementation](/src/shared/clients/defaultLambdaClient.ts) as an example. A new client factory will be added to [ToolkitClientBuilder](/src/shared/clients/toolkitClientBuilder.ts) and [DefaultToolkitClientBuilder](/src/shared/clients/defaultToolkitClientBuilder.ts). +The `ResourceGroupsTaggingAPI` service client will be used. The client will be set up in a manner consistent with the Lambda and CloudFormation clients, allowing the clients to be stubbed out in unit tests. See the Toolkit's Lambda Client [Interface](/packages/toolkit/src/shared/clients/lambdaClient.ts) and [Implementation](/packages/toolkit/src/shared/clients/defaultLambdaClient.ts) as an example. A new client factory will be added to [ToolkitClientBuilder](/packages/toolkit/src/shared/clients/toolkitClientBuilder.ts) and [DefaultToolkitClientBuilder](/packages/toolkit/src/shared/clients/defaultToolkitClientBuilder.ts). ### Fallback Handling diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index aee0f26935c..c1775c1ce05 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -2,11 +2,42 @@ An overview of the architecture for various components within the Toolkit. +## Monorepo Structure + +This project is currently set up as a typescript monorepo with a single subproject. +We are currently working on splitting the Toolkit into various subprojects to help with +sharing code between modules, browser extension development, etc. For now, there is just +one monolithic subproject with all the extension functionality: [`packages/toolkit/`](./packages/toolkit/). + +Unless otherwise stated, the documentation throughout this project is referring to the code and +functionality of that subproject. + +Current quirks of the current monorepo status that should be resolved/evaluated in later versions (TODO): + +- The [root package.json](../package.json) contains common dependencies for subprojects, and workspace + entries for each of the subprojects. + - This package contains shortcuts to some of the `npm` scripts found in the subproject(s). + - Other scripts, like `createRelease` and `newChange` run at the root level. + - To run a script not present in the root `package.json`, use `npm run -w packages/toolkit