@qelos/plugins-cli 0.0.8 → 0.0.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/controllers/pull.mjs +9 -3
- package/controllers/push.mjs +7 -3
- package/package.json +2 -1
package/controllers/pull.mjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import QelosAdministratorSDK from "@qelos/sdk/src/administrator";
|
|
2
1
|
import fs from 'node:fs'
|
|
3
2
|
import path from 'node:path'
|
|
3
|
+
import {createJiti} from 'jiti';
|
|
4
|
+
|
|
5
|
+
const jiti = createJiti(import.meta.url);
|
|
4
6
|
|
|
5
7
|
export default async function pullController({ type, path: targetPath }) {
|
|
6
8
|
|
|
7
|
-
const
|
|
9
|
+
const QelosAdministratorSDK = await jiti('@qelos/sdk/src/administrator/index.ts');
|
|
10
|
+
|
|
11
|
+
const sdk = new QelosAdministratorSDK.default({
|
|
8
12
|
appUrl: process.env.QELOS_URL || "http://localhost:3000",
|
|
9
13
|
})
|
|
10
14
|
|
|
@@ -27,8 +31,10 @@ export default async function pullController({ type, path: targetPath }) {
|
|
|
27
31
|
await Promise.all(components.map(async (component) => {
|
|
28
32
|
const fileName = `${component.identifier}.vue`
|
|
29
33
|
const filePath = path.join(targetPath, fileName)
|
|
34
|
+
|
|
35
|
+
const {content} = await sdk.components.getComponent(component._id);
|
|
30
36
|
|
|
31
|
-
fs.writeFileSync(filePath,
|
|
37
|
+
fs.writeFileSync(filePath, content, 'utf-8')
|
|
32
38
|
console.log('Pulled component:', component.identifier)
|
|
33
39
|
}))
|
|
34
40
|
|
package/controllers/push.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import QelosAdministratorSDK from "@qelos/sdk/src/administrator";
|
|
2
1
|
import fs from 'node:fs'
|
|
2
|
+
import {createJiti} from 'jiti';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const jiti = createJiti(import.meta.url);
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default async function pushController({ type, path }) {
|
|
7
|
+
|
|
8
|
+
const QelosAdministratorSDK = await jiti('@qelos/sdk/src/administrator/index.ts');
|
|
9
|
+
|
|
10
|
+
const sdk = new QelosAdministratorSDK.default({
|
|
7
11
|
appUrl: process.env.QELOS_URL || "http://localhost:3000",
|
|
8
12
|
})
|
|
9
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qelos/plugins-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "CLI to manage QELOS plugins",
|
|
5
5
|
"main": "cli.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"cli-select": "^1.1.2",
|
|
20
20
|
"decompress-zip": "^0.3.3",
|
|
21
21
|
"follow-redirects": "^1.15.11",
|
|
22
|
+
"jiti": "^2.6.1",
|
|
22
23
|
"rimraf": "^6.0.1",
|
|
23
24
|
"yargs": "^18.0.0",
|
|
24
25
|
"zx": "^8.8.5"
|