@friggframework/devtools 2.0.0--canary.414.61d0ef1.0 → 2.0.0--canary.414.451bd3d.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.
@@ -4,41 +4,85 @@ const fs = require('fs');
4
4
 
5
5
  async function deployCommand(options) {
6
6
  console.log('Deploying the serverless application...');
7
-
7
+
8
+ // Collect validated environment variables
9
+ let integrationEnvironmentVariables = { ...process.env }; // Start with all, then filter
10
+
8
11
  // Try to load and validate environment from appDefinition
9
12
  const appDefPath = path.join(process.cwd(), 'index.js');
10
13
  if (fs.existsSync(appDefPath)) {
11
14
  try {
12
15
  const { Definition } = require(appDefPath);
13
-
16
+
14
17
  if (Definition.environment) {
15
- console.log('🔧 Loading environment configuration from appDefinition...');
16
- const envVars = Object.keys(Definition.environment).filter(key => Definition.environment[key] === true);
17
- console.log(` Found ${envVars.length} environment variables: ${envVars.join(', ')}`);
18
-
18
+ console.log(
19
+ '🔧 Loading environment configuration from appDefinition...'
20
+ );
21
+ const envVars = Object.keys(Definition.environment).filter(
22
+ (key) => Definition.environment[key] === true
23
+ );
24
+ console.log(
25
+ ` Found ${
26
+ envVars.length
27
+ } environment variables: ${envVars.join(', ')}`
28
+ );
29
+
19
30
  // Try to use the env-validator if available
20
31
  try {
21
- const { validateEnvironmentVariables } = require('@friggframework/devtools/infrastructure/env-validator');
32
+ const {
33
+ validateEnvironmentVariables,
34
+ } = require('@friggframework/devtools/infrastructure/env-validator');
22
35
  const validation = validateEnvironmentVariables(Definition);
23
-
24
- if (validation.missing.length > 0 && !options.skipEnvValidation) {
25
- console.warn('⚠️ Warning: Missing environment variables detected');
26
- console.warn(' Run with --skip-env-validation to bypass this check');
36
+
37
+ if (
38
+ validation.missing.length > 0 &&
39
+ !options.skipEnvValidation
40
+ ) {
41
+ console.warn(
42
+ '⚠️ Warning: Missing environment variables detected'
43
+ );
44
+ console.warn(
45
+ ' Run with --skip-env-validation to bypass this check'
46
+ );
27
47
  }
48
+
49
+ // Only pass the environment variables defined in app definition
50
+ integrationEnvironmentVariables = Object.fromEntries(
51
+ envVars
52
+ .map((key) => [key, process.env[key]])
53
+ .filter(([_, value]) => value !== undefined)
54
+ );
28
55
  } catch (validatorError) {
29
56
  // Validator not available in current version, just warn
30
- const missing = envVars.filter(v => !process.env[v]);
57
+ const missing = envVars.filter((v) => !process.env[v]);
31
58
  if (missing.length > 0) {
32
- console.warn(`⚠️ Warning: Missing environment variables: ${missing.join(', ')}`);
33
- console.warn(' These should be set in your CI/CD environment or .env file');
59
+ console.warn(
60
+ `⚠️ Warning: Missing environment variables: ${missing.join(
61
+ ', '
62
+ )}`
63
+ );
64
+ console.warn(
65
+ ' These should be set in your CI/CD environment or .env file'
66
+ );
34
67
  }
68
+
69
+ // Only pass the environment variables defined in app definition
70
+ integrationEnvironmentVariables = Object.fromEntries(
71
+ envVars
72
+ .map((key) => [key, process.env[key]])
73
+ .filter(([_, value]) => value !== undefined)
74
+ );
35
75
  }
36
76
  }
37
77
  } catch (error) {
38
- console.warn('Could not load appDefinition environment config:', error.message);
78
+ console.warn(
79
+ 'Could not load appDefinition environment config:',
80
+ error.message
81
+ );
82
+ // Keep all env vars if we can't validate
39
83
  }
40
84
  }
41
-
85
+
42
86
  // AWS discovery is now handled directly in serverless-template.js
43
87
  console.log('🚀 Deploying serverless application...');
44
88
  const backendPath = path.resolve(process.cwd());
@@ -49,12 +93,13 @@ async function deployCommand(options) {
49
93
  '--config',
50
94
  infrastructurePath,
51
95
  '--stage',
52
- options.stage
96
+ options.stage,
53
97
  ];
54
98
 
55
99
  const childProcess = spawn(command, serverlessArgs, {
56
100
  cwd: backendPath,
57
101
  stdio: 'inherit',
102
+ env: integrationEnvironmentVariables, // Only pass validated environment variables
58
103
  });
59
104
 
60
105
  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.61d0ef1.0",
4
+ "version": "2.0.0--canary.414.451bd3d.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.61d0ef1.0",
13
- "@friggframework/test": "2.0.0--canary.414.61d0ef1.0",
12
+ "@friggframework/schemas": "2.0.0--canary.414.451bd3d.0",
13
+ "@friggframework/test": "2.0.0--canary.414.451bd3d.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.61d0ef1.0",
36
- "@friggframework/prettier-config": "2.0.0--canary.414.61d0ef1.0",
35
+ "@friggframework/eslint-config": "2.0.0--canary.414.451bd3d.0",
36
+ "@friggframework/prettier-config": "2.0.0--canary.414.451bd3d.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": "61d0ef18cc849b8d26e67221c368bde48543c0dd"
68
+ "gitHead": "451bd3d3806486912081d804266987b1861bdd5d"
69
69
  }