codeplay-common 3.2.18 → 3.2.19

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.
@@ -217,13 +217,24 @@ function checkPackageVersion() {
217
217
  const latestVersion = getLatestVersion(packageName);
218
218
 
219
219
  if (!installedVersion) {
220
- console.error(`${packageName} is not installed. Please install it using "npm install ${packageName}".`);
221
- process.exit(1);
220
+ console.error(`${packageName} is not installed. Installing now...`);
221
+ execSync(`npm install ${packageName}`, { stdio: 'inherit' });
222
+ return;
222
223
  }
223
224
 
224
225
  if (installedVersion !== latestVersion) {
225
- console.error(`\x1b[31m${packageName} is outdated (installed: ${installedVersion}, latest: ${latestVersion}). Please update it.\x1b[0m\n\x1b[33mUse 'npm uninstall codeplay-common ; npm i codeplay-common'\x1b[0m`);
226
- process.exit(1);
226
+ console.log(`${packageName} is outdated (installed: ${installedVersion}, latest: ${latestVersion}). Updating now...`);
227
+
228
+ try {
229
+ execSync(`npm uninstall ${packageName}`, { stdio: 'inherit' });
230
+ execSync(`npm install ${packageName}`, { stdio: 'inherit' });
231
+ console.log(`${packageName} successfully updated.`);
232
+ } catch (err) {
233
+ console.error(`Failed to update ${packageName}:`, err.message);
234
+ process.exit(1);
235
+ }
236
+
237
+ return;
227
238
  }
228
239
 
229
240
  console.log(`${packageName} is up to date (version ${installedVersion}).`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.18",
3
+ "version": "3.2.19",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",