@aloma.io/integration-sdk 3.0.1-8 → 3.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/build/cli.mjs +24 -3
- package/package.json +2 -2
- package/src/cli.mts +29 -4
- package/template/connector/package.json +1 -1
- package/build/cli.d.ts +0 -1
- package/build/cli.js +0 -2
package/build/cli.mjs
CHANGED
@@ -4,7 +4,9 @@ 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" },
|
@@ -42,11 +44,10 @@ const generateKeys = async ({ target }) => {
|
|
42
44
|
await jwe.newPair();
|
43
45
|
const priv = await jwe.exportPrivateAsBase64();
|
44
46
|
const pub = await jwe.exportPublicAsBase64();
|
45
|
-
const content = `
|
47
|
+
const content = `REGISTRATION_TOKEN=
|
46
48
|
PRIVATE_KEY=${priv}
|
47
49
|
PUBLIC_KEY=${pub}
|
48
50
|
`;
|
49
|
-
console.log(content);
|
50
51
|
fs.writeFileSync(`${target}/.env`, content);
|
51
52
|
};
|
52
53
|
const program = new Command();
|
@@ -66,7 +67,27 @@ program
|
|
66
67
|
throw new Error("name is empty");
|
67
68
|
const target = `${process.cwd()}/${name}`;
|
68
69
|
fs.mkdirSync(target);
|
70
|
+
console.log('Creating connector ...');
|
69
71
|
extract({ ...options, target, name });
|
72
|
+
console.log('Generating keys ...');
|
70
73
|
await generateKeys({ target });
|
74
|
+
console.log('Installing dependencies ...');
|
75
|
+
await exec(`cd ${target}; yarn`);
|
76
|
+
console.log('Building ...');
|
77
|
+
await exec(`cd ${target}; yarn build`);
|
78
|
+
console.log(`
|
79
|
+
Success!
|
80
|
+
|
81
|
+
1.) Add the connector to a workspace
|
82
|
+
2.) Edit ./${name}/.env and insert the registration token
|
83
|
+
3.) Start the connector with cd ./${name}/; yarn start`);
|
84
|
+
});
|
85
|
+
program
|
86
|
+
.command("build")
|
87
|
+
.description("Build the current connector project")
|
88
|
+
.action(async (str, options) => {
|
89
|
+
const { stdout, stderr } = await exec(`rm -rf build; mkdir -p build/controller; cp ./src/controller/index.mts ./build/controller/.controller-for-types.mts;`);
|
90
|
+
if (stdout)
|
91
|
+
console.log(stdout);
|
71
92
|
});
|
72
93
|
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",
|
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,8 +5,10 @@ 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
|
|
@@ -59,13 +61,11 @@ const generateKeys = async ({target}) =>
|
|
59
61
|
const priv = await jwe.exportPrivateAsBase64();
|
60
62
|
const pub = await jwe.exportPublicAsBase64();
|
61
63
|
|
62
|
-
const content = `
|
64
|
+
const content = `REGISTRATION_TOKEN=
|
63
65
|
PRIVATE_KEY=${priv}
|
64
66
|
PUBLIC_KEY=${pub}
|
65
67
|
`;
|
66
68
|
|
67
|
-
console.log(content);
|
68
|
-
|
69
69
|
fs.writeFileSync(`${target}/.env`, content);
|
70
70
|
};
|
71
71
|
|
@@ -90,8 +90,33 @@ program
|
|
90
90
|
|
91
91
|
fs.mkdirSync(target);
|
92
92
|
|
93
|
+
console.log('Creating connector ...');
|
93
94
|
extract({ ...options, target, name });
|
95
|
+
|
96
|
+
console.log('Generating keys ...');
|
94
97
|
await generateKeys({target});
|
98
|
+
|
99
|
+
console.log('Installing dependencies ...');
|
100
|
+
await exec(`cd ${target}; yarn`);
|
101
|
+
|
102
|
+
console.log('Building ...');
|
103
|
+
await exec(`cd ${target}; yarn build`);
|
104
|
+
|
105
|
+
console.log(`
|
106
|
+
Success!
|
107
|
+
|
108
|
+
1.) Add the connector to a workspace
|
109
|
+
2.) Edit ./${name}/.env and insert the registration token
|
110
|
+
3.) Start the connector with cd ./${name}/; yarn start`)
|
111
|
+
});
|
112
|
+
|
113
|
+
program
|
114
|
+
.command("build")
|
115
|
+
.description("Build the current connector project")
|
116
|
+
.action(async (str, options) => {
|
117
|
+
const {stdout, stderr} = await exec(`rm -rf build; mkdir -p build/controller; cp ./src/controller/index.mts ./build/controller/.controller-for-types.mts;`);
|
118
|
+
|
119
|
+
if (stdout) console.log(stdout);
|
95
120
|
});
|
96
121
|
|
97
122
|
program.parse();
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"scripts": {
|
10
10
|
"start": "node build/index.mjs",
|
11
11
|
"dev": "./node_modules/typescript/bin/tsc --watch",
|
12
|
-
"build": "
|
12
|
+
"build": "./node_modules/@aloma.io/integration-sdk/build/cli.mjs build; ./node_modules/typescript/bin/tsc",
|
13
13
|
"test": "./node_modules/mocha/bin/_mocha --recursive",
|
14
14
|
"format": "yarn prettier --write src/"
|
15
15
|
},
|
package/build/cli.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/build/cli.js
DELETED