Skip to content

Commit 21c66e2

Browse files
committed
Add/update documentation.
1 parent db9f77c commit 21c66e2

File tree

7 files changed

+53
-39
lines changed

7 files changed

+53
-39
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ codebase and sending pull requests.
88

99
## Getting Started
1010

11+
This project is set up as a typescript monorepo. The documentation throughout this project
12+
is referring to the subproject in [`packages/toolkit/`](./packages/toolkit/). For more information,
13+
see [ARCHITECTURE.md](./docs/ARCHITECTURE.md#monorepo-structure)
14+
1115
### Find things to do
1216

1317
If you're looking for ideas about where to contribute, consider
@@ -35,6 +39,9 @@ Then clone the repository and install NPM packages:
3539

3640
### Run
3741

42+
Due to the monorepo structure of the project, you can run the extension in VSCode by either opening the
43+
`aws-toolkit-vscode/packages/toolkit` folder directly, or adding it as a root folder in the VSCode Workspace.
44+
3845
To run the extension from VSCode as a Node.js app:
3946

4047
1. Select the Run panel from the sidebar.
@@ -153,7 +160,9 @@ See [browser.md](./docs/browser.md) for working with the browser implementation
153160
See [TESTPLAN.md](./docs/TESTPLAN.md) to understand the project's test
154161
structure, mechanics and philosophy.
155162
156-
You can run tests directly from VSCode:
163+
You can run tests directly from VSCode. Due to the monorepo structure of the project, you must either open
164+
the `aws-toolkit-vscode/packages/toolkit/` folder directly, or add it as a root folder in the VSCode Workspace.
165+
Then:
157166
158167
1. Select `View > Debug`, or select the Debug pane from the sidebar.
159168
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:
208217
209218
Running the extension in the browser (eg: [vscode.dev](https://vscode.dev/)).
210219
211-
[See documentation here](./src/browser/README.md).
220+
[See documentation here](./packages/toolkit/src/browser/README.md).
212221
213222
### Coverage report
214223

designs/credentials/credentials-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ A formatted version of the Credentials Provider Id may be surfaced to users, how
3131

3232
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.
3333

34-
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.
34+
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.
3535

3636
### Shared Credentials Profiles
3737

38-
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).
38+
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).
3939

4040
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.
4141

designs/modify-resources-attached-to-code-pipeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ The confirmation prompt can be implemented using one of two UI facilities:
150150

151151
### API Client
152152

153-
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).
153+
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).
154154

155155
### <a id="fallback-handling"></a>Fallback Handling
156156

docs/ARCHITECTURE.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,42 @@
22

33
An overview of the architecture for various components within the Toolkit.
44

