@friggframework/devtools 2.0.0--canary.378.e85bec1.0 → 2.0.0--canary.381.335a2a0.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.
- package/frigg-cli/build-command/index.js +29 -10
- package/frigg-cli/index.js +1 -0
- package/frigg-cli/index.test.js +1 -4
- package/frigg-cli/install-command/index.js +1 -4
- package/infrastructure/create-frigg-infrastructure.js +1 -3
- package/infrastructure/serverless-template.js +4 -8
- package/package.json +7 -6
- package/frigg-cli/utils/backend-path.js +0 -26
- package/infrastructure/webpack.config.js +0 -20
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { spawnSync } = require('child_process');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
function buildCommand(options) {
|
|
5
5
|
console.log('Building the serverless application...');
|
|
6
|
+
console.log('Hello from npm link world')
|
|
6
7
|
const backendPath = path.resolve(process.cwd());
|
|
7
8
|
const infrastructurePath = 'infrastructure.js';
|
|
8
9
|
const command = 'serverless';
|
|
@@ -14,20 +15,38 @@ function buildCommand(options) {
|
|
|
14
15
|
options.stage
|
|
15
16
|
];
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
// Add support for --verbose option
|
|
19
|
+
if (options.verbose) {
|
|
20
|
+
serverlessArgs.push('--verbose');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.log('Running command from ', backendPath);
|
|
24
|
+
console.log('Serverless Command:', command, serverlessArgs.join(' '));
|
|
25
|
+
|
|
26
|
+
const result = spawnSync(command, serverlessArgs, {
|
|
18
27
|
cwd: backendPath,
|
|
19
28
|
stdio: 'inherit',
|
|
29
|
+
shell: true,
|
|
30
|
+
env: {
|
|
31
|
+
...process.env,
|
|
32
|
+
NODE_PATH: path.resolve(backendPath, 'node_modules'),
|
|
33
|
+
}
|
|
20
34
|
});
|
|
21
35
|
|
|
22
|
-
|
|
23
|
-
console.error(`
|
|
24
|
-
|
|
36
|
+
if (result.status !== 0) {
|
|
37
|
+
console.error(`Serverless build failed with code ${result.status}`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
25
40
|
|
|
26
|
-
childProcess.on('
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
// childProcess.on('error', (error) => {
|
|
42
|
+
// console.error(`Error executing command: ${error.message}`);
|
|
43
|
+
// });
|
|
44
|
+
|
|
45
|
+
// childProcess.on('close', (code) => {
|
|
46
|
+
// if (code !== 0) {
|
|
47
|
+
// console.log(`Child process exited with code ${code}`);
|
|
48
|
+
// }
|
|
49
|
+
// });
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
module.exports = { buildCommand };
|
package/frigg-cli/index.js
CHANGED
package/frigg-cli/index.test.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
const { Command } = require('commander');
|
|
2
2
|
const { installCommand } = require('./index');
|
|
3
3
|
const { validatePackageExists } = require('./install-command/validate-package');
|
|
4
|
-
const {
|
|
5
|
-
findNearestBackendPackageJson,
|
|
6
|
-
validateBackendPath,
|
|
7
|
-
} = require('./utils/backend-path');
|
|
4
|
+
const { findNearestBackendPackageJson, validateBackendPath } = require('@friggframework/core');
|
|
8
5
|
const { installPackage } = require('./install-command/install-package');
|
|
9
6
|
const { createIntegrationFile } = require('./install-command/integration-file');
|
|
10
7
|
const { updateBackendJsFile } = require('./install-command/backend-js');
|
|
@@ -4,15 +4,12 @@ const { resolve } = require('node:path');
|
|
|
4
4
|
const { updateBackendJsFile } = require('./backend-js');
|
|
5
5
|
const { logInfo, logError } = require('./logger');
|
|
6
6
|
const { commitChanges } = require('./commit-changes');
|
|
7
|
-
const {
|
|
8
|
-
findNearestBackendPackageJson,
|
|
9
|
-
validateBackendPath,
|
|
10
|
-
} = require('../utils/backend-path');
|
|
11
7
|
const { handleEnvVariables } = require('./environment-variables');
|
|
12
8
|
const {
|
|
13
9
|
validatePackageExists,
|
|
14
10
|
searchAndSelectPackage,
|
|
15
11
|
} = require('./validate-package');
|
|
12
|
+
const { findNearestBackendPackageJson, validateBackendPath } = require('@friggframework/core');
|
|
16
13
|
|
|
17
14
|
const installCommand = async (apiModuleName) => {
|
|
18
15
|
try {
|
|
@@ -2,9 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
const { composeServerlessDefinition } = require('./serverless-template');
|
|
4
4
|
|
|
5
|
-
const {
|
|
6
|
-
findNearestBackendPackageJson,
|
|
7
|
-
} = require('../frigg-cli/utils/backend-path');
|
|
5
|
+
const { findNearestBackendPackageJson } = require('@friggframework/core');
|
|
8
6
|
|
|
9
7
|
function createFriggInfrastructure() {
|
|
10
8
|
const backendPath = findNearestBackendPackageJson();
|
|
@@ -7,6 +7,7 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
7
7
|
service: AppDefinition.name || 'create-frigg-app',
|
|
8
8
|
package: {
|
|
9
9
|
individually: true,
|
|
10
|
+
exclude: ["!**/node_modules/aws-sdk/**", "!**/node_modules/@aws-sdk/**", "!package.json"],
|
|
10
11
|
},
|
|
11
12
|
useDotenv: true,
|
|
12
13
|
provider: {
|
|
@@ -30,7 +31,7 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
30
31
|
],
|
|
31
32
|
},
|
|
32
33
|
plugins: [
|
|
33
|
-
|
|
34
|
+
'serverless-jetpack',
|
|
34
35
|
'serverless-dotenv-plugin',
|
|
35
36
|
'serverless-offline-sqs',
|
|
36
37
|
'serverless-offline',
|
|
@@ -51,13 +52,8 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
51
52
|
secretAccessKey: 'root',
|
|
52
53
|
skipCacheInvalidation: false,
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
includeModules: {
|
|
57
|
-
forceExclude: ['aws-sdk'],
|
|
58
|
-
},
|
|
59
|
-
packager: 'npm',
|
|
60
|
-
excludeFiles: ['src/**/*.test.js', 'test/'],
|
|
55
|
+
jetpack: {
|
|
56
|
+
base: '..',
|
|
61
57
|
},
|
|
62
58
|
},
|
|
63
59
|
functions: {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.
|
|
4
|
+
"version": "2.0.0--canary.381.335a2a0.0",
|
|
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/test": "2.0.0--canary.
|
|
9
|
+
"@friggframework/test": "2.0.0--canary.381.335a2a0.0",
|
|
10
10
|
"@hapi/boom": "^7.4.11",
|
|
11
11
|
"@inquirer/prompts": "^5.3.8",
|
|
12
12
|
"axios": "^1.7.2",
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"serverless-http": "^2.7.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@friggframework/eslint-config": "2.0.0--canary.
|
|
31
|
-
"@friggframework/prettier-config": "2.0.0--canary.
|
|
30
|
+
"@friggframework/eslint-config": "2.0.0--canary.381.335a2a0.0",
|
|
31
|
+
"@friggframework/prettier-config": "2.0.0--canary.381.335a2a0.0",
|
|
32
32
|
"serverless": "3.39.0",
|
|
33
33
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
34
|
+
"serverless-jetpack": "^0.11.2",
|
|
34
35
|
"serverless-offline": "^13.8.0",
|
|
35
36
|
"serverless-offline-sqs": "^8.0.0",
|
|
36
|
-
"serverless-
|
|
37
|
+
"serverless-plugin-monorepo": "^0.11.0"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"lint:fix": "prettier --write --loglevel error . && eslint . --fix",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "335a2a0360c0b3d6c868975b120b738be0d6e9d3"
|
|
61
62
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const PACKAGE_JSON = 'package.json';
|
|
4
|
-
|
|
5
|
-
function findNearestBackendPackageJson() {
|
|
6
|
-
let currentDir = process.cwd();
|
|
7
|
-
while (currentDir !== path.parse(currentDir).root) {
|
|
8
|
-
const packageJsonPath = path.join(currentDir, 'backend', PACKAGE_JSON);
|
|
9
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
10
|
-
return packageJsonPath;
|
|
11
|
-
}
|
|
12
|
-
currentDir = path.dirname(currentDir);
|
|
13
|
-
}
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function validateBackendPath(backendPath) {
|
|
18
|
-
if (!backendPath) {
|
|
19
|
-
throw new Error('Could not find a backend package.json file.');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
findNearestBackendPackageJson,
|
|
25
|
-
validateBackendPath,
|
|
26
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const slsw = require('serverless-webpack');
|
|
2
|
-
const webpack = require('webpack');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const CopyPlugin = require('copy-webpack-plugin');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
devtool: 'source-map',
|
|
9
|
-
entry: slsw.lib.entries,
|
|
10
|
-
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
|
|
11
|
-
target: 'node',
|
|
12
|
-
externals: ['mongoose', 'express', 'node-fetch'],
|
|
13
|
-
plugins: [
|
|
14
|
-
// This defines the window global (with value of `undefined`).
|
|
15
|
-
new webpack.ProvidePlugin({
|
|
16
|
-
window: path.resolve(path.join(__dirname, 'src/utils/webpackFakeWindow')),
|
|
17
|
-
}),
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
};
|