@friggframework/devtools 2.0.0--canary.413.90e34c7.0 → 2.0.0--canary.414.61d0ef1.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.
@@ -1,9 +1,44 @@
1
1
  const { spawn, spawnSync } = require('child_process');
2
2
  const path = require('path');
3
+ const fs = require('fs');
3
4
 
4
5
  async function deployCommand(options) {
5
6
  console.log('Deploying the serverless application...');
6
-
7
+
8
+ // Try to load and validate environment from appDefinition
9
+ const appDefPath = path.join(process.cwd(), 'index.js');
10
+ if (fs.existsSync(appDefPath)) {
11
+ try {
12
+ const { Definition } = require(appDefPath);
13
+
14
+ 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
+
19
+ // Try to use the env-validator if available
20
+ try {
21
+ const { validateEnvironmentVariables } = require('@friggframework/devtools/infrastructure/env-validator');
22
+ 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');
27
+ }
28
+ } catch (validatorError) {
29
+ // Validator not available in current version, just warn
30
+ const missing = envVars.filter(v => !process.env[v]);
31
+ 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');
34
+ }
35
+ }
36
+ }
37
+ } catch (error) {
38
+ console.warn('Could not load appDefinition environment config:', error.message);
39
+ }
40
+ }
41
+
7
42
  // AWS discovery is now handled directly in serverless-template.js
8
43
  console.log('🚀 Deploying serverless application...');
9
44
  const backendPath = path.resolve(process.cwd());
@@ -14,15 +49,12 @@ async function deployCommand(options) {
14
49
  '--config',
15
50
  infrastructurePath,
16
51
  '--stage',
17
- options.stage,
52
+ options.stage
18
53
  ];
19
54
 
20
- console.log('>>> Env vars: ', JSON.stringify(process.env));
21
-
22
55
  const childProcess = spawn(command, serverlessArgs, {
23
56
  cwd: backendPath,
24
57
  stdio: 'inherit',
25
- env: { ...process.env },
26
58
  });
27
59
 
28
60
  childProcess.on('error', (error) => {