@aloma.io/integration-sdk 3.0.1-3 → 3.0.1-4
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 +7 -4
- package/package.json +1 -1
- package/src/cli.mts +3 -3
package/build/cli.mjs
CHANGED
@@ -5,7 +5,8 @@ import { fileURLToPath } from 'node:url';
|
|
5
5
|
import path from 'node:path';
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
7
7
|
const files = [
|
8
|
-
{ name: 'index.mjs', dir: '' }
|
8
|
+
{ name: 'index.mjs', dir: 'src' },
|
9
|
+
{ name: 'package.json', dir: '' }
|
9
10
|
];
|
10
11
|
const extract = ({ target, name, connectorId }) => {
|
11
12
|
const source = `${__dirname}/../template/connector/`;
|
@@ -16,11 +17,13 @@ const extract = ({ target, name, connectorId }) => {
|
|
16
17
|
if (dir) {
|
17
18
|
fs.mkdirSync(`${target}/./${dir}`);
|
18
19
|
}
|
19
|
-
const content = fs.readFileSync(`${source}
|
20
|
-
fs.writeFileSync(`${target}/./${dir}/${name}`, content);
|
20
|
+
const content = fs.readFileSync(`${source}/${dir}/${name}`, { encoding: 'utf-8' });
|
21
21
|
console.log(content);
|
22
|
+
fs.writeFileSync(`${target}/${dir}/${name}`, content);
|
22
23
|
});
|
23
24
|
const content = JSON.parse(fs.readFileSync(`${target}/package.json`, { encoding: 'utf-8' }));
|
25
|
+
content.name = name;
|
26
|
+
content.connectorId = connectorId;
|
24
27
|
fs.writeFileSync(`${target}/package.json`, JSON.stringify(content));
|
25
28
|
};
|
26
29
|
const program = new Command();
|
@@ -37,7 +40,7 @@ program.command('create')
|
|
37
40
|
if (!name)
|
38
41
|
throw new Error('name is empty');
|
39
42
|
const target = `${process.cwd()}/${name}`;
|
40
|
-
|
43
|
+
fs.mkdirSync(target);
|
41
44
|
extract({ ...options, target, name });
|
42
45
|
});
|
43
46
|
program.parse();
|
package/package.json
CHANGED
package/src/cli.mts
CHANGED
@@ -28,9 +28,9 @@ const extract = ({target, name, connectorId}) =>
|
|
28
28
|
fs.mkdirSync(`${target}/./${dir}`);
|
29
29
|
}
|
30
30
|
|
31
|
-
const content = fs.readFileSync(`${source}
|
32
|
-
fs.writeFileSync(`${target}/./${dir}/${name}`, content);
|
31
|
+
const content = fs.readFileSync(`${source}/${dir}/${name}`, {encoding: 'utf-8'});
|
33
32
|
console.log(content);
|
33
|
+
fs.writeFileSync(`${target}/${dir}/${name}`, content);
|
34
34
|
});
|
35
35
|
|
36
36
|
const content = JSON.parse(fs.readFileSync(`${target}/package.json`, {encoding: 'utf-8'}));
|
@@ -58,7 +58,7 @@ program.command('create')
|
|
58
58
|
|
59
59
|
const target = `${process.cwd()}/${name}`;
|
60
60
|
|
61
|
-
|
61
|
+
fs.mkdirSync(target)
|
62
62
|
|
63
63
|
extract({...options, target, name})
|
64
64
|
});
|