@voxgig/build 0.0.1 → 0.1.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.
- package/build.ts +33 -3
- package/dist/build.d.ts +3 -0
- package/dist/build.js +25 -2
- package/dist/build.js.map +1 -1
- package/package.json +3 -3
package/build.ts
CHANGED
|
@@ -4,11 +4,10 @@ import Fs from 'fs'
|
|
|
4
4
|
import Path from 'path'
|
|
5
5
|
|
|
6
6
|
const EnvLambda = {
|
|
7
|
+
|
|
7
8
|
srv_yml: (model: any, spec: {
|
|
8
9
|
folder: string
|
|
9
10
|
}) => {
|
|
10
|
-
console.log('srv_yml', spec)
|
|
11
|
-
|
|
12
11
|
let srv_yml_path = Path.join(spec.folder, 'srv.yml')
|
|
13
12
|
|
|
14
13
|
let content = Object
|
|
@@ -28,7 +27,38 @@ const EnvLambda = {
|
|
|
28
27
|
}).join('\n\n')
|
|
29
28
|
|
|
30
29
|
Fs.writeFileSync(srv_yml_path, content)
|
|
31
|
-
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// Only create if does not exist
|
|
34
|
+
srv_handler: (model: any, spec: {
|
|
35
|
+
folder: string
|
|
36
|
+
}) => {
|
|
37
|
+
Object
|
|
38
|
+
.entries(model.main.srv)
|
|
39
|
+
.filter((entry: any) => entry[1].env?.lambda)
|
|
40
|
+
.forEach((entry: any) => {
|
|
41
|
+
const name = entry[0]
|
|
42
|
+
// const srv = entry[1]
|
|
43
|
+
let srv_handler_path = Path.join(spec.folder, name + '.js')
|
|
44
|
+
|
|
45
|
+
let content = `
|
|
46
|
+
const getSeneca = require('../../env/lambda/setup')
|
|
47
|
+
|
|
48
|
+
exports.handler = async (event, context) => {
|
|
49
|
+
let seneca = await getSeneca()
|
|
50
|
+
let handler = seneca.export('gateway-lambda/handler')
|
|
51
|
+
let res = await handler(event, context)
|
|
52
|
+
return res
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
if (!Fs.existsSync(srv_handler_path)) {
|
|
57
|
+
Fs.writeFileSync(srv_handler_path, content)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
|
|
32
62
|
}
|
|
33
63
|
|
|
34
64
|
export {
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -9,7 +9,6 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const EnvLambda = {
|
|
11
11
|
srv_yml: (model, spec) => {
|
|
12
|
-
console.log('srv_yml', spec);
|
|
13
12
|
let srv_yml_path = path_1.default.join(spec.folder, 'srv.yml');
|
|
14
13
|
let content = Object
|
|
15
14
|
.entries(model.main.srv)
|
|
@@ -27,7 +26,31 @@ const EnvLambda = {
|
|
|
27
26
|
`;
|
|
28
27
|
}).join('\n\n');
|
|
29
28
|
fs_1.default.writeFileSync(srv_yml_path, content);
|
|
30
|
-
}
|
|
29
|
+
},
|
|
30
|
+
// Only create if does not exist
|
|
31
|
+
srv_handler: (model, spec) => {
|
|
32
|
+
Object
|
|
33
|
+
.entries(model.main.srv)
|
|
34
|
+
.filter((entry) => { var _a; return (_a = entry[1].env) === null || _a === void 0 ? void 0 : _a.lambda; })
|
|
35
|
+
.forEach((entry) => {
|
|
36
|
+
const name = entry[0];
|
|
37
|
+
// const srv = entry[1]
|
|
38
|
+
let srv_handler_path = path_1.default.join(spec.folder, name + '.js');
|
|
39
|
+
let content = `
|
|
40
|
+
const getSeneca = require('../../env/lambda/setup')
|
|
41
|
+
|
|
42
|
+
exports.handler = async (event, context) => {
|
|
43
|
+
let seneca = await getSeneca()
|
|
44
|
+
let handler = seneca.export('gateway-lambda/handler')
|
|
45
|
+
let res = await handler(event, context)
|
|
46
|
+
return res
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
if (!fs_1.default.existsSync(srv_handler_path)) {
|
|
50
|
+
fs_1.default.writeFileSync(srv_handler_path, content);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
31
54
|
};
|
|
32
55
|
exports.EnvLambda = EnvLambda;
|
|
33
56
|
//# sourceMappingURL=build.js.map
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;;;;AAE/C,4CAAmB;AACnB,gDAAuB;AAEvB,MAAM,SAAS,GAAG;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":";AAAA,+CAA+C;;;;;;AAE/C,4CAAmB;AACnB,gDAAuB;AAEvB,MAAM,SAAS,GAAG;IAEhB,OAAO,EAAE,CAAC,KAAU,EAAE,IAErB,EAAE,EAAE;QACH,IAAI,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QAEpD,IAAI,OAAO,GAAG,MAAM;aACjB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;aACvB,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,0CAAE,MAAM,CAAA,EAAA,CAAC;aAC5C,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;YAClB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;YACrB,uBAAuB;YACvB,OAAO,GAAG,IAAI;0BACI,IAAI;;;6BAGD,IAAI;;;CAGhC,CAAA;QACK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEjB,YAAE,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACzC,CAAC;IAGD,gCAAgC;IAChC,WAAW,EAAE,CAAC,KAAU,EAAE,IAEzB,EAAE,EAAE;QACH,MAAM;aACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;aACvB,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,0CAAE,MAAM,CAAA,EAAA,CAAC;aAC5C,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;YACtB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;YACrB,uBAAuB;YACvB,IAAI,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC,CAAA;YAE3D,IAAI,OAAO,GAAG;;;;;;;;;CASrB,CAAA;YAEO,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;gBACpC,YAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;aAC5C;QACH,CAAC,CAAC,CAAA;IACN,CAAC;CAEF,CAAA;AAGC,8BAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxgig/build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "dist/build.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "dist/build.d.ts",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dependencies": {},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^27.5.1",
|
|
44
|
-
"@voxgig/model": "^0.
|
|
45
|
-
"@voxgig/system": "^0.0
|
|
44
|
+
"@voxgig/model": "^0.1.3",
|
|
45
|
+
"@voxgig/system": "^0.1.0",
|
|
46
46
|
"esbuild": "^0.14.39",
|
|
47
47
|
"esbuild-jest": "^0.5.0",
|
|
48
48
|
"jest": "^28.1.0",
|