lwazi 1.11.2 → 1.11.3
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/update.js +29 -1
- package/package.json +1 -1
package/bin/update.js
CHANGED
|
@@ -25,7 +25,6 @@ console.log("Updating Lwazi files...");
|
|
|
25
25
|
|
|
26
26
|
const ignore = new Set([
|
|
27
27
|
"node_modules",
|
|
28
|
-
".git",
|
|
29
28
|
"package-lock.json"
|
|
30
29
|
]);
|
|
31
30
|
|
|
@@ -54,7 +53,36 @@ if (fs.existsSync(targetDir)) {
|
|
|
54
53
|
console.log("Copying fresh lwazi files...");
|
|
55
54
|
copyDirectory(packageDir, targetDir);
|
|
56
55
|
|
|
56
|
+
// Mark as independent git repo to avoid parent repo branch conflicts
|
|
57
|
+
const gitFile = path.join(targetDir, ".git");
|
|
58
|
+
if (!fs.existsSync(gitFile)) {
|
|
59
|
+
fs.writeFileSync(gitFile, "gitdir: /dev/null\n");
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
console.log("Running composer update...");
|
|
63
|
+
|
|
64
|
+
// Check if lwazi/core is in composer.json and fix branch if needed
|
|
65
|
+
const composerFile = path.join(projectRoot, "composer.json");
|
|
66
|
+
if (fs.existsSync(composerFile)) {
|
|
67
|
+
const composer = JSON.parse(fs.readFileSync(composerFile, "utf8"));
|
|
68
|
+
|
|
69
|
+
// Detect available branch from parent git
|
|
70
|
+
let branch = "dev-main";
|
|
71
|
+
try {
|
|
72
|
+
const gitBranches = execSync("git branch -a", { cwd: projectRoot, encoding: "utf8" });
|
|
73
|
+
if (gitBranches.includes("master")) {
|
|
74
|
+
branch = "dev-master";
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
// No git, use default
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (composer.require && composer.require["lwazi/core"]) {
|
|
81
|
+
composer.require["lwazi/core"] = branch;
|
|
82
|
+
fs.writeFileSync(composerFile, JSON.stringify(composer, null, 2) + "\n");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
58
86
|
try {
|
|
59
87
|
execSync("composer update lwazi/core --no-interaction", {
|
|
60
88
|
stdio: "inherit",
|