You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-8Lines changed: 3 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ You can also use these NPM tasks (see `npm run` for the full list):
132
132
133
133
1. Declare a global unhandledRejection handler.
134
134
```ts
135
-
process.on('unhandledRejection', e => {
135
+
process.on('unhandledRejection', (e) => {
136
136
getLogger('channel').error(
137
137
localize(
138
138
'AWS.channel.aws.toolkit.activation.error',
@@ -218,12 +218,7 @@ To run tests against a specific folder in VSCode, do any one of:
218
218
219
219
### Coverage report
220
220
221
-
You can find the coverage report at `./coverage/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching. A few manual steps are needed instead:
222
-
223
-
- Run the command `Tasks: Run Build Task` if not already active
224
-
- Instrument built code with `npm run instrument`
225
-
- Exercise the code (`Extension Tests`, `Integration Tests`, etc.)
226
-
- Generate a report with `npm run report`
221
+
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/core/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
227
222
228
223
### CodeCatalyst Blueprints
229
224
@@ -554,7 +549,7 @@ For extensions to contribute their own codicons, VSCode requires a font file as
554
549
As a simple example, let's say I wanted to add a new icon for CloudWatch log streams. I would do the following:
555
550
556
551
1. Place the icon in `resources/icons/aws/cloudwatch`. I'l name the icon `log-stream.svg`.
557
-
1. Use `npm run generatePackage` to update `package.json`. Commit this change with the new icon.
552
+
1. Use `npm run generateIcons` to update `package.json`. Commit this change with the new icon.
Copy file name to clipboardExpand all lines: docs/TESTPLAN.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ Checking the state works well if user interactions are not required by the code
104
104
To handle this, test code can register event handler that listen for when a certain type of UI element is shown. For example, if we wanted to always accept the first item of a quick pick we can do this:
Exceptions thrown within one of these handlers will cause the current test to fail. This allows you to make assertions within the callback without worrying about causing the test to hang.
124
+
125
+
## Common issues
126
+
127
+
### Stubbing VSCode outside of core
128
+
129
+
- Stubbing VSCode imports (like executeCommand) does not work outside of core. For now you will need to put any tests that require spying/stubbing VSCode imports in core until we move more source files into the amazon q package
Copy file name to clipboardExpand all lines: docs/arch_develop.md
+31-34Lines changed: 31 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,8 +37,7 @@ Current quirks of the current monorepo status that should be resolved/evaluated
37
37
- This package contains shortcuts to some of the `npm` scripts found in the subproject(s).
38
38
-`createRelease` and `newChange` run at the subproject level only, e.g. from root level, try npm run createRelease -w packages/toolkit
39
39
- To run a script not present in the root `package.json`, use `npm run -w packages/toolkit <script>`
40
-
-`coverage/`, `.test-reports/`, `node_modules/` are hoisted to the project root. As more subprojects are added,
41
-
we will need to evaluate how to merge and publish coverage reports.
40
+
-`coverage/`, `.test-reports/`, `node_modules/` are hoisted to the project root.
42
41
-`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)
43
42
for more info on how `node_modules/` hoisting works.
44
43
- Because of `node_modules/` hoisting, references to this folder in code access the root project modules folder. This may be
@@ -72,39 +71,37 @@ Some components of the core library depend on the `package.json`s of the extensi
72
71
- Does not restore, it is a superset of what exists in `packages/core` for `configuration.properties`.
73
72
- To develop for the Amazon Q extension: add all changes to `packages/amazonq/package.json`, EXCEPT for settings that are references by code in the core library, or settings that already exist in the core `package.json`
74
73
75
-
## Shared vs Common names
74
+
If you are modifying or registering new debuggers in VS Code via the `debuggers` contribution point, you may need to regenerate the [definitions file](../packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.gen.ts). After updating ['toolkit/package.json'](../packages/toolkit/package.json), run `npm run generateConfigurationAttributes -w packages/toolkit`
76
75
77
-
In this repo, the keywords **"shared"** and **"common"** have specific meanings in the context of file/folder names.
This project can run in different environments, eg Web mode (in the browser with no compute backend), or in Node.js on your desktop (the most common way).
79
+
A problem arises when we use code that is exclusive to one environment, an example being Node.js' Filesystem module which will fail in Web mode.
80
80
81
-
Code within a folder/file that has the "common" keyword implies that it can run in any environment. Examples of environments are: Web mode, or Node.js (local desktop)
81
+
To ensure developers use compatible code for their environment we have subfolders in each topic which contains environment specific code in a single place.
82
82
83
-
We need this distinction since not all code can run in any environment. A common example is filesystem code, where the actual implementation used could work in Node.js but not in Web mode.
83
+
Using this file tree as reference, here are the rules:
84
84
85
-
### "shared"
86
-
87
-
Code within a folder/file that has the "shared" keyword implies that it is intended to be reused wherever it can be. This is generalized code that "Feature A" or "Feature B" could use if it works for their use case.
88
-
89
-
An example is the `waitUntil()` function which continuously invokes an arbitrary callback function until it succeeds.
90
-
91
-
> NOTE: Something that is "shared" does not mean it is "common", as it could be reused in different places but only work in Node.js for example.
85
+
```
86
+
src/
87
+
├── myTopic/
88
+
│ ├── {file}.ts
89
+
│ ├── node/
90
+
│ │ └── {file}.ts
91
+
│ └── web/
92
+
│ └── {file}.ts
93
+
└── shared/
94
+
```
92
95
93
-
### How to apply this
96
+
-`myTopic/` is the general name of the folder, eg `request` for http requests.
97
+
-`myTopic/{file}.ts` is for code that works in any environment, we refer to this as `"common"` code.
98
+
-`node/{file}.ts` is for code that works exclusively in Node.js.
99
+
-`web/{file}.ts` is for code that works exclusively in Web mode.
100
+
-`shared/` is for code that is intended to be reused, i.e general purpose utils.
101
+
- Note environment specific code should be place in to a `web/` or `node/` subfolder.
102
+
- If the code is not in a subfolder then it is considered `shared common` code.
94
103
95
-
- Aim to make code compatible with "common" from the beginning.
96
-
- In a "topic" folder, if you have common code, create a subfolder named "common" and add your common code to there.
97
-
```
98
-
src/
99
-
|
100
-
myTopic/
101
-
|
102
-
common/
103
-
nonCommon.ts
104
-
```
105
-
- See if yours, or existing code can be moved in to a "shared" folder. Maybe it can be easily modified to become "shared".
106
-
- If there is no "shared" or "common" naming used for the file/folder, then assume it only works in Node.js.
107
-
- In the rare case your code only works in Web mode, create a `web` subfolder for that code.
104
+
> IMPORTANT: The current codebase does not fully follow this convention yet, the transition is being done incrementally. Due to this, code that is `"common"` may not actually be common yet. If you run in to this, please move that code to the appropriate subfolder.
108
105
109
106
## Commands
110
107
@@ -293,22 +290,22 @@ Commands and events are defined on the backend via sub-classes of `VueWebview`.
Copy file name to clipboardExpand all lines: docs/icons.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,17 @@
1
1
# Icons
2
2
3
-
All icons that are used in the Toolkit can be found in `resources/icons`.
3
+
All icons that are used in the extensions can be found in `resources/icons`.
4
4
5
-
A [build script](../../scripts/build/generateIcons.ts) generates Toolkit artifacts:
5
+
A [build script](../scripts/generateIcons.ts) generates extension artifacts in [core/](../packages/core/):
6
6
7
7
-`resources/icons/cloud9/generated`
8
8
-`resources/fonts/aws-toolkit-icons.woff`
9
9
-`resources/css/icons.css`
10
-
-`contributes.icons` in [package.json](../../package.json)
10
+
-`contributes.icons` in [amazonq package.json](../packages/amazonq/package.json) and [toolkit package.json](../packages/toolkit/package.json)
11
11
12
-
This script should be ran using `npm run generatePackage` after making updates. Any changes made to `package.json` should be committed with the relevant icons.
12
+
This script should be ran using `npm run generateIcons` after making updates. Any changes made to `package.json` should be committed with the relevant icons. Type checking in `core/` relies on the entries in `core/package.json`. However, the individual extensions require entries in their `package.json`s as well. Currently, resources (including icons) are shared between `core/` and the individual extensions. If `contributes.icons` in each of the extensions does not match the entry in `core/`, then CI will fail.
13
+
14
+
To sync the icons to the individual extensions, run `npm run copyFiles && npm run generateIcons` for each extension.
0 commit comments