opticore-installer 1.2.55 → 1.2.56
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/dist/index.cjs +19 -44
- package/dist/index.js +19 -44
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -568,37 +568,21 @@ var SUpdateEnv = class {
|
|
|
568
568
|
* @protected
|
|
569
569
|
*/
|
|
570
570
|
updateDatabaseSection(envFileLines, arg) {
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
571
|
+
const keyMap = {
|
|
572
|
+
DATA_BASE_NAME: arg.dbName,
|
|
573
|
+
DATA_BASE_USER: arg.dbUser,
|
|
574
|
+
DATA_BASE_PASSWORD: arg.dbPwd,
|
|
575
|
+
DATA_BASE_HOST: arg.dbHost,
|
|
576
|
+
DATA_BASE_PORT: arg.dbPort
|
|
577
|
+
};
|
|
578
|
+
for (let i = 0; i < envFileLines.length; i++) {
|
|
578
579
|
const line = envFileLines[i].trim();
|
|
579
|
-
if (line.startsWith("#") && line !== sectionHeader) {
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
580
|
if (!line || line.startsWith("#")) {
|
|
583
581
|
continue;
|
|
584
582
|
}
|
|
585
583
|
const [key] = line.split("=");
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
envFileLines[i] = `${key}=${arg.dbName ?? ""}`;
|
|
589
|
-
break;
|
|
590
|
-
case "DATA_BASE_USER":
|
|
591
|
-
envFileLines[i] = `${key}=${arg.dbUser ?? ""}`;
|
|
592
|
-
break;
|
|
593
|
-
case "DATA_BASE_PASSWORD":
|
|
594
|
-
envFileLines[i] = `${key}=${arg.dbPwd ?? ""}`;
|
|
595
|
-
break;
|
|
596
|
-
case "DATA_BASE_HOST":
|
|
597
|
-
envFileLines[i] = `${key}=${arg.dbHost ?? ""}`;
|
|
598
|
-
break;
|
|
599
|
-
case "DATA_BASE_PORT":
|
|
600
|
-
envFileLines[i] = `${key}=${arg.dbPort ?? ""}`;
|
|
601
|
-
break;
|
|
584
|
+
if (Object.prototype.hasOwnProperty.call(keyMap, key)) {
|
|
585
|
+
envFileLines[i] = `${key}=${keyMap[key] ?? ""}`;
|
|
602
586
|
}
|
|
603
587
|
}
|
|
604
588
|
}
|
|
@@ -609,34 +593,25 @@ var SUpdateEnv = class {
|
|
|
609
593
|
* @protected
|
|
610
594
|
*/
|
|
611
595
|
updateArgConnexionSection(envFileLines, argumentConnection) {
|
|
612
|
-
const sectionHeader = "#ARG CONNEXION";
|
|
613
|
-
const sectionStart = envFileLines.findIndex((line) => line.trim() === sectionHeader);
|
|
614
|
-
if (sectionStart === -1) {
|
|
615
|
-
console.warn(`Section ${sectionHeader} not found in .env file`);
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
596
|
if (argumentConnection === void 0) {
|
|
619
597
|
return;
|
|
620
598
|
}
|
|
621
|
-
|
|
622
|
-
for (let i =
|
|
599
|
+
const targetKey = "ARGUMENTS_DATABASE_CONNECTION";
|
|
600
|
+
for (let i = 0; i < envFileLines.length; i++) {
|
|
623
601
|
const line = envFileLines[i].trim();
|
|
624
|
-
if (line.startsWith("#") && line !== sectionHeader) {
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
602
|
if (!line || line.startsWith("#")) {
|
|
628
603
|
continue;
|
|
629
604
|
}
|
|
630
605
|
const [key] = line.split("=");
|
|
631
|
-
if (key ===
|
|
606
|
+
if (key === targetKey) {
|
|
632
607
|
envFileLines[i] = `${key}=${argumentConnection ?? ""}`;
|
|
633
|
-
|
|
634
|
-
break;
|
|
608
|
+
return;
|
|
635
609
|
}
|
|
636
610
|
}
|
|
637
|
-
if (
|
|
638
|
-
const
|
|
639
|
-
|
|
611
|
+
if (argumentConnection !== null) {
|
|
612
|
+
const headerIndex = envFileLines.findIndex((line) => /^#+\s*ARG\s*CONNEXION\s*$/i.test(line.trim()));
|
|
613
|
+
const insertPosition = headerIndex !== -1 ? headerIndex + 1 : envFileLines.length;
|
|
614
|
+
envFileLines.splice(insertPosition, 0, `${targetKey}=${argumentConnection}`);
|
|
640
615
|
}
|
|
641
616
|
}
|
|
642
617
|
};
|
|
@@ -644,7 +619,7 @@ var SUpdateEnv = class {
|
|
|
644
619
|
// src/presentations/middlewares/templateProject/templateProject.middleware.ts
|
|
645
620
|
var MTemplateProject = async (repoGit, projectPath, currentPath, callback, arg, projectName, argumentConnection) => {
|
|
646
621
|
await SProjectCreation(repoGit, projectPath, currentPath, projectName);
|
|
647
|
-
callback;
|
|
622
|
+
await callback([]);
|
|
648
623
|
new SUpdateEnv(arg, argumentConnection);
|
|
649
624
|
};
|
|
650
625
|
|
package/dist/index.js
CHANGED
|
@@ -545,37 +545,21 @@ var SUpdateEnv = class {
|
|
|
545
545
|
* @protected
|
|
546
546
|
*/
|
|
547
547
|
updateDatabaseSection(envFileLines, arg) {
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
548
|
+
const keyMap = {
|
|
549
|
+
DATA_BASE_NAME: arg.dbName,
|
|
550
|
+
DATA_BASE_USER: arg.dbUser,
|
|
551
|
+
DATA_BASE_PASSWORD: arg.dbPwd,
|
|
552
|
+
DATA_BASE_HOST: arg.dbHost,
|
|
553
|
+
DATA_BASE_PORT: arg.dbPort
|
|
554
|
+
};
|
|
555
|
+
for (let i = 0; i < envFileLines.length; i++) {
|
|
555
556
|
const line = envFileLines[i].trim();
|
|
556
|
-
if (line.startsWith("#") && line !== sectionHeader) {
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
557
|
if (!line || line.startsWith("#")) {
|
|
560
558
|
continue;
|
|
561
559
|
}
|
|
562
560
|
const [key] = line.split("=");
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
envFileLines[i] = `${key}=${arg.dbName ?? ""}`;
|
|
566
|
-
break;
|
|
567
|
-
case "DATA_BASE_USER":
|
|
568
|
-
envFileLines[i] = `${key}=${arg.dbUser ?? ""}`;
|
|
569
|
-
break;
|
|
570
|
-
case "DATA_BASE_PASSWORD":
|
|
571
|
-
envFileLines[i] = `${key}=${arg.dbPwd ?? ""}`;
|
|
572
|
-
break;
|
|
573
|
-
case "DATA_BASE_HOST":
|
|
574
|
-
envFileLines[i] = `${key}=${arg.dbHost ?? ""}`;
|
|
575
|
-
break;
|
|
576
|
-
case "DATA_BASE_PORT":
|
|
577
|
-
envFileLines[i] = `${key}=${arg.dbPort ?? ""}`;
|
|
578
|
-
break;
|
|
561
|
+
if (Object.prototype.hasOwnProperty.call(keyMap, key)) {
|
|
562
|
+
envFileLines[i] = `${key}=${keyMap[key] ?? ""}`;
|
|
579
563
|
}
|
|
580
564
|
}
|
|
581
565
|
}
|
|
@@ -586,34 +570,25 @@ var SUpdateEnv = class {
|
|
|
586
570
|
* @protected
|
|
587
571
|
*/
|
|
588
572
|
updateArgConnexionSection(envFileLines, argumentConnection) {
|
|
589
|
-
const sectionHeader = "#ARG CONNEXION";
|
|
590
|
-
const sectionStart = envFileLines.findIndex((line) => line.trim() === sectionHeader);
|
|
591
|
-
if (sectionStart === -1) {
|
|
592
|
-
console.warn(`Section ${sectionHeader} not found in .env file`);
|
|
593
|
-
return;
|
|
594
|
-
}
|
|
595
573
|
if (argumentConnection === void 0) {
|
|
596
574
|
return;
|
|
597
575
|
}
|
|
598
|
-
|
|
599
|
-
for (let i =
|
|
576
|
+
const targetKey = "ARGUMENTS_DATABASE_CONNECTION";
|
|
577
|
+
for (let i = 0; i < envFileLines.length; i++) {
|
|
600
578
|
const line = envFileLines[i].trim();
|
|
601
|
-
if (line.startsWith("#") && line !== sectionHeader) {
|
|
602
|
-
break;
|
|
603
|
-
}
|
|
604
579
|
if (!line || line.startsWith("#")) {
|
|
605
580
|
continue;
|
|
606
581
|
}
|
|
607
582
|
const [key] = line.split("=");
|
|
608
|
-
if (key ===
|
|
583
|
+
if (key === targetKey) {
|
|
609
584
|
envFileLines[i] = `${key}=${argumentConnection ?? ""}`;
|
|
610
|
-
|
|
611
|
-
break;
|
|
585
|
+
return;
|
|
612
586
|
}
|
|
613
587
|
}
|
|
614
|
-
if (
|
|
615
|
-
const
|
|
616
|
-
|
|
588
|
+
if (argumentConnection !== null) {
|
|
589
|
+
const headerIndex = envFileLines.findIndex((line) => /^#+\s*ARG\s*CONNEXION\s*$/i.test(line.trim()));
|
|
590
|
+
const insertPosition = headerIndex !== -1 ? headerIndex + 1 : envFileLines.length;
|
|
591
|
+
envFileLines.splice(insertPosition, 0, `${targetKey}=${argumentConnection}`);
|
|
617
592
|
}
|
|
618
593
|
}
|
|
619
594
|
};
|
|
@@ -621,7 +596,7 @@ var SUpdateEnv = class {
|
|
|
621
596
|
// src/presentations/middlewares/templateProject/templateProject.middleware.ts
|
|
622
597
|
var MTemplateProject = async (repoGit, projectPath, currentPath, callback, arg, projectName, argumentConnection) => {
|
|
623
598
|
await SProjectCreation(repoGit, projectPath, currentPath, projectName);
|
|
624
|
-
callback;
|
|
599
|
+
await callback([]);
|
|
625
600
|
new SUpdateEnv(arg, argumentConnection);
|
|
626
601
|
};
|
|
627
602
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opticore-installer",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.56",
|
|
4
4
|
"description": "opticore framework installer",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/pg": "^8.20.0"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|