@friggframework/devtools 2.0.0--canary.414.70cdf1e.0 → 2.0.0--canary.414.891364b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,6 +2,34 @@ const { spawn, spawnSync } = require('child_process');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Constructs filtered environment variables for serverless deployment
|
|
7
|
+
* @param {string[]} envVars - Array of environment variable names from app definition
|
|
8
|
+
* @returns {Object} Filtered environment variables object
|
|
9
|
+
*/
|
|
10
|
+
function buildFilteredEnvironment(envVars) {
|
|
11
|
+
return {
|
|
12
|
+
// Essential system variables needed to run serverless
|
|
13
|
+
PATH: process.env.PATH,
|
|
14
|
+
HOME: process.env.HOME,
|
|
15
|
+
USER: process.env.USER,
|
|
16
|
+
|
|
17
|
+
// AWS credentials and configuration (all AWS_ prefixed variables)
|
|
18
|
+
...Object.fromEntries(
|
|
19
|
+
Object.entries(process.env).filter(([key]) =>
|
|
20
|
+
key.startsWith('AWS_')
|
|
21
|
+
)
|
|
22
|
+
),
|
|
23
|
+
|
|
24
|
+
// App-defined environment variables
|
|
25
|
+
...Object.fromEntries(
|
|
26
|
+
envVars
|
|
27
|
+
.map((key) => [key, process.env[key]])
|
|
28
|
+
.filter(([_, value]) => value !== undefined)
|
|
29
|
+
),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
5
33
|
async function deployCommand(options) {
|
|
6
34
|
console.log('Deploying the serverless application...');
|
|
7
35
|
|
|
@@ -39,7 +67,11 @@ async function deployCommand(options) {
|
|
|
39
67
|
!options.skipEnvValidation
|
|
40
68
|
) {
|
|
41
69
|
console.warn(
|
|
42
|
-
`⚠️ Warning: Missing ${
|
|
70
|
+
`⚠️ Warning: Missing ${
|
|
71
|
+
validation.missing.length
|
|
72
|
+
} environment variables: ${validation.missing.join(
|
|
73
|
+
', '
|
|
74
|
+
)}`
|
|
43
75
|
);
|
|
44
76
|
console.warn(
|
|
45
77
|
' These variables are optional and deployment will continue'
|
|
@@ -50,33 +82,16 @@ async function deployCommand(options) {
|
|
|
50
82
|
}
|
|
51
83
|
|
|
52
84
|
// Pass essential system variables + AWS credentials + app-defined environment variables
|
|
53
|
-
integrationEnvironmentVariables =
|
|
54
|
-
|
|
55
|
-
PATH: process.env.PATH,
|
|
56
|
-
HOME: process.env.HOME,
|
|
57
|
-
USER: process.env.USER,
|
|
58
|
-
|
|
59
|
-
// AWS credentials and configuration (all AWS_ prefixed variables)
|
|
60
|
-
...Object.fromEntries(
|
|
61
|
-
Object.entries(process.env)
|
|
62
|
-
.filter(([key]) => key.startsWith('AWS_'))
|
|
63
|
-
),
|
|
64
|
-
|
|
65
|
-
// App-defined environment variables
|
|
66
|
-
...Object.fromEntries(
|
|
67
|
-
envVars
|
|
68
|
-
.map((key) => [key, process.env[key]])
|
|
69
|
-
.filter(([_, value]) => value !== undefined)
|
|
70
|
-
)
|
|
71
|
-
};
|
|
85
|
+
integrationEnvironmentVariables =
|
|
86
|
+
buildFilteredEnvironment(envVars);
|
|
72
87
|
} catch (validatorError) {
|
|
73
88
|
// Validator not available in current version, just warn
|
|
74
89
|
const missing = envVars.filter((v) => !process.env[v]);
|
|
75
90
|
if (missing.length > 0) {
|
|
76
91
|
console.warn(
|
|
77
|
-
`⚠️ Warning: Missing ${
|
|
78
|
-
|
|
79
|
-
)}`
|
|
92
|
+
`⚠️ Warning: Missing ${
|
|
93
|
+
missing.length
|
|
94
|
+
} environment variables: ${missing.join(', ')}`
|
|
80
95
|
);
|
|
81
96
|
console.warn(
|
|
82
97
|
' These variables are optional and deployment will continue'
|
|
@@ -87,25 +102,8 @@ async function deployCommand(options) {
|
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
// Pass essential system variables + AWS credentials + app-defined environment variables
|
|
90
|
-
integrationEnvironmentVariables =
|
|
91
|
-
|
|
92
|
-
PATH: process.env.PATH,
|
|
93
|
-
HOME: process.env.HOME,
|
|
94
|
-
USER: process.env.USER,
|
|
95
|
-
|
|
96
|
-
// AWS credentials and configuration (all AWS_ prefixed variables)
|
|
97
|
-
...Object.fromEntries(
|
|
98
|
-
Object.entries(process.env)
|
|
99
|
-
.filter(([key]) => key.startsWith('AWS_'))
|
|
100
|
-
),
|
|
101
|
-
|
|
102
|
-
// App-defined environment variables
|
|
103
|
-
...Object.fromEntries(
|
|
104
|
-
envVars
|
|
105
|
-
.map((key) => [key, process.env[key]])
|
|
106
|
-
.filter(([_, value]) => value !== undefined)
|
|
107
|
-
)
|
|
108
|
-
};
|
|
105
|
+
integrationEnvironmentVariables =
|
|
106
|
+
buildFilteredEnvironment(envVars);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
} catch (error) {
|
|
@@ -119,8 +117,6 @@ async function deployCommand(options) {
|
|
|
119
117
|
|
|
120
118
|
// AWS discovery is now handled directly in serverless-template.js
|
|
121
119
|
console.log('🚀 Deploying serverless application...');
|
|
122
|
-
console.log('📋 Final environment variables being passed to serverless:');
|
|
123
|
-
console.log(' ', Object.keys(integrationEnvironmentVariables).sort().join(', '));
|
|
124
120
|
const backendPath = path.resolve(process.cwd());
|
|
125
121
|
const infrastructurePath = 'infrastructure.js';
|
|
126
122
|
const command = 'serverless';
|
|
@@ -135,7 +131,7 @@ async function deployCommand(options) {
|
|
|
135
131
|
const childProcess = spawn(command, serverlessArgs, {
|
|
136
132
|
cwd: backendPath,
|
|
137
133
|
stdio: 'inherit',
|
|
138
|
-
env: integrationEnvironmentVariables,
|
|
134
|
+
env: integrationEnvironmentVariables,
|
|
139
135
|
});
|
|
140
136
|
|
|
141
137
|
childProcess.on('error', (error) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.414.
|
|
4
|
+
"version": "2.0.0--canary.414.891364b.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"@babel/eslint-parser": "^7.18.9",
|
|
10
10
|
"@babel/parser": "^7.25.3",
|
|
11
11
|
"@babel/traverse": "^7.25.3",
|
|
12
|
-
"@friggframework/schemas": "2.0.0--canary.414.
|
|
13
|
-
"@friggframework/test": "2.0.0--canary.414.
|
|
12
|
+
"@friggframework/schemas": "2.0.0--canary.414.891364b.0",
|
|
13
|
+
"@friggframework/test": "2.0.0--canary.414.891364b.0",
|
|
14
14
|
"@hapi/boom": "^10.0.1",
|
|
15
15
|
"@inquirer/prompts": "^5.3.8",
|
|
16
16
|
"axios": "^1.7.2",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"serverless-http": "^2.7.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@friggframework/eslint-config": "2.0.0--canary.414.
|
|
36
|
-
"@friggframework/prettier-config": "2.0.0--canary.414.
|
|
35
|
+
"@friggframework/eslint-config": "2.0.0--canary.414.891364b.0",
|
|
36
|
+
"@friggframework/prettier-config": "2.0.0--canary.414.891364b.0",
|
|
37
37
|
"prettier": "^2.7.1",
|
|
38
38
|
"serverless": "3.39.0",
|
|
39
39
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "891364bc82bb21ca6bf895a75eb47aa91e577724"
|
|
69
69
|
}
|