Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

43 changes: 40 additions & 3 deletions packages/devtools/frigg-cli/deploy-command/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,53 @@ async function runPostDeploymentHealthCheck(stackName, options) {
}

async function deployCommand(options) {
const stage = options.stage || 'dev';
const region = process.env.AWS_REGION || 'us-east-1';

if (options.dryRun) {
console.log('🔍 Running deployment dry-run...\n');

try {
const { executeDryRun } = require('./dry-run');
const appPath = process.cwd();
const appDefinition = loadAppDefinition();

if (!appDefinition) {
console.error('❌ Could not load app definition from index.js');
process.exit(1);
}

const stackName = getStackName(appDefinition, options);
if (!stackName) {
console.error('❌ Could not determine stack name from app definition');
process.exit(1);
}

const report = await executeDryRun({
appPath,
stackName,
region,
stage,
options,
});

process.exit(report.getExitCode());
} catch (error) {
console.error(`\n❌ Dry-run failed: ${error.message}`);
if (options.verbose) {
console.error(error.stack);
}
process.exit(1);
}
}

console.log('Deploying the serverless application...');

const appDefinition = loadAppDefinition();
const environment = validateAndBuildEnvironment(appDefinition, options);

// Execute deployment
const exitCode = await executeServerlessDeployment(environment, options);

// Check if deployment was successful
if (exitCode !== 0) {
console.error(`\n✗ Deployment failed with exit code ${exitCode}`);
process.exit(exitCode);
Expand All @@ -286,7 +324,6 @@ async function deployCommand(options) {

const skipHealthCheck = options.skipDoctor || appDefinition?.deployment?.skipPostDeploymentHealthCheck;

// Run post-deployment health check (unless disabled)
if (!skipHealthCheck) {
const stackName = getStackName(appDefinition, options);

Expand Down
3 changes: 3 additions & 0 deletions packages/devtools/frigg-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ program
.option('-v, --verbose', 'enable verbose output')
.option('-f, --force', 'force deployment (bypasses caching for layers and functions)')
.option('--skip-doctor', 'skip post-deployment health check')
.option('--skip-env-validation', 'skip environment variable validation')
.option('--dry-run', 'preview deployment changes without executing')
.option('--output <format>', 'output format for dry-run (console or json)', 'console')
.action(deployCommand);

program
Expand Down
3 changes: 2 additions & 1 deletion packages/devtools/frigg-cli/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module.exports = {
'<rootDir>/__tests__/**/*.test.js',
'<rootDir>/__tests__/**/*.spec.js',
'<rootDir>/**/start-command.test.js',
'<rootDir>/**/__tests__/**/*.test.js'
'<rootDir>/**/__tests__/**/*.test.js',
'<rootDir>/deploy-command/**/*.test.js'
],
// Exclude utility files and config from being treated as tests
testPathIgnorePatterns: [
Expand Down
Loading