carlin 1.16.3 → 1.19.1
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.
|
@@ -33,7 +33,7 @@ const getClosedPrCommands = ({ branch }) => [
|
|
|
33
33
|
/**
|
|
34
34
|
* Exit without error if `closed-pr` does not exist.
|
|
35
35
|
*/
|
|
36
|
-
`[ -f "${(0, exports.getCommandFileDir)('closed-pr')}" ] && sh ${(0, exports.getCommandFileDir)('closed-pr')}
|
|
36
|
+
`[ ! -f "${(0, exports.getCommandFileDir)('closed-pr')}" ] && echo 'closed-pr command not found' || sh ${(0, exports.getCommandFileDir)('closed-pr')}`,
|
|
37
37
|
];
|
|
38
38
|
exports.getClosedPrCommands = getClosedPrCommands;
|
|
39
39
|
const getMainCommands = () => [
|
|
@@ -14,7 +14,7 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
14
14
|
const logPrefix = 'cloudformation';
|
|
15
15
|
npmlog_1.default.addLevel('event', 10000, { fg: 'yellow' });
|
|
16
16
|
npmlog_1.default.addLevel('output', 10000, { fg: 'blue' });
|
|
17
|
-
exports.defaultTemplatePaths = ['ts', 'js', 'yaml', 'yml', 'json'].map((extension) => `./cloudformation.${extension}`);
|
|
17
|
+
exports.defaultTemplatePaths = ['ts', 'js', 'yaml', 'yml', 'json'].map((extension) => `./src/cloudformation.${extension}`);
|
|
18
18
|
const findAndReadCloudFormationTemplate = ({ templatePath: defaultTemplatePath, }) => {
|
|
19
19
|
const templatePath = defaultTemplatePath ||
|
|
20
20
|
exports.defaultTemplatePaths
|
|
@@ -62,16 +62,6 @@ const deployCloudFormation = async ({ lambdaDockerfile, lambdaInput, lambdaImage
|
|
|
62
62
|
StackName: stackName,
|
|
63
63
|
Parameters: parameters || [],
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
* 1. If Lambda code exists, build and upload the code to base stack bucket.
|
|
67
|
-
*
|
|
68
|
-
* 1. If `lambdaImage` is `false`, retrieve the `bucket`, `key`, and
|
|
69
|
-
* `version` of the uploaded code and pass to CloudFormation template
|
|
70
|
-
* as [parameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html).
|
|
71
|
-
*
|
|
72
|
-
* 1. If `lambdaImage` is `true`, a Lambda image will be created and the
|
|
73
|
-
* image URI will be passed to CloudFormation as parameter.
|
|
74
|
-
*/
|
|
75
65
|
const deployCloudFormationDeployLambdaCode = async () => {
|
|
76
66
|
const response = await (0, deployLambdaCode_1.deployLambdaCode)({
|
|
77
67
|
lambdaDockerfile,
|
|
@@ -99,7 +89,6 @@ const deployCloudFormation = async ({ lambdaDockerfile, lambdaInput, lambdaImage
|
|
|
99
89
|
cloudFormationTemplate.Parameters = {
|
|
100
90
|
LambdaS3Bucket: { Type: 'String' },
|
|
101
91
|
LambdaS3Key: { Type: 'String' },
|
|
102
|
-
LambdaS3Version: { Type: 'String' },
|
|
103
92
|
LambdaS3ObjectVersion: { Type: 'String' },
|
|
104
93
|
...cloudFormationTemplate.Parameters,
|
|
105
94
|
};
|
|
@@ -116,17 +105,11 @@ const deployCloudFormation = async ({ lambdaDockerfile, lambdaInput, lambdaImage
|
|
|
116
105
|
/**
|
|
117
106
|
* Used by CloudFormation AWS::Lambda::Function
|
|
118
107
|
* @see {@link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html}
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
ParameterKey: 'LambdaS3ObjectVersion',
|
|
122
|
-
ParameterValue: versionId,
|
|
123
|
-
},
|
|
124
|
-
/**
|
|
125
|
-
* Used by CloudFormation AWS::Serverless::Function
|
|
108
|
+
* and by CloudFormation AWS::Serverless::Function
|
|
126
109
|
* @see {@link https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-functioncode.html}
|
|
127
110
|
*/
|
|
128
111
|
{
|
|
129
|
-
ParameterKey: '
|
|
112
|
+
ParameterKey: 'LambdaS3ObjectVersion',
|
|
130
113
|
ParameterValue: versionId,
|
|
131
114
|
});
|
|
132
115
|
}
|
|
@@ -9,15 +9,11 @@ const path_1 = tslib_1.__importDefault(require("path"));
|
|
|
9
9
|
const logPrefix = 'lambda';
|
|
10
10
|
const outFolder = 'dist';
|
|
11
11
|
const outFile = 'index.js';
|
|
12
|
-
/**
|
|
13
|
-
* Using Webpack because of issue #8.
|
|
14
|
-
* {@link https://github.com/ttoss/carlin/issues/8}
|
|
15
|
-
*/
|
|
16
12
|
const buildLambdaSingleFile = async ({ lambdaExternals, lambdaInput, }) => {
|
|
17
13
|
npmlog_1.default.info(logPrefix, 'Building Lambda single file...');
|
|
18
14
|
const { errors } = esbuild.buildSync({
|
|
19
15
|
banner: {
|
|
20
|
-
js: '// Powered by carlin (https://
|
|
16
|
+
js: '// Powered by carlin (https://ttoss.dev)',
|
|
21
17
|
},
|
|
22
18
|
bundle: true,
|
|
23
19
|
entryPoints: [path_1.default.resolve(process.cwd(), lambdaInput)],
|
|
@@ -10,11 +10,13 @@ const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
|
10
10
|
const npmlog_1 = tslib_1.__importDefault(require("npmlog"));
|
|
11
11
|
const logPrefix = 'lambda';
|
|
12
12
|
/**
|
|
13
|
-
* 1. Build Lambda code using
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* 1. Build Lambda code using esbuild. The build process will create a single
|
|
14
|
+
* file with all your code.
|
|
15
|
+
* 1. The build will ignore packages on `lambda-externals` option.
|
|
16
16
|
* 1. Zip the output file.
|
|
17
17
|
* 1. Upload the zipped code to base stack bucket.
|
|
18
|
+
* 1. Add the code bucket, key and version to the CloudFormation template as
|
|
19
|
+
* parameters.
|
|
18
20
|
*/
|
|
19
21
|
const deployLambdaCode = async ({ lambdaDockerfile, lambdaExternals, lambdaImage, lambdaInput, stackName, }) => {
|
|
20
22
|
if (!fs_1.default.existsSync(lambdaInput)) {
|
package/dist/deploy/stackName.js
CHANGED
|
@@ -34,11 +34,11 @@ exports.limitStackName = limitStackName;
|
|
|
34
34
|
*
|
|
35
35
|
* | Case | Package Name | Environment | Branch Name | `--stack-name` | Stack Name |
|
|
36
36
|
* | ---- | ------------ | ----------- | ---------- | -------------- | ---------- |
|
|
37
|
-
* | #1 | @package/name |
|
|
38
|
-
* | #2 | @package/name |
|
|
37
|
+
* | #1 | @package/name | Production | main | MyStackName | **MyStackName** |
|
|
38
|
+
* | #2 | @package/name | Production | main | | **PackageName-Production** |
|
|
39
39
|
* | #3 | @package/name | | main | | **PackageName-main** |
|
|
40
40
|
* | #4 | @package/name | | | | **PackageName** |
|
|
41
|
-
* | #5 | |
|
|
41
|
+
* | #5 | | Production | main | | **Stack-96820-Production** |
|
|
42
42
|
* | #6 | | | main | | **Stack-96820-main** |
|
|
43
43
|
* | #7 | | | | | **Stack-96820** |
|
|
44
44
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carlin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"yargs": "^17.4.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@ttoss/test-utils": "^1.16.
|
|
54
|
+
"@ttoss/test-utils": "^1.16.5",
|
|
55
55
|
"@types/adm-zip": "^0.5.0",
|
|
56
56
|
"@types/aws-lambda": "^8.10.95",
|
|
57
57
|
"@types/deep-equal": "^1.0.1",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=14.0.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "4de2c5c2f7d1afa6a3ae73d4940bf4eee1966646"
|
|
79
79
|
}
|