Skip to content

Commit df831e8

Browse files
committed
feat: allow additional NODE_OPTIONS
1 parent 1c90816 commit df831e8

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"lint": "eslint . --fix",
4242
"prettier": "prettier . --write",
4343
"prepare": "husky",
44-
"add-bang": "sed -i '1s|^|#!/usr/bin/env node\\n|' ./dist/lldebugger.mjs",
44+
"add-bang": "printf '#!/usr/bin/env node\\n%s' \"$(cat ./dist/lldebugger.mjs)\" > ./dist/lldebugger.mjs.tmp && mv ./dist/lldebugger.mjs.tmp ./dist/lldebugger.mjs",
4545
"build": "tsc -p tsconfig.build.json && cp src/nodeWorkerRunner.mjs dist && cp src/frameworks/cdkFrameworkWorker.mjs dist/frameworks && node fix-imports.js && npm run add-bang && npm run bundle-extension",
4646
"bundle-extension": "cd src/extension && npm run build && cd ../../",
4747
"deploy-github-role": "aws cloudformation deploy --stack-name lld-deploy-role --template-file cloudformation/gitHubDeployRole.yaml --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --profile lldebugger",

src/infraDeploy.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,19 @@ function getEnvironmentVarablesForDebugger(
559559
functionId: string,
560560
timeout: number | undefined,
561561
): Record<string, string> {
562+
const baseNodeOptions = '--enable-source-maps';
563+
const additionalNodeOptions =
564+
Configuration.config.additionalNodeOptions || '';
565+
const nodeOptions = [baseNodeOptions, additionalNodeOptions]
566+
.filter(Boolean)
567+
.join(' ');
568+
569+
console.log('nodeOptions', nodeOptions);
570+
562571
return {
563572
LLD_FUNCTION_ID: functionId,
564573
AWS_LAMBDA_EXEC_WRAPPER: '/opt/lld-wrapper',
565-
NODE_OPTIONS: '--enable-source-maps',
574+
NODE_OPTIONS: nodeOptions,
566575
LLD_DEBUGGER_ID: Configuration.config.debuggerId,
567576
LLD_INITIAL_TIMEOUT: timeout ? timeout.toString() : '-1', // should never be negative
568577
LLD_OBSERVABLE_MODE: Configuration.config.observable ? 'true' : 'false',

src/types/lldConfig.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export type LldConfigBase = {
6868
* Monorepo subfolder
6969
*/
7070
subfolder?: string;
71+
72+
/**
73+
* Additional Node options
74+
*/
75+
additionalNodeOptions?: string;
7176
} & AwsConfiguration;
7277

7378
export type LldConfigCliArgs = {

0 commit comments

Comments
 (0)