carlin 1.34.2 → 1.36.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/dist/index.js +80 -21
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
1
2
|
import AWS from 'aws-sdk';
|
|
2
3
|
import log5 from 'npmlog';
|
|
3
4
|
import yaml4 from 'js-yaml';
|
|
@@ -2973,7 +2974,7 @@ var loadConfig = (entryPoint) => {
|
|
|
2973
2974
|
format: "cjs",
|
|
2974
2975
|
outfile,
|
|
2975
2976
|
platform: "node",
|
|
2976
|
-
target:
|
|
2977
|
+
target: "ES2021",
|
|
2977
2978
|
treeShaking: true
|
|
2978
2979
|
});
|
|
2979
2980
|
if (result.errors.length > 0) {
|
|
@@ -2989,7 +2990,8 @@ var loadConfig = (entryPoint) => {
|
|
|
2989
2990
|
}
|
|
2990
2991
|
};
|
|
2991
2992
|
var readConfigFileSync = ({
|
|
2992
|
-
configFilePath
|
|
2993
|
+
configFilePath,
|
|
2994
|
+
options: options9
|
|
2993
2995
|
}) => {
|
|
2994
2996
|
const extension = configFilePath.split(".").pop();
|
|
2995
2997
|
if (extension === "yaml" || extension === "yml") {
|
|
@@ -3006,25 +3008,26 @@ var readConfigFileSync = ({
|
|
|
3006
3008
|
if (extension === "ts") {
|
|
3007
3009
|
let result = loadConfig(configFilePath);
|
|
3008
3010
|
if (typeof result === "function") {
|
|
3009
|
-
result = result();
|
|
3011
|
+
result = result(options9);
|
|
3010
3012
|
}
|
|
3011
3013
|
return result;
|
|
3012
3014
|
}
|
|
3013
3015
|
throw new Error("Unsupported config file extension: " + extension);
|
|
3014
3016
|
};
|
|
3015
3017
|
var readConfigFile = async ({
|
|
3016
|
-
configFilePath
|
|
3018
|
+
configFilePath,
|
|
3019
|
+
options: options9
|
|
3017
3020
|
}) => {
|
|
3018
3021
|
const extension = configFilePath.split(".").pop();
|
|
3019
3022
|
if (extension === "ts") {
|
|
3020
3023
|
let result = loadConfig(configFilePath);
|
|
3021
3024
|
if (typeof result === "function") {
|
|
3022
|
-
result = result();
|
|
3025
|
+
result = result(options9);
|
|
3023
3026
|
}
|
|
3024
3027
|
result = await Promise.resolve(result);
|
|
3025
3028
|
return result;
|
|
3026
3029
|
}
|
|
3027
|
-
return readConfigFileSync({ configFilePath });
|
|
3030
|
+
return readConfigFileSync({ configFilePath, options: options9 });
|
|
3028
3031
|
};
|
|
3029
3032
|
|
|
3030
3033
|
// ../cloudformation/src/findAndReadCloudFormationTemplate.ts
|
|
@@ -3034,7 +3037,8 @@ var defaultTemplatePaths2 = ["ts", "js", "yaml", "yml", "json"].map(
|
|
|
3034
3037
|
}
|
|
3035
3038
|
);
|
|
3036
3039
|
var findAndReadCloudFormationTemplate = async ({
|
|
3037
|
-
templatePath: defaultTemplatePath
|
|
3040
|
+
templatePath: defaultTemplatePath,
|
|
3041
|
+
options: options9 = {}
|
|
3038
3042
|
}) => {
|
|
3039
3043
|
const templatePath = defaultTemplatePath || defaultTemplatePaths2.reduce((acc, cur) => {
|
|
3040
3044
|
if (acc) {
|
|
@@ -3050,7 +3054,7 @@ var findAndReadCloudFormationTemplate = async ({
|
|
|
3050
3054
|
return readCloudFormationYamlTemplate({ templatePath });
|
|
3051
3055
|
}
|
|
3052
3056
|
const configFilePath = path.resolve(process.cwd(), templatePath);
|
|
3053
|
-
return readConfigFile({ configFilePath });
|
|
3057
|
+
return readConfigFile({ configFilePath, options: options9 });
|
|
3054
3058
|
};
|
|
3055
3059
|
|
|
3056
3060
|
// src/deploy/lambda/getLambdaEntryPointsFromTemplate.ts
|
|
@@ -3071,25 +3075,42 @@ var getLambdaEntryPointsFromTemplate = (template) => {
|
|
|
3071
3075
|
var logPrefix12 = "cloudformation";
|
|
3072
3076
|
log5.addLevel("event", 1e4, { fg: "yellow" });
|
|
3073
3077
|
log5.addLevel("output", 1e4, { fg: "blue" });
|
|
3074
|
-
var
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
lambdaEntryPointsBaseDir,
|
|
3078
|
-
lambdaImage,
|
|
3079
|
-
lambdaExternal,
|
|
3080
|
-
lambdaFormat,
|
|
3081
|
-
lambdaOutdir,
|
|
3082
|
-
parameters,
|
|
3083
|
-
template,
|
|
3084
|
-
templatePath
|
|
3078
|
+
var getCloudformationTemplateOptions = ({
|
|
3079
|
+
cliOptions,
|
|
3080
|
+
stackName
|
|
3085
3081
|
}) => {
|
|
3082
|
+
const options9 = {
|
|
3083
|
+
...cliOptions,
|
|
3084
|
+
stackName,
|
|
3085
|
+
environment: getEnvironment(),
|
|
3086
|
+
packageName: getPackageName(),
|
|
3087
|
+
projectName: getProjectName()
|
|
3088
|
+
};
|
|
3089
|
+
return options9;
|
|
3090
|
+
};
|
|
3091
|
+
var deployCloudFormation = async (cliOptions) => {
|
|
3086
3092
|
try {
|
|
3093
|
+
const {
|
|
3094
|
+
lambdaDockerfile,
|
|
3095
|
+
lambdaEntryPoints,
|
|
3096
|
+
lambdaEntryPointsBaseDir,
|
|
3097
|
+
lambdaImage,
|
|
3098
|
+
lambdaExternal,
|
|
3099
|
+
lambdaFormat,
|
|
3100
|
+
lambdaOutdir,
|
|
3101
|
+
parameters,
|
|
3102
|
+
template,
|
|
3103
|
+
templatePath
|
|
3104
|
+
} = cliOptions;
|
|
3087
3105
|
const { stackName } = await handleDeployInitialization({ logPrefix: logPrefix12 });
|
|
3088
3106
|
const cloudFormationTemplate = await (async () => {
|
|
3089
3107
|
if (template) {
|
|
3090
3108
|
return { ...template };
|
|
3091
3109
|
}
|
|
3092
|
-
return findAndReadCloudFormationTemplate({
|
|
3110
|
+
return findAndReadCloudFormationTemplate({
|
|
3111
|
+
templatePath,
|
|
3112
|
+
options: getCloudformationTemplateOptions({ stackName, cliOptions })
|
|
3113
|
+
});
|
|
3093
3114
|
})();
|
|
3094
3115
|
parameters?.forEach((parameter) => {
|
|
3095
3116
|
if (cloudFormationTemplate.Parameters?.[parameter.key]) {
|
|
@@ -4077,7 +4098,7 @@ var options5 = {
|
|
|
4077
4098
|
type: "string"
|
|
4078
4099
|
},
|
|
4079
4100
|
/**
|
|
4080
|
-
* This option has the format
|
|
4101
|
+
* This option has the format to match [CloudFormation parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html).
|
|
4081
4102
|
*
|
|
4082
4103
|
* ```ts
|
|
4083
4104
|
* {
|
|
@@ -4087,9 +4108,47 @@ var options5 = {
|
|
|
4087
4108
|
* resolvedValue: string
|
|
4088
4109
|
* }[]
|
|
4089
4110
|
* ```
|
|
4111
|
+
*
|
|
4112
|
+
* For example:
|
|
4113
|
+
*
|
|
4114
|
+
* ```ts
|
|
4115
|
+
* [
|
|
4116
|
+
* {
|
|
4117
|
+
* key: 'key1',
|
|
4118
|
+
* value: 'value1',
|
|
4119
|
+
* },
|
|
4120
|
+
* {
|
|
4121
|
+
* key: 'key2',
|
|
4122
|
+
* value: 'value2',
|
|
4123
|
+
* }
|
|
4124
|
+
* ]
|
|
4125
|
+
* ```
|
|
4126
|
+
*
|
|
4127
|
+
* If you want to simplify the usage, you can pass a object with key and value only:
|
|
4128
|
+
*
|
|
4129
|
+
* ```ts
|
|
4130
|
+
* {
|
|
4131
|
+
* key1: 'value1',
|
|
4132
|
+
* key2: 'value2'
|
|
4133
|
+
* }
|
|
4134
|
+
* ```
|
|
4090
4135
|
*/
|
|
4091
4136
|
parameters: {
|
|
4092
4137
|
alias: "p",
|
|
4138
|
+
coerce: (arg) => {
|
|
4139
|
+
if (Array.isArray(arg)) {
|
|
4140
|
+
return arg;
|
|
4141
|
+
}
|
|
4142
|
+
if (typeof arg === "object") {
|
|
4143
|
+
return Object.entries(arg).map(([key, value]) => {
|
|
4144
|
+
return {
|
|
4145
|
+
key,
|
|
4146
|
+
value
|
|
4147
|
+
};
|
|
4148
|
+
});
|
|
4149
|
+
}
|
|
4150
|
+
return [];
|
|
4151
|
+
},
|
|
4093
4152
|
default: [],
|
|
4094
4153
|
describe: "A list of parameters that will be passed to CloudFormation Parameters when deploying."
|
|
4095
4154
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carlin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"author": "Pedro Arantes <arantespp@gmail.com> (https://twitter.com/arantespp)",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"uglify-js": "^3.17.4",
|
|
46
46
|
"vercel": "^34.2.0",
|
|
47
47
|
"yargs": "^17.7.2",
|
|
48
|
-
"@ttoss/
|
|
49
|
-
"@ttoss/
|
|
50
|
-
"@ttoss/config": "^1.
|
|
48
|
+
"@ttoss/config": "^1.32.4",
|
|
49
|
+
"@ttoss/cloudformation": "^0.10.0",
|
|
50
|
+
"@ttoss/read-config-file": "^1.1.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/adm-zip": "^0.5.5",
|