@comet/upgrade 1.58.0 → 1.59.0
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/lib/index.js +10 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -90,7 +90,7 @@ async function main() {
|
|
|
90
90
|
await runUpgradeScripts(beforeInstallScripts);
|
|
91
91
|
console.info("\n☑️ Before install scripts finished\n");
|
|
92
92
|
console.info("\n🔄 Updating dependencies\n");
|
|
93
|
-
await updateDependencies(targetVersion);
|
|
93
|
+
await updateDependencies(targetVersion, currentMajorVersion !== targetVersion.major);
|
|
94
94
|
console.info("\n☑️ Dependency update finished\n");
|
|
95
95
|
console.info("\n🚀 Executing after install scripts\n");
|
|
96
96
|
const afterInstallScripts = upgradeScripts.filter((script) => script.stage === "after-install");
|
|
@@ -118,7 +118,7 @@ function getCurrentVersion() {
|
|
|
118
118
|
const version = versionMatches[0];
|
|
119
119
|
return semver_1.default.major(version);
|
|
120
120
|
}
|
|
121
|
-
async function updateDependencies(targetVersion) {
|
|
121
|
+
async function updateDependencies(targetVersion, isMajorUpdate = false) {
|
|
122
122
|
const packages = {
|
|
123
123
|
api: ["@comet/blocks-api", "@comet/cms-api"],
|
|
124
124
|
admin: [
|
|
@@ -146,6 +146,14 @@ async function updateDependencies(targetVersion) {
|
|
|
146
146
|
console.warn(`Microservice '${microservice}' has no Comet DXP dependencies. Skipping install`);
|
|
147
147
|
continue;
|
|
148
148
|
}
|
|
149
|
+
if (isMajorUpdate) {
|
|
150
|
+
if (fs_1.default.existsSync(`${microservice}/node_modules`)) {
|
|
151
|
+
fs_1.default.rmSync(`${microservice}/node_modules`, { recursive: true, force: true });
|
|
152
|
+
}
|
|
153
|
+
if (fs_1.default.existsSync(`${microservice}/package-lock.json`)) {
|
|
154
|
+
fs_1.default.rmSync(`${microservice}/package-lock.json`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
149
157
|
await (0, execute_command_util_1.executeCommand)("npm", [
|
|
150
158
|
"install",
|
|
151
159
|
"--prefix",
|