@awsless/awsless 0.0.341 → 0.0.343
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 +33 -9
- package/package.json +9 -8
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,31 @@ 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
|
+
await exec(`docker image rm ${opts.name}:latest`);
|
|
2204
|
+
const buildResponse = await exec(`docker buildx build --platform ${platform} -t ${opts.name}:latest .`, {
|
|
2205
|
+
cwd: opts.cwd
|
|
2206
|
+
});
|
|
2207
|
+
if (buildResponse.code !== 0) {
|
|
2208
|
+
throw new Error(`Docker build failed: ${buildResponse.stderr}`);
|
|
2209
|
+
}
|
|
2210
|
+
const response = await exec(`docker image inspect ${opts.name}:latest`);
|
|
2211
|
+
if (response.code !== 0) {
|
|
2212
|
+
throw new Error(`Docker image inspect failed: ${response.stderr}`);
|
|
2213
|
+
}
|
|
2214
|
+
const data = JSON.parse(response.stdout);
|
|
2215
|
+
const image = data[0];
|
|
2216
|
+
return {
|
|
2217
|
+
id: image.Id,
|
|
2218
|
+
size: image.Size
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
// src/feature/function/util.ts
|
|
2199
2223
|
var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
2200
2224
|
let name;
|
|
2201
2225
|
if ("stack" in ctx) {
|
|
@@ -2216,21 +2240,21 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
|
|
|
2216
2240
|
let code;
|
|
2217
2241
|
if (props.runtime === "container") {
|
|
2218
2242
|
ctx.registerBuild("function", name, async (build3) => {
|
|
2219
|
-
const
|
|
2220
|
-
const version = await hashElement(
|
|
2243
|
+
const cwd = dirname6(props.file);
|
|
2244
|
+
const version = await hashElement(cwd, {
|
|
2221
2245
|
files: {
|
|
2222
2246
|
exclude: ["stack.json"]
|
|
2223
2247
|
}
|
|
2224
2248
|
});
|
|
2225
2249
|
return build3(version.hash + props.architecture, async (write) => {
|
|
2226
|
-
const
|
|
2227
|
-
|
|
2228
|
-
cwd
|
|
2250
|
+
const image2 = await buildDockerImage({
|
|
2251
|
+
name,
|
|
2252
|
+
cwd,
|
|
2253
|
+
architecture: props.architecture
|
|
2229
2254
|
});
|
|
2230
|
-
await write("
|
|
2231
|
-
await write("HASH", version.hash);
|
|
2255
|
+
await write("HASH", image2.id);
|
|
2232
2256
|
return {
|
|
2233
|
-
size:
|
|
2257
|
+
size: formatByteSize(image2.size)
|
|
2234
2258
|
};
|
|
2235
2259
|
});
|
|
2236
2260
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.343",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@awsless/
|
|
31
|
+
"@awsless/iot": "^0.0.2",
|
|
32
32
|
"@awsless/lambda": "^0.0.26",
|
|
33
33
|
"@awsless/open-search": "^0.0.15",
|
|
34
|
+
"@awsless/redis": "^0.0.12",
|
|
34
35
|
"@awsless/s3": "^0.0.18",
|
|
35
36
|
"@awsless/sns": "^0.0.7",
|
|
36
37
|
"@awsless/sqs": "^0.0.7",
|
|
37
|
-
"@awsless/ssm": "^0.0.7",
|
|
38
|
-
"@awsless/iot": "^0.0.2",
|
|
39
38
|
"@awsless/validate": "^0.0.15",
|
|
39
|
+
"@awsless/ssm": "^0.0.7",
|
|
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",
|
|
110
|
-
"@awsless/duration": "^0.0.1",
|
|
111
|
-
"@awsless/formation": "^0.0.53",
|
|
112
111
|
"@awsless/graphql": "^0.0.9",
|
|
113
|
-
"@awsless/validate": "^0.0.15",
|
|
114
112
|
"@awsless/ts-file-cache": "^0.0.1",
|
|
115
|
-
"@awsless/
|
|
113
|
+
"@awsless/validate": "^0.0.15",
|
|
114
|
+
"@awsless/size": "^0.0.1",
|
|
115
|
+
"@awsless/duration": "^0.0.1",
|
|
116
|
+
"@awsless/formation": "^0.0.53"
|
|
116
117
|
},
|
|
117
118
|
"scripts": {
|
|
118
119
|
"test": "pnpm code test",
|