@voxgig/build 0.0.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/README.md +5 -0
- package/build.ts +38 -0
- package/dist/build.d.ts +6 -0
- package/dist/build.js +33 -0
- package/dist/build.js.map +1 -0
- package/package.json +53 -0
package/build.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* Copyright © 2022 Voxgig Ltd, MIT License. */
|
|
2
|
+
|
|
3
|
+
import Fs from 'fs'
|
|
4
|
+
import Path from 'path'
|
|
5
|
+
|
|
6
|
+
const EnvLambda = {
|
|
7
|
+
srv_yml: (model: any, spec: {
|
|
8
|
+
folder: string
|
|
9
|
+
}) => {
|
|
10
|
+
console.log('srv_yml', spec)
|
|
11
|
+
|
|
12
|
+
let srv_yml_path = Path.join(spec.folder, 'srv.yml')
|
|
13
|
+
|
|
14
|
+
let content = Object
|
|
15
|
+
.entries(model.main.srv)
|
|
16
|
+
.filter((entry: any) => entry[1].env?.lambda)
|
|
17
|
+
.map((entry: any) => {
|
|
18
|
+
const name = entry[0]
|
|
19
|
+
// const srv = entry[1]
|
|
20
|
+
return `${name}:
|
|
21
|
+
handler: src/handlers/${name}.handler
|
|
22
|
+
events:
|
|
23
|
+
- http:
|
|
24
|
+
path: "/api/public/${name}"
|
|
25
|
+
method: POST
|
|
26
|
+
cors: true
|
|
27
|
+
`
|
|
28
|
+
}).join('\n\n')
|
|
29
|
+
|
|
30
|
+
Fs.writeFileSync(srv_yml_path, content)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
EnvLambda
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
package/dist/build.d.ts
ADDED
package/dist/build.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright © 2022 Voxgig Ltd, MIT License. */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.EnvLambda = void 0;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const EnvLambda = {
|
|
11
|
+
srv_yml: (model, spec) => {
|
|
12
|
+
console.log('srv_yml', spec);
|
|
13
|
+
let srv_yml_path = path_1.default.join(spec.folder, 'srv.yml');
|
|
14
|
+
let content = Object
|
|
15
|
+
.entries(model.main.srv)
|
|
16
|
+
.filter((entry) => { var _a; return (_a = entry[1].env) === null || _a === void 0 ? void 0 : _a.lambda; })
|
|
17
|
+
.map((entry) => {
|
|
18
|
+
const name = entry[0];
|
|
19
|
+
// const srv = entry[1]
|
|
20
|
+
return `${name}:
|
|
21
|
+
handler: src/handlers/${name}.handler
|
|
22
|
+
events:
|
|
23
|
+
- http:
|
|
24
|
+
path: "/api/public/${name}"
|
|
25
|
+
method: POST
|
|
26
|
+
cors: true
|
|
27
|
+
`;
|
|
28
|
+
}).join('\n\n');
|
|
29
|
+
fs_1.default.writeFileSync(srv_yml_path, content);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.EnvLambda = EnvLambda;
|
|
33
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +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;IAChB,OAAO,EAAE,CAAC,KAAU,EAAE,IAErB,EAAE,EAAE;QACH,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QAE5B,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;CACF,CAAA;AAGC,8BAAS"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@voxgig/build",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/build.js",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"types": "dist/build.d.ts",
|
|
7
|
+
"description": "Voxgig Build.",
|
|
8
|
+
"homepage": "https://github.com/voxgig/build",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"voxgig",
|
|
11
|
+
"model",
|
|
12
|
+
"system",
|
|
13
|
+
"build"
|
|
14
|
+
],
|
|
15
|
+
"author": "Richard Rodger (http://richardrodger.com)",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git://github.com/voxgig/build.git"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"model-s01": "voxgig-model test/s01/model/model.jsonic",
|
|
22
|
+
"test": "jest --coverage",
|
|
23
|
+
"test-some": "jest -t",
|
|
24
|
+
"test-watch": "jest --coverage --watchAll",
|
|
25
|
+
"watch": "tsc -w -d",
|
|
26
|
+
"build": "tsc -d",
|
|
27
|
+
"clean": "rm -rf node_modules yarn.lock package-lock.json",
|
|
28
|
+
"reset": "npm run clean && npm i && npm run build && npm test",
|
|
29
|
+
"repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;",
|
|
30
|
+
"repo-publish": "npm run clean && npm i && npm run repo-publish-quick",
|
|
31
|
+
"repo-publish-quick": "npm run build && npm run test && npm run repo-tag && npm publish --registry https://registry.npmjs.org --access=public"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"files": [
|
|
35
|
+
"build.ts",
|
|
36
|
+
"lib",
|
|
37
|
+
"dist",
|
|
38
|
+
"bin",
|
|
39
|
+
"LICENSE"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/jest": "^27.5.1",
|
|
44
|
+
"@voxgig/model": "^0.0.11",
|
|
45
|
+
"@voxgig/system": "^0.0.1",
|
|
46
|
+
"esbuild": "^0.14.39",
|
|
47
|
+
"esbuild-jest": "^0.5.0",
|
|
48
|
+
"jest": "^28.1.0",
|
|
49
|
+
"tinyify": "^3.0.0",
|
|
50
|
+
"ts-jest": "^28.0.3",
|
|
51
|
+
"typescript": "^4.7.2"
|
|
52
|
+
}
|
|
53
|
+
}
|