Skip to content

Commit 6caee22

Browse files
authored
chore: remove debuggers dependency on core/package.json (#5342)
* chore: remove debuggers dependency on core/package.json Generate debuggers definitions file from toolkit. We will now store this in the repo. There is a lot of code that relies on the definitions, which is why it is is still generated into core. Future work: drop this code down into packages/toolkit * fix script/package.json and restore core because it still syncs
1 parent eddec80 commit 6caee22

File tree

6 files changed

+675
-20
lines changed

6 files changed

+675
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ __pycache__
2020

2121
# Auto generated definitions
2222
packages/*/src/**/*.gen.ts
23+
!packages/core/src/**/awsSamDebugConfiguration.gen.ts
2324
!packages/core/src/shared/settings-*.gen.ts
2425
src.gen/*
2526

docs/arch_develop.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Some components of the core library depend on the `package.json`s of the extensi
7171
- Does not restore, it is a superset of what exists in `packages/core` for `configuration.properties`.
7272
- 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`
7373

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`
75+
7476
## `web`, `node`, `common`, `shared` naming conventions
7577

7678
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).

packages/core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4014,8 +4014,7 @@
40144014
}
40154015
},
40164016
"scripts": {
4017-
"postinstall": "npm run generateTelemetry && npm run generateConfigurationAttributes && npm run compile",
4018-
"generateConfigurationAttributes": "ts-node ./scripts/build/generateConfigurationAttributes.ts",
4017+
"postinstall": "npm run generateTelemetry && npm run compile",
40194018
"clean": "ts-node ../../scripts/clean.ts dist/",
40204019
"copyFiles": "ts-node ./scripts/build/copyFiles.ts",
40214020
"buildScripts": "npm run generateClients && npm run generatePackage && npm run copyFiles",
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* This file is not generated from the core library. Please regenerate from
8+
* 'packages/toolkit', e.g. `npm run generateConfigurationAttributes -w packages/toolkit`
9+
*/
10+
11+
/**
12+
* This file was automatically generated by json-schema-to-typescript.
13+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
14+
* and run json-schema-to-typescript to regenerate this file.
15+
*/
16+
17+
import * as vscode from "vscode";
18+
19+
export interface AwsSamDebuggerConfiguration extends vscode.DebugConfiguration {
20+
aws?: AWSConnection;
21+
invokeTarget: TemplateTargetProperties | CodeTargetProperties | APITargetProperties;
22+
lambda?: LambdaProperties;
23+
sam?: SAMCLIProperties;
24+
api?: APIGatewayProperties;
25+
}
26+
/**
27+
* AWS connection details
28+
*/
29+
export interface AWSConnection {
30+
/**
31+
* The AWS credentials provider and name to use during the invocation. Example: credential profile "default" would be entered as `profile:default`.
32+
*/
33+
credentials?: string;
34+
/**
35+
* AWS region to use during the invocation.
36+
*/
37+
region?: string;
38+
}
39+
/**
40+
* Configures the application to launch
41+
*/
42+
export interface TemplateTargetProperties {
43+
/**
44+
* Path to the CFN/SAM template.
45+
*/
46+
templatePath: string;
47+
/**
48+
* Resource name of an AWS::Lambda::Function or AWS::Serverless::Function to invoke.
49+
*/
50+
logicalId: string;
51+
/**
52+
* The type of invocation to launch. Possible values:
53+
* * `template` uses a CFN/SAM Template as an entrypoint
54+
* * `code` invokes Lambda code directly.
55+
* * `api` uses the CFN/SAM Template to emulate API Gateway
56+
*/
57+
target: "template";
58+
}
59+
/**
60+
* Configures the application to launch
61+
*/
62+
export interface CodeTargetProperties {
63+
/**
64+
* Lambda Function handler to invoke.
65+
*/
66+
lambdaHandler: string;
67+
/**
68+
* The root of the project, used to determine where in the file-system to locate the lambdaHandler.
69+
*/
70+
projectRoot: string;
71+
/**
72+
* The type of invocation to launch. Possible values:
73+
* * `template` uses a CFN/SAM Template as an entrypoint
74+
* * `code` invokes Lambda code directly.
75+
* * `api` uses the CFN/SAM Template to emulate API Gateway
76+
*/
77+
target: "code";
78+
/**
79+
* Architecture used for local SAM Lambda emulation
80+
*/
81+
architecture?: "x86_64" | "arm64";
82+
}
83+
/**
84+
* Configures the application to launch
85+
*/
86+
export interface APITargetProperties {
87+
/**
88+
* Path to the CFN/SAM template.
89+
*/
90+
templatePath: string;
91+
/**
92+
* Resource name of an AWS::Lambda::Function or AWS::Serverless::Function to invoke.
93+
*/
94+
logicalId: string;
95+
/**
96+
* The type of invocation to launch. Possible values:
97+
* * `template` uses a CFN/SAM Template as an entrypoint
98+
* * `code` invokes Lambda code directly.
99+
* * `api` uses the CFN/SAM Template to emulate API Gateway
100+
*/
101+
target: "api";
102+
}
103+
/**
104+
* Lambda specific details of the invocation
105+
*/
106+
export interface LambdaProperties {
107+
/**
108+
* Environment variables to pass to the function invocation (replaces template variables).
109+
*/
110+
environmentVariables?: {
111+
[k: string]: string;
112+
};
113+
/**
114+
* Event payload to pass to the Lambda invocation.
115+
* Must specify one of 'json' or 'path'.
116+
*/
117+
payload?: {
118+
/**
119+
* JSON definition to use as the event payload
120+
*/
121+
json?: {
122+
[k: string]: unknown;
123+
};
124+
/**
125+
* Path to a file to use as the event payload
126+
*/
127+
path?: string;
128+
};
129+
/**
130+
* The amount of memory (in Mb) the Lambda function has access to.
131+
*/
132+
memoryMb?: number;
133+
/**
134+
* The Lambda Function's runtime
135+
*/
136+
runtime?: string;
137+
/**
138+
* The amount of time (in seconds) that Lambda allows a function to run before stopping it.
139+
*/
140+
timeoutSec?: number;
141+
pathMappings?: PathMapping[];
142+
}
143+
export interface PathMapping {
144+
localRoot: string;
145+
remoteRoot: string;
146+
}
147+
/**
148+
* SAM CLI specific configurations
149+
*/
150+
export interface SAMCLIProperties {
151+
/**
152+
* Additional arguments to pass to the `sam build` command.
153+
*/
154+
buildArguments?: string[];
155+
/**
156+
* Base directory to build and run the application.
157+
* A temporary directory will be created if not specified.
158+
*/
159+
buildDir?: string;
160+
/**
161+
* Whether to build inside a container (default: false).
162+
*/
163+
containerBuild?: boolean;
164+
/**
165+
* Specifies the name or id of an existing Docker network that Lambda Docker containers should connect to.
166+
*/
167+
dockerNetwork?: string;
168+
/**
169+
* Additional arguments to pass to the `sam local` command.
170+
*/
171+
localArguments?: string[];
172+
/**
173+
* Specifies whether the command should skip pulling down the latest Docker image for Lambda runtime (default: false).
174+
*/
175+
skipNewImageCheck?: boolean;
176+
/**
177+
* Values to override in the template
178+
*/
179+
template?: {
180+
/**
181+
* Key:value mappings for SAM template parameter overrides. More information can be found here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stackinstances-override.html#stackinstances-override-cli
182+
*/
183+
parameters?: {
184+
[k: string]: string | number;
185+
};
186+
};
187+
}
188+
/**
189+
* API Gateway configuration
190+
*/
191+
export interface APIGatewayProperties {
192+
/**
193+
* The path to the api (must start with /)
194+
*/
195+
path: string;
196+
/**
197+
* The HTTP message method that will be used
198+
*/
199+
httpMethod: "delete" | "get" | "head" | "options" | "patch" | "post" | "put";
200+
/**
201+
* Event payload to pass to the Lambda invocation.
202+
* Must specify one of 'json' or 'path'.
203+
*/
204+
payload?: {
205+
/**
206+
* JSON definition to use as the event payload
207+
*/
208+
json?: {
209+
[k: string]: unknown;
210+
};
211+
/**
212+
* Path to a file to use as the event payload
213+
*/
214+
path?: string;
215+
};
216+
/**
217+
* Additional HTTP headers
218+
*/
219+
headers?: {
220+
[k: string]: string;
221+
};
222+
/**
223+
* URL query string (e.g. key=foo&value=bar)
224+
*/
225+
querystring?: string;
226+
/**
227+
* key-value map of API Gateway stage variables
228+
*/
229+
stageVariables?: {
230+
[k: string]: string;
231+
};
232+
/**
233+
* The API Gateway client certificate ID
234+
*/
235+
clientCertificateId?: string;
236+
}

0 commit comments

Comments
 (0)