5+
## Monorepo Structure
6+
7+
This project is currently set up as a typescript monorepo with a single subproject.
8+
We are currently working on splitting the Toolkit into various subprojects to help with
9+
sharing code between modules, browser extension development, etc. For now, there is just
10+
one monolithic subproject with all the extension functionality: [`packages/toolkit/`](./packages/toolkit/).
11+
12+
Unless otherwise stated, the documentation throughout this project is referring to the code and
13+
functionality of that subproject.
14+
15+
Current quirks of the current monorepo status that should be resolved/evaluated in later versions (TODO):
16+
17+
- The [root package.json](../package.json) contains common dependencies for subprojects, and workspace
18+
entries for each of the subprojects.
19+
- This package contains shortcuts to some of the `npm` scripts found in the subproject(s).
20+
- Other scripts, like `createRelease` and `newChange` run at the root level.
21+
- To run a script not present in the root `package.json`, use `npm run -w packages/toolkit <script>`
22+
- `coverage/`, `.test-reports/`, `node_modules/` are hoisted to the project root. As more subprojects are added,
23+
we will need to evaluate how to merge and publish coverage reports.
24+
- `dist/` however remains at the subproject level, along with a local `node_modules/`. See [`npm workspaces`](https://docs.npmjs.com/cli/v8/using-npm/workspaces)
25+
for more info on how `node_modules/` hoisting works.
26+
- Because of `node_modules/` hoisting, references to this folder in code access the root project modules folder. This may be
27+
an issue if more subprojects are added and the contents of the root and local modules folders differ.
28+
- [`globalSetup.test.ts`](../packages/toolkit/src/test/globalSetup.test.ts) should be configured to work as a library/run tests for all subprojects.
29+
- Subproject `tsconfig.json`s should extend a root `tsconfig.packages.json`.
30+
- Linting tests should run at the root level, not subproject level.
31+
- `packages/toolkit/scripts/` should be generalized and moved to the root of the project as needed.
32+
- LICENSE, README.md, and other non-code artifacts that must be packaged into the .vsix are currently
33+
being copied into the packaging subproject directory from the root project directory as part of the `copyFiles` task.
34+
- [**Running the test suites in VSCode has changed**](../CONTRIBUTING.md#test)
35+
536
## Commands
637

738
Many parts of the VS Code API relies on the use of 'commands' which are simply functions bound to a global ID. For small projects, this simplicity is great. But the base API doesn't offer a lot of common functionality that a large project might want: logging, error handling, etc.
839

9-
For the Toolkit, common command functionality is implemented in [Commands](../src/shared/vscode/commands2.ts). The goal with this abstraction is to increase consistency across the Toolkit for anything related to commands.
40+
For the Toolkit, common command functionality is implemented in [Commands](../packages/toolkit/src/shared/vscode/commands2.ts). The goal with this abstraction is to increase consistency across the Toolkit for anything related to commands.
1041

1142
### Examples
1243

@@ -90,7 +121,7 @@ _See also [CODE_GUIDELINES.md](./CODE_GUIDELINES.md#exceptions)._
90121

91122
Large applications often have a correspondingly large number of failure points. For feature-level logic, these failures are often non-recoverable. The best we can do is show the user that something went wrong and maybe offer guidance on how to fix it.
92123

93-
Because this is such a common pattern, shared error handling logic is defined by `ToolkitError` found [here](../src/shared/errors.ts). This class provides the basic structure for errors throughout the Toolkit.
124+
Because this is such a common pattern, shared error handling logic is defined by `ToolkitError` found [here](../packages/toolkit/src/shared/errors.ts). This class provides the basic structure for errors throughout the Toolkit.
94125

95126
### Chaining
96127

@@ -100,7 +131,7 @@ By adding additional information as the exception bubbles up, we can create a be
100131

101132
### Handlers
102133

103-
Any code paths exercised via `Commands` will have errors handled by `handleError` in [extensions.ts](../src/extension.ts). A better API for error handling across more than just commands will be added in a future PR.
134+
Any code paths exercised via `Commands` will have errors handled by `handleError` in [extensions.ts](../packages/toolkit/src/extension.ts). A better API for error handling across more than just commands will be added in a future PR.
104135

105136
### Best Practices
106137

docs/CODE_GUIDELINES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ _See also [ARCHITECTURE.md](./ARCHITECTURE.md#exceptions)._
183183
184184
- [Testing Refresh Button](https://github.com/aws/aws-toolkit-vscode/blob/b34c8f7650c862c388992781844695b014b5d974/src/test/shared/ui/prompters/rolePrompter.test.ts#L58-L65)
185185
186-
- Use [`testCommand`](../src/test/shared/vscode/testUtils.ts) for testing commands created by `Commands.declare`
186+
- Use [`testCommand`](../packages/toolkit/src/test/shared/vscode/testUtils.ts) for testing commands created by `Commands.declare`
187187
- Prefer executing the real command directly when possible
188188
189189
## Code guidelines

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts packages plugins && npm run formatfix",
3838
"clean": "npm run clean -w packages/ -w plugins/",
3939
"reset": "npm run clean && ts-node ./scripts/clean.ts node_modules packages/toolkit/node_modules && npm install",
40-
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/"
40+
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/",
41+
"watch": "npm run watch -w packages/toolkit",
42+
"browserRun": "npm run browserRun -w packages/toolkit",
43+
"browserWatch": "npm run browserWatch -w packages/toolkit"
4144
},
4245
"devDependencies": {
4346
"eslint": "^8.56.0",

tsconfig.packages.json

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)