@awsless/awsless 0.0.340 → 0.0.342
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/bin.js +30 -7
- package/package.json +6 -5
package/dist/bin.js
CHANGED
|
@@ -2006,7 +2006,6 @@ import { Asset, aws as aws2 } from "@awsless/formation";
|
|
|
2006
2006
|
import { generateFileHash } from "@awsless/ts-file-cache";
|
|
2007
2007
|
import deepmerge from "deepmerge";
|
|
2008
2008
|
import { dirname as dirname6 } from "path";
|
|
2009
|
-
import { exec } from "promisify-child-process";
|
|
2010
2009
|
|
|
2011
2010
|
// src/build/index.ts
|
|
2012
2011
|
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -2196,6 +2195,29 @@ var zipFiles = (files) => {
|
|
|
2196
2195
|
|
|
2197
2196
|
// src/feature/function/util.ts
|
|
2198
2197
|
import { hashElement } from "folder-hash";
|
|
2198
|
+
|
|
2199
|
+
// src/feature/function/build/container/build.ts
|
|
2200
|
+
import { exec } from "promisify-child-process";
|
|
2201
|
+
var buildDockerImage = async (opts) => {
|
|
2202
|
+
const platform = opts.architecture === "arm64" ? "linux/arm64" : "linux/amd64";
|
|
2203
|
+
const buildResponse = await exec(`docker buildx build --platform ${platform} -t ${opts.name} .`, {
|
|
2204
|
+
cwd: opts.cwd
|
|
2205
|
+
});
|
|
2206
|
+
if (buildResponse.code !== 0) {
|
|
2207
|
+
throw new Error(`Docker build failed: ${buildResponse.stderr}`);
|
|
2208
|
+
}
|
|
2209
|
+
const response = await exec(`docker image inspect ${opts.name}:latest`);
|
|
2210
|
+
if (response.code !== 0) {
|
|
2211
|
+
throw new Error(`Docker image inspect failed: ${response.stderr}`);
|
|
2212
|
+
}
|
|
2213
|
+
const data = JSON.parse(response.stdout);
|
|
2214
|
+
return {
|
|
2215
|
+
id: data[0].Id,
|
|
2216
|
+
size: data[0].Size
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
|
|
2220
|
+
// src/feature/function/util.ts
|
|
2199
2221
|
var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
2200
2222
|
let name;
|
|
2201
2223
|
if ("stack" in ctx) {
|
|
@@ -2223,14 +2245,15 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
2223
2245
|
}
|
|
2224
2246
|
});
|
|
2225
2247
|
return build3(version.hash + props.architecture, async (write) => {
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2228
|
-
|
|
2248
|
+
const image2 = await buildDockerImage({
|
|
2249
|
+
name,
|
|
2250
|
+
file: props.file,
|
|
2251
|
+
cwd: basePath2,
|
|
2252
|
+
architecture: props.architecture
|
|
2229
2253
|
});
|
|
2230
|
-
await write("
|
|
2231
|
-
await write("HASH", version.hash);
|
|
2254
|
+
await write("HASH", image2.id);
|
|
2232
2255
|
return {
|
|
2233
|
-
size:
|
|
2256
|
+
size: formatByteSize(image2.size)
|
|
2234
2257
|
};
|
|
2235
2258
|
});
|
|
2236
2259
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.342",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@awsless/lambda": "^0.0.26",
|
|
32
|
+
"@awsless/iot": "^0.0.2",
|
|
32
33
|
"@awsless/open-search": "^0.0.15",
|
|
33
34
|
"@awsless/redis": "^0.0.12",
|
|
34
35
|
"@awsless/s3": "^0.0.18",
|
|
35
36
|
"@awsless/sns": "^0.0.7",
|
|
37
|
+
"@awsless/sqs": "^0.0.7",
|
|
36
38
|
"@awsless/validate": "^0.0.15",
|
|
37
39
|
"@awsless/ssm": "^0.0.7",
|
|
38
|
-
"@awsless/sqs": "^0.0.7",
|
|
39
|
-
"@awsless/iot": "^0.0.2",
|
|
40
40
|
"@awsless/weak-cache": "^0.0.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"jszip": "^3.10.1",
|
|
90
90
|
"mime-types": "^2.1.35",
|
|
91
91
|
"minimist": "^1.2.8",
|
|
92
|
+
"node-docker-api": "^1.1.22",
|
|
92
93
|
"parse-imports": "^1.1.2",
|
|
93
94
|
"parse-static-imports": "^1.1.0",
|
|
94
95
|
"pretty-hrtime": "^1.0.3",
|
|
@@ -107,12 +108,12 @@
|
|
|
107
108
|
"zod": "^3.21.4",
|
|
108
109
|
"zod-to-json-schema": "^3.22.3",
|
|
109
110
|
"@awsless/code": "^0.0.10",
|
|
111
|
+
"@awsless/formation": "^0.0.53",
|
|
110
112
|
"@awsless/duration": "^0.0.1",
|
|
111
|
-
"@awsless/graphql": "^0.0.9",
|
|
112
113
|
"@awsless/size": "^0.0.1",
|
|
113
114
|
"@awsless/ts-file-cache": "^0.0.1",
|
|
114
115
|
"@awsless/validate": "^0.0.15",
|
|
115
|
-
"@awsless/
|
|
116
|
+
"@awsless/graphql": "^0.0.9"
|
|
116
117
|
},
|
|
117
118
|
"scripts": {
|
|
118
119
|
"test": "pnpm code test",
|