@aloma.io/integration-sdk 3.0.1-7 → 3.0.1-9
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/cli.mjs +15 -4
- package/package.json +2 -2
- package/src/cli.mts +16 -5
package/build/cli.mjs
CHANGED
@@ -4,12 +4,13 @@ import fs from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
5
5
|
import path from "node:path";
|
6
6
|
import JWE from './internal/util/jwe/index.cjs';
|
7
|
-
|
7
|
+
import util from 'node:util';
|
8
|
+
import ChildProcess from 'node:child_process';
|
9
|
+
const exec = util.promisify(ChildProcess.exec);
|
8
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
9
11
|
const files = [
|
10
12
|
{ name: "index.mts", dir: "src/controller" },
|
11
13
|
{ name: "index.mts", dir: "src" },
|
12
|
-
{ name: ".gitignore", dir: "" },
|
13
14
|
{ name: "package.json", dir: "" },
|
14
15
|
{ name: "Containerfile", dir: "" },
|
15
16
|
{ name: "entrypoint.sh", dir: "" },
|
@@ -33,17 +34,20 @@ const extract = ({ target, name, connectorId }) => {
|
|
33
34
|
content.name = name;
|
34
35
|
content.connectorId = connectorId;
|
35
36
|
fs.writeFileSync(`${target}/package.json`, JSON.stringify(content, null, 2));
|
37
|
+
fs.writeFileSync(`${target}/.gitignore`, `.DS_Store
|
38
|
+
node_modules
|
39
|
+
build
|
40
|
+
.env`);
|
36
41
|
};
|
37
42
|
const generateKeys = async ({ target }) => {
|
38
43
|
const jwe = new JWE({});
|
39
44
|
await jwe.newPair();
|
40
45
|
const priv = await jwe.exportPrivateAsBase64();
|
41
46
|
const pub = await jwe.exportPublicAsBase64();
|
42
|
-
const content = `
|
47
|
+
const content = `REGISTRATION_TOKEN=
|
43
48
|
PRIVATE_KEY=${priv}
|
44
49
|
PUBLIC_KEY=${pub}
|
45
50
|
`;
|
46
|
-
console.log(content);
|
47
51
|
fs.writeFileSync(`${target}/.env`, content);
|
48
52
|
};
|
49
53
|
const program = new Command();
|
@@ -66,4 +70,11 @@ program
|
|
66
70
|
extract({ ...options, target, name });
|
67
71
|
await generateKeys({ target });
|
68
72
|
});
|
73
|
+
program
|
74
|
+
.command("build")
|
75
|
+
.description("Build the current connector project")
|
76
|
+
.action(async (str, options) => {
|
77
|
+
console.log('building');
|
78
|
+
//rm -rf build; mkdir -p build/controller; cp ./src/controller/index.mts ./build/controller/.controller-for-types.mts; ./node_modules/typescript/bin/tsc
|
79
|
+
});
|
69
80
|
program.parse();
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aloma.io/integration-sdk",
|
3
|
-
"version": "3.0.1-
|
3
|
+
"version": "3.0.1-9",
|
4
4
|
"description": "",
|
5
5
|
"author": "aloma.io",
|
6
6
|
"license": "Apache-2.0",
|
7
7
|
"type": "module",
|
8
8
|
"bin": {
|
9
|
-
"
|
9
|
+
"aloma": "./build/cli.mjs"
|
10
10
|
},
|
11
11
|
"scripts": {
|
12
12
|
"dev": "./node_modules/typescript/bin/tsc --watch",
|
package/src/cli.mts
CHANGED
@@ -5,15 +5,16 @@ import fs from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
6
6
|
import path from "node:path";
|
7
7
|
import JWE from './internal/util/jwe/index.cjs'
|
8
|
+
import util from 'node:util';
|
9
|
+
import ChildProcess from 'node:child_process';
|
8
10
|
|
9
|
-
|
11
|
+
const exec = util.promisify(ChildProcess.exec);
|
10
12
|
|
11
13
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
12
14
|
|
13
15
|
const files = [
|
14
16
|
{ name: "index.mts", dir: "src/controller" },
|
15
17
|
{ name: "index.mts", dir: "src" },
|
16
|
-
{ name: ".gitignore", dir: "" },
|
17
18
|
{ name: "package.json", dir: "" },
|
18
19
|
{ name: "Containerfile", dir: "" },
|
19
20
|
{ name: "entrypoint.sh", dir: "" },
|
@@ -46,6 +47,10 @@ const extract = ({ target, name, connectorId }) => {
|
|
46
47
|
content.connectorId = connectorId;
|
47
48
|
|
48
49
|
fs.writeFileSync(`${target}/package.json`, JSON.stringify(content, null, 2));
|
50
|
+
fs.writeFileSync(`${target}/.gitignore`, `.DS_Store
|
51
|
+
node_modules
|
52
|
+
build
|
53
|
+
.env`);
|
49
54
|
};
|
50
55
|
|
51
56
|
const generateKeys = async ({target}) =>
|
@@ -56,13 +61,11 @@ const generateKeys = async ({target}) =>
|
|
56
61
|
const priv = await jwe.exportPrivateAsBase64();
|
57
62
|
const pub = await jwe.exportPublicAsBase64();
|
58
63
|
|
59
|
-
const content = `
|
64
|
+
const content = `REGISTRATION_TOKEN=
|
60
65
|
PRIVATE_KEY=${priv}
|
61
66
|
PUBLIC_KEY=${pub}
|
62
67
|
`;
|
63
68
|
|
64
|
-
console.log(content);
|
65
|
-
|
66
69
|
fs.writeFileSync(`${target}/.env`, content);
|
67
70
|
};
|
68
71
|
|
@@ -91,4 +94,12 @@ program
|
|
91
94
|
await generateKeys({target});
|
92
95
|
});
|
93
96
|
|
97
|
+
program
|
98
|
+
.command("build")
|
99
|
+
.description("Build the current connector project")
|
100
|
+
.action(async (str, options) => {
|
101
|
+
console.log('building');
|
102
|
+
//rm -rf build; mkdir -p build/controller; cp ./src/controller/index.mts ./build/controller/.controller-for-types.mts; ./node_modules/typescript/bin/tsc
|
103
|
+
});
|
104
|
+
|
94
105
|
program.parse();
|