@friggframework/devtools 2.0.0-next.6 → 2.0.0-next.8

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,12 +1,18 @@
1
1
  const { spawn } = require('child_process');
2
2
  const path = require('path');
3
3
 
4
- function buildCommand(...args) {
4
+ function buildCommand(options) {
5
5
  console.log('Building the serverless application...');
6
6
  const backendPath = path.resolve(process.cwd());
7
7
  const infrastructurePath = 'infrastructure.js';
8
8
  const command = 'serverless';
9
- const serverlessArgs = ['package', '--config', infrastructurePath, ...args.filter(arg => arg !== 'build')];
9
+ const serverlessArgs = [
10
+ 'package',
11
+ '--config',
12
+ infrastructurePath,
13
+ '--stage',
14
+ options.stage
15
+ ];
10
16
 
11
17
  const childProcess = spawn(command, serverlessArgs, {
12
18
  cwd: backendPath,
@@ -22,6 +28,6 @@ function buildCommand(...args) {
22
28
  console.log(`Child process exited with code ${code}`);
23
29
  }
24
30
  });
25
- }
31
+ }
26
32
 
27
33
  module.exports = { buildCommand };
@@ -1,12 +1,18 @@
1
1
  const { spawn } = require('child_process');
2
2
  const path = require('path');
3
3
 
4
- function deployCommand(...args) {
4
+ function deployCommand(options) {
5
5
  console.log('Deploying the serverless application...');
6
6
  const backendPath = path.resolve(process.cwd());
7
7
  const infrastructurePath = 'infrastructure.js';
8
8
  const command = 'serverless';
9
- const serverlessArgs = ['deploy', '--config', infrastructurePath, ...args.filter(arg => arg !== 'deploy')];
9
+ const serverlessArgs = [
10
+ 'deploy',
11
+ '--config',
12
+ infrastructurePath,
13
+ '--stage',
14
+ options.stage
15
+ ];
10
16
 
11
17
  const childProcess = spawn(command, serverlessArgs, {
12
18
  cwd: backendPath,
@@ -15,16 +15,19 @@ program
15
15
  program
16
16
  .command('start')
17
17
  .description('Run the backend and optional frontend')
18
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
18
19
  .action(startCommand);
19
20
 
20
21
  program
21
22
  .command('build')
22
23
  .description('Build the serverless application')
24
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
23
25
  .action(buildCommand);
24
26
 
25
27
  program
26
28
  .command('deploy')
27
29
  .description('Deploy the serverless application')
30
+ .option('-s, --stage <stage>', 'deployment stage', 'dev')
28
31
  .action(deployCommand);
29
32
 
30
33
  program.parse(process.argv);
@@ -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,
@@ -1,7 +1,7 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs');
3
3
 
4
- const composeServerlessDefinition = (AppDefinition, IntegrationFactory) => {
4
+ const composeServerlessDefinition = (AppDefinition) => {
5
5
  const definition = {
6
6
  frameworkVersion: '>=3.17.0',
7
7
  service: AppDefinition.name || 'create-frigg-app',
@@ -213,7 +213,7 @@ const composeServerlessDefinition = (AppDefinition, IntegrationFactory) => {
213
213
  };
214
214
 
215
215
  // Add integration-specific functions and resources
216
- AppDefinition.integrations.forEach((integration) => {
216
+ for (const integration of AppDefinition.integrations) {
217
217
  const integrationName = integration.Definition.name;
218
218
 
219
219
  // Add function for the integration
@@ -229,7 +229,7 @@ const composeServerlessDefinition = (AppDefinition, IntegrationFactory) => {
229
229
  events: [
230
230
  {
231
231
  http: {
232
- path: `/api/${integrationName}-integration/{proxy*}`,
232
+ path: `/api/${integrationName}-integration/{proxy+}`,
233
233
  method: 'ANY',
234
234
  cors: true,
235
235
  },
@@ -277,13 +277,13 @@ const composeServerlessDefinition = (AppDefinition, IntegrationFactory) => {
277
277
  // Add Queue URL for the integration to the ENVironment variables
278
278
  definition.provider.environment = {
279
279
  ...definition.provider.environment,
280
- [integrationName.toUpperCase() + '_QUEUE_URL']: {
280
+ [`${integrationName.toUpperCase()}_QUEUE_URL`]: {
281
281
  Ref: queueReference,
282
282
  },
283
283
  };
284
284
 
285
285
  definition.custom[queueReference] = queueName;
286
- });
286
+ }
287
287
 
288
288
  return definition;
289
289
  };
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.6",
4
+ "version": "2.0.0-next.8",
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.6",
10
- "@friggframework/test": "2.0.0-next.6",
9
+ "@friggframework/core": "2.0.0-next.8",
10
+ "@friggframework/test": "2.0.0-next.8",
11
11
  "@hapi/boom": "^7.4.11",
12
12
  "@inquirer/prompts": "^5.3.8",
13
13
  "axios": "^1.7.2",
@@ -28,8 +28,8 @@
28
28
  "serverless-http": "^2.7.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@friggframework/eslint-config": "2.0.0-next.6",
32
- "@friggframework/prettier-config": "2.0.0-next.6",
31
+ "@friggframework/eslint-config": "2.0.0-next.8",
32
+ "@friggframework/prettier-config": "2.0.0-next.8",
33
33
  "serverless": "3.39.0",
34
34
  "serverless-dotenv-plugin": "^6.0.0",
35
35
  "serverless-offline": "^13.8.0",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "14d7f856430f95bc0367246089713540e1c23a86"
61
+ "gitHead": "60b7a6f92954ad165186861a35fba66e40f60a42"
62
62
  }