@friggframework/devtools 2.0.0-next.5 → 2.0.0-next.7

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.
@@ -0,0 +1,33 @@
1
+ const { spawn } = require('child_process');
2
+ const path = require('path');
3
+
4
+ function buildCommand(options) {
5
+ console.log('Building the serverless application...');
6
+ const backendPath = path.resolve(process.cwd());
7
+ const infrastructurePath = 'infrastructure.js';
8
+ const command = 'serverless';
9
+ const serverlessArgs = [
10
+ 'package',
11
+ '--config',
12
+ infrastructurePath,
13
+ '--stage',
14
+ options.stage
15
+ ];
16
+
17
+ const childProcess = spawn(command, serverlessArgs, {
18
+ cwd: backendPath,
19
+ stdio: 'inherit',
20
+ });
21
+
22
+ childProcess.on('error', (error) => {
23
+ console.error(`Error executing command: ${error.message}`);
24
+ });
25
+
26
+ childProcess.on('close', (code) => {
27
+ if (code !== 0) {
28
+ console.log(`Child process exited with code ${code}`);
29
+ }
30
+ });
31
+ }
32
+
33
+ module.exports = { buildCommand };
@@ -0,0 +1,33 @@
1
+ const { spawn } = require('child_process');
2
+ const path = require('path');
3
+
4
+ function deployCommand(options) {
5
+ console.log('Deploying the serverless application...');
6
+ const backendPath = path.resolve(process.cwd());
7
+ const infrastructurePath = 'infrastructure.js';
8
+ const command = 'serverless';
9
+ const serverlessArgs = [
10
+ 'deploy',
11
+ '--config',
12
+ infrastructurePath,
13
+ '--stage',
14
+ options.stage
15
+ ];
16
+
17
+ const childProcess = spawn(command, serverlessArgs, {
18
+ cwd: backendPath,
19
+ stdio: 'inherit',
20
+ });
21
+
22
+ childProcess.on('error', (error) => {
23
+ console.error(`Error executing command: ${error.message}`);
24
+ });
25
+
26
+ childProcess.on('close', (code) => {
27
+ if (code !== 0) {
28
+ console.log(`Child process exited with code ${code}`);
29
+ }
30
+ });
31
+ }
32
+
33
+ module.exports = { deployCommand };
@@ -3,6 +3,8 @@
3
3
  const { Command } = require('commander');
4
4
  const { installCommand } = require('./install-command');
5
5
  const { startCommand } = require('./start-command'); // Assuming you have a startCommand module
6
+ const { buildCommand } = require('./build-command');
7
+ const { deployCommand } = require('./deploy-command');
6
8
 
7
9
  const program = new Command();
8
10
  program
@@ -13,8 +15,21 @@ program
13
15
  program
14
16
  .command('start')
15
17
  .description('Run the backend and optional frontend')
18
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
16
19
  .action(startCommand);
17
20
 
21
+ program
22
+ .command('build')
23
+ .description('Build the serverless application')
24
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
25
+ .action(buildCommand);
26
+
27
+ program
28
+ .command('deploy')
29
+ .description('Deploy the serverless application')
30
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
31
+ .action(deployCommand);
32
+
18
33
  program.parse(process.argv);
19
34
 
20
- module.exports = { installCommand, startCommand };
35
+ module.exports = { installCommand, startCommand, buildCommand, deployCommand };
@@ -1,7 +1,7 @@
1
1
  const { spawn } = require('child_process');
2
2
  const path = require('path');
3
3
 
4
- function startCommand() {
4
+ function startCommand(options) {
5
5
  console.log('Starting backend and optional frontend...');
6
6
  // Suppress AWS SDK warning message about maintenance mode
7
7
  process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = 1;
@@ -9,7 +9,13 @@ function startCommand() {
9
9
  console.log(`Starting backend in ${backendPath}...`);
10
10
  const infrastructurePath = 'infrastructure.js';
11
11
  const command = 'serverless';
12
- const args = ['offline', '--config', infrastructurePath, '--stage=dev'];
12
+ const args = [
13
+ 'offline',
14
+ '--config',
15
+ infrastructurePath,
16
+ '--stage',
17
+ options.stage
18
+ ];
13
19
 
14
20
  const childProcess = spawn(command, args, {
15
21
  cwd: backendPath,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0-next.5",
4
+ "version": "2.0.0-next.7",
5
5
  "dependencies": {
6
6
  "@babel/eslint-parser": "^7.18.9",
7
7
  "@babel/parser": "^7.25.3",
8
8
  "@babel/traverse": "^7.25.3",
9
- "@friggframework/core": "2.0.0-next.5",
10
- "@friggframework/test": "2.0.0-next.5",
9
+ "@friggframework/core": "2.0.0-next.7",
10
+ "@friggframework/test": "2.0.0-next.7",
11
11
  "@hapi/boom": "^7.4.11",
12
12
  "@inquirer/prompts": "^5.3.8",
13
13
  "axios": "^1.7.2",
@@ -28,8 +28,9 @@
28
28
  "serverless-http": "^2.7.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@friggframework/eslint-config": "2.0.0-next.5",
32
- "@friggframework/prettier-config": "2.0.0-next.5",
31
+ "@friggframework/eslint-config": "2.0.0-next.7",
32
+ "@friggframework/prettier-config": "2.0.0-next.7",
33
+ "serverless": "3.39.0",
33
34
  "serverless-dotenv-plugin": "^6.0.0",
34
35
  "serverless-offline": "^13.8.0",
35
36
  "serverless-offline-sqs": "^8.0.0",
@@ -57,5 +58,5 @@
57
58
  "publishConfig": {
58
59
  "access": "public"
59
60
  },
60
- "gitHead": "6c1a3214f234f02d6380d6bdc7986f984068230a"
61
+ "gitHead": "0259d545da469887ada4b120550f05b9c7275427"
61
62
  }