-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating the frigg cli for deploy (#372)
### TL;DR Added build and deploy commands to the Frigg CLI tool and included serverless as a dependency. ### What changed? - Created new build command that packages serverless applications - Added deploy command for serverless deployment - Integrated both commands into the main CLI program - Added serverless v3.39.0 as a dependency - Updated tailwindcss from 3.4.7 to 3.4.10 ### How to test? 1. Run `frigg build` to package your serverless application 2. Run `frigg deploy` to deploy your serverless application 3. Verify both commands execute successfully with your infrastructure.js configuration 4. Check that the deployment process completes without errors ### Why make this change? To streamline the development workflow by providing direct CLI commands for building and deploying serverless applications, eliminating the need to run serverless commands manually.
- Loading branch information
Showing
5 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { spawn } = require('child_process'); | ||
const path = require('path'); | ||
|
||
function buildCommand(...args) { | ||
console.log('Building the serverless application...'); | ||
const backendPath = path.resolve(process.cwd()); | ||
const infrastructurePath = 'infrastructure.js'; | ||
const command = 'serverless'; | ||
const serverlessArgs = ['package', '--config', infrastructurePath, ...args.filter(arg => arg !== 'build')]; | ||
|
||
const childProcess = spawn(command, serverlessArgs, { | ||
cwd: backendPath, | ||
stdio: 'inherit', | ||
}); | ||
|
||
childProcess.on('error', (error) => { | ||
console.error(`Error executing command: ${error.message}`); | ||
}); | ||
|
||
childProcess.on('close', (code) => { | ||
if (code !== 0) { | ||
console.log(`Child process exited with code ${code}`); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { buildCommand }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { spawn } = require('child_process'); | ||
const path = require('path'); | ||
|
||
function deployCommand(...args) { | ||
console.log('Deploying the serverless application...'); | ||
const backendPath = path.resolve(process.cwd()); | ||
const infrastructurePath = 'infrastructure.js'; | ||
const command = 'serverless'; | ||
const serverlessArgs = ['deploy', '--config', infrastructurePath, ...args.filter(arg => arg !== 'deploy')]; | ||
|
||
const childProcess = spawn(command, serverlessArgs, { | ||
cwd: backendPath, | ||
stdio: 'inherit', | ||
}); | ||
|
||
childProcess.on('error', (error) => { | ||
console.error(`Error executing command: ${error.message}`); | ||
}); | ||
|
||
childProcess.on('close', (code) => { | ||
if (code !== 0) { | ||
console.log(`Child process exited with code ${code}`); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { deployCommand }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters