@hasna/microservices 0.0.12 → 0.0.13
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/bin/index.js +13 -6
- package/bin/mcp.js +13 -6
- package/dist/index.js +13 -6
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -4919,7 +4919,7 @@ var build_default2 = Spinner;
|
|
|
4919
4919
|
// src/lib/installer.ts
|
|
4920
4920
|
import {
|
|
4921
4921
|
existsSync as existsSync2,
|
|
4922
|
-
cpSync,
|
|
4922
|
+
cpSync as cpSync2,
|
|
4923
4923
|
mkdirSync as mkdirSync2,
|
|
4924
4924
|
readdirSync,
|
|
4925
4925
|
statSync,
|
|
@@ -4929,7 +4929,7 @@ import { join as join2, dirname as dirname2 } from "path";
|
|
|
4929
4929
|
import { fileURLToPath } from "url";
|
|
4930
4930
|
|
|
4931
4931
|
// src/lib/database.ts
|
|
4932
|
-
import { existsSync, mkdirSync } from "fs";
|
|
4932
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
4933
4933
|
import { dirname, join, resolve } from "path";
|
|
4934
4934
|
function findNearestMicroservicesDir(startDir) {
|
|
4935
4935
|
let dir = resolve(startDir);
|
|
@@ -4945,15 +4945,22 @@ function findNearestMicroservicesDir(startDir) {
|
|
|
4945
4945
|
return null;
|
|
4946
4946
|
}
|
|
4947
4947
|
function getMicroservicesDir() {
|
|
4948
|
-
|
|
4949
|
-
|
|
4948
|
+
const explicit = process.env["HASNA_MICROSERVICES_DIR"] ?? process.env["MICROSERVICES_DIR"];
|
|
4949
|
+
if (explicit) {
|
|
4950
|
+
return explicit;
|
|
4950
4951
|
}
|
|
4951
4952
|
const cwd = process.cwd();
|
|
4952
4953
|
const nearest = findNearestMicroservicesDir(cwd);
|
|
4953
4954
|
if (nearest)
|
|
4954
4955
|
return nearest;
|
|
4955
4956
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
4956
|
-
|
|
4957
|
+
const newDir = join(home, ".hasna", "microservices");
|
|
4958
|
+
const oldDir = join(home, ".microservices");
|
|
4959
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
4960
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
4961
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
4962
|
+
}
|
|
4963
|
+
return newDir;
|
|
4957
4964
|
}
|
|
4958
4965
|
|
|
4959
4966
|
// src/lib/installer.ts
|
|
@@ -5030,7 +5037,7 @@ function installMicroservice(name, options = {}) {
|
|
|
5030
5037
|
if (existsSync2(destPath) && overwrite) {
|
|
5031
5038
|
clearInstalledSource(destPath);
|
|
5032
5039
|
}
|
|
5033
|
-
|
|
5040
|
+
cpSync2(sourcePath, destPath, { recursive: true });
|
|
5034
5041
|
return {
|
|
5035
5042
|
microservice: cleanName,
|
|
5036
5043
|
success: true,
|
package/bin/mcp.js
CHANGED
|
@@ -19738,7 +19738,7 @@ function searchMicroservices(query) {
|
|
|
19738
19738
|
// src/lib/installer.ts
|
|
19739
19739
|
import {
|
|
19740
19740
|
existsSync as existsSync2,
|
|
19741
|
-
cpSync,
|
|
19741
|
+
cpSync as cpSync2,
|
|
19742
19742
|
mkdirSync as mkdirSync2,
|
|
19743
19743
|
readdirSync,
|
|
19744
19744
|
statSync,
|
|
@@ -19748,7 +19748,7 @@ import { join as join2, dirname as dirname2 } from "path";
|
|
|
19748
19748
|
import { fileURLToPath } from "url";
|
|
19749
19749
|
|
|
19750
19750
|
// src/lib/database.ts
|
|
19751
|
-
import { existsSync, mkdirSync } from "fs";
|
|
19751
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
19752
19752
|
import { dirname, join, resolve } from "path";
|
|
19753
19753
|
function findNearestMicroservicesDir(startDir) {
|
|
19754
19754
|
let dir = resolve(startDir);
|
|
@@ -19764,15 +19764,22 @@ function findNearestMicroservicesDir(startDir) {
|
|
|
19764
19764
|
return null;
|
|
19765
19765
|
}
|
|
19766
19766
|
function getMicroservicesDir() {
|
|
19767
|
-
|
|
19768
|
-
|
|
19767
|
+
const explicit = process.env["HASNA_MICROSERVICES_DIR"] ?? process.env["MICROSERVICES_DIR"];
|
|
19768
|
+
if (explicit) {
|
|
19769
|
+
return explicit;
|
|
19769
19770
|
}
|
|
19770
19771
|
const cwd = process.cwd();
|
|
19771
19772
|
const nearest = findNearestMicroservicesDir(cwd);
|
|
19772
19773
|
if (nearest)
|
|
19773
19774
|
return nearest;
|
|
19774
19775
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
19775
|
-
|
|
19776
|
+
const newDir = join(home, ".hasna", "microservices");
|
|
19777
|
+
const oldDir = join(home, ".microservices");
|
|
19778
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
19779
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
19780
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
19781
|
+
}
|
|
19782
|
+
return newDir;
|
|
19776
19783
|
}
|
|
19777
19784
|
|
|
19778
19785
|
// src/lib/installer.ts
|
|
@@ -19849,7 +19856,7 @@ function installMicroservice(name, options = {}) {
|
|
|
19849
19856
|
if (existsSync2(destPath) && overwrite) {
|
|
19850
19857
|
clearInstalledSource(destPath);
|
|
19851
19858
|
}
|
|
19852
|
-
|
|
19859
|
+
cpSync2(sourcePath, destPath, { recursive: true });
|
|
19853
19860
|
return {
|
|
19854
19861
|
microservice: cleanName,
|
|
19855
19862
|
success: true,
|
package/dist/index.js
CHANGED
|
@@ -263,7 +263,7 @@ function searchMicroservices(query) {
|
|
|
263
263
|
// src/lib/installer.ts
|
|
264
264
|
import {
|
|
265
265
|
existsSync as existsSync2,
|
|
266
|
-
cpSync,
|
|
266
|
+
cpSync as cpSync2,
|
|
267
267
|
mkdirSync as mkdirSync2,
|
|
268
268
|
readdirSync,
|
|
269
269
|
statSync,
|
|
@@ -274,7 +274,7 @@ import { fileURLToPath } from "url";
|
|
|
274
274
|
|
|
275
275
|
// src/lib/database.ts
|
|
276
276
|
import { Database } from "bun:sqlite";
|
|
277
|
-
import { existsSync, mkdirSync } from "fs";
|
|
277
|
+
import { existsSync, mkdirSync, cpSync } from "fs";
|
|
278
278
|
import { dirname, join, resolve } from "path";
|
|
279
279
|
function findNearestMicroservicesDir(startDir) {
|
|
280
280
|
let dir = resolve(startDir);
|
|
@@ -290,15 +290,22 @@ function findNearestMicroservicesDir(startDir) {
|
|
|
290
290
|
return null;
|
|
291
291
|
}
|
|
292
292
|
function getMicroservicesDir() {
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
const explicit = process.env["HASNA_MICROSERVICES_DIR"] ?? process.env["MICROSERVICES_DIR"];
|
|
294
|
+
if (explicit) {
|
|
295
|
+
return explicit;
|
|
295
296
|
}
|
|
296
297
|
const cwd = process.cwd();
|
|
297
298
|
const nearest = findNearestMicroservicesDir(cwd);
|
|
298
299
|
if (nearest)
|
|
299
300
|
return nearest;
|
|
300
301
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
301
|
-
|
|
302
|
+
const newDir = join(home, ".hasna", "microservices");
|
|
303
|
+
const oldDir = join(home, ".microservices");
|
|
304
|
+
if (!existsSync(newDir) && existsSync(oldDir)) {
|
|
305
|
+
mkdirSync(join(home, ".hasna"), { recursive: true });
|
|
306
|
+
cpSync(oldDir, newDir, { recursive: true });
|
|
307
|
+
}
|
|
308
|
+
return newDir;
|
|
302
309
|
}
|
|
303
310
|
function getServiceDataDir(serviceName) {
|
|
304
311
|
const name = serviceName.startsWith("microservice-") ? serviceName : `microservice-${serviceName}`;
|
|
@@ -427,7 +434,7 @@ function installMicroservice(name, options = {}) {
|
|
|
427
434
|
if (existsSync2(destPath) && overwrite) {
|
|
428
435
|
clearInstalledSource(destPath);
|
|
429
436
|
}
|
|
430
|
-
|
|
437
|
+
cpSync2(sourcePath, destPath, { recursive: true });
|
|
431
438
|
return {
|
|
432
439
|
microservice: cleanName,
|
|
433
440
|
success: true,
|
package/package.json
CHANGED