plusui-native 0.2.16 → 0.2.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plusui-native",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "PlusUI CLI - Build C++ desktop apps modern UI ",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "semver": "^7.6.0",
28
28
  "which": "^4.0.0",
29
29
  "execa": "^8.0.1",
30
- "plusui-native-builder": "^0.1.15",
31
- "plusui-native-bindgen": "^0.1.15"
30
+ "plusui-native-builder": "^0.1.17",
31
+ "plusui-native-bindgen": "^0.1.17"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-bindgen": "^0.1.15"
34
+ "plusui-native-bindgen": "^0.1.17"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.js CHANGED
@@ -232,6 +232,29 @@ function getInstalledPackageVersion(packageName) {
232
232
  return null;
233
233
  }
234
234
 
235
+ function getLatestPackageVersion(packageName) {
236
+ try {
237
+ const result = execSync(`npm view ${packageName} version`, {
238
+ encoding: 'utf8',
239
+ stdio: ['pipe', 'pipe', 'ignore']
240
+ });
241
+ return result.trim();
242
+ } catch {
243
+ return null;
244
+ }
245
+ }
246
+
247
+ function compareVersions(v1, v2) {
248
+ const parts1 = v1.split('.').map(Number);
249
+ const parts2 = v2.split('.').map(Number);
250
+
251
+ for (let i = 0; i < 3; i++) {
252
+ if (parts1[i] > parts2[i]) return 1;
253
+ if (parts1[i] < parts2[i]) return -1;
254
+ }
255
+ return 0;
256
+ }
257
+
235
258
  function showVersionInfo() {
236
259
  const packages = [
237
260
  cliPackageJson.name,
@@ -270,38 +293,87 @@ async function updatePlusUIPackages() {
270
293
  'plusui-native-bindgen'
271
294
  ];
272
295
 
273
- log('Checking for updates...', 'blue');
296
+ log('Checking for updates...\n', 'blue');
274
297
 
275
298
  // Check if packages are installed locally or globally
276
299
  const isInProject = existsSync(join(process.cwd(), 'package.json'));
277
300
 
278
301
  if (isInProject) {
279
- log('Detected project environment - updating local packages...', 'cyan');
302
+ let updatedCount = 0;
303
+ let upToDateCount = 0;
304
+
280
305
  for (const pkg of packages) {
281
- const localVersion = getInstalledPackageVersion(pkg);
282
- if (localVersion) {
306
+ const currentVersion = getInstalledPackageVersion(pkg);
307
+
308
+ if (!currentVersion) {
309
+ log(`${COLORS.dim}${pkg}: not installed${COLORS.reset}`);
310
+ continue;
311
+ }
312
+
313
+ // Get latest version from npm
314
+ const latestVersion = getLatestPackageVersion(pkg);
315
+
316
+ if (!latestVersion) {
317
+ log(`${COLORS.yellow}${pkg}: couldn't check for updates${COLORS.reset}`);
318
+ continue;
319
+ }
320
+
321
+ const comparison = compareVersions(latestVersion, currentVersion);
322
+
323
+ if (comparison > 0) {
324
+ // Newer version available
283
325
  try {
284
- log(`Updating ${pkg}...`, 'dim');
285
- execSync(`npm install ${pkg}@latest`, { stdio: 'inherit' });
326
+ log(`${COLORS.blue}${pkg}: ${currentVersion} → ${latestVersion}${COLORS.reset}`);
327
+ execSync(`npm install ${pkg}@${latestVersion}`, {
328
+ stdio: ['ignore', 'ignore', 'pipe'],
329
+ encoding: 'utf8'
330
+ });
331
+ log(`${COLORS.green}✓ ${pkg} updated${COLORS.reset}`);
332
+ updatedCount++;
286
333
  } catch (e) {
287
- log(`Failed to update ${pkg}`, 'yellow');
334
+ log(`${COLORS.red}✗ ${pkg} update failed${COLORS.reset}`);
288
335
  }
336
+ } else {
337
+ // Already up to date
338
+ log(`${COLORS.green}✓ ${pkg} v${currentVersion} (up to date)${COLORS.reset}`);
339
+ upToDateCount++;
289
340
  }
290
341
  }
342
+
343
+ console.log('');
344
+ if (updatedCount > 0) {
345
+ log(`Updated ${updatedCount} package${updatedCount !== 1 ? 's' : ''}`, 'green');
346
+ }
347
+ if (upToDateCount > 0) {
348
+ log(`${upToDateCount} package${upToDateCount !== 1 ? 's' : ''} already up to date`, 'dim');
349
+ }
291
350
  } else {
292
- log('Updating global packages...', 'cyan');
293
- // Update the CLI globally
294
- try {
295
- log(`Updating ${cliPackageJson.name} globally...`, 'dim');
296
- execSync(`npm install -g ${cliPackageJson.name}@latest`, { stdio: 'inherit' });
297
- log(`✓ ${cliPackageJson.name} updated successfully`, 'green');
298
- } catch (e) {
299
- log(`Failed to update ${cliPackageJson.name}`, 'yellow');
351
+ log('Updating global CLI package...', 'cyan');
352
+
353
+ const currentVersion = cliPackageJson.version;
354
+ const latestVersion = getLatestPackageVersion(cliPackageJson.name);
355
+
356
+ if (!latestVersion) {
357
+ log('Couldn\'t check for updates', 'yellow');
358
+ return;
359
+ }
360
+
361
+ const comparison = compareVersions(latestVersion, currentVersion);
362
+
363
+ if (comparison > 0) {
364
+ try {
365
+ log(`${COLORS.blue}${cliPackageJson.name}: ${currentVersion} → ${latestVersion}${COLORS.reset}`);
366
+ execSync(`npm install -g ${cliPackageJson.name}@${latestVersion}`, { stdio: 'inherit' });
367
+ log(`✓ ${cliPackageJson.name} updated successfully`, 'green');
368
+ } catch (e) {
369
+ log(`Failed to update ${cliPackageJson.name}`, 'red');
370
+ }
371
+ } else {
372
+ log(`✓ ${cliPackageJson.name} v${currentVersion} (already up to date)`, 'green');
300
373
  }
301
374
  }
302
375
 
303
- log('\\n✓ Update complete!', 'green');
304
- log('Run "plusui -v" to see installed versions\\n', 'dim');
376
+ console.log('');
305
377
  }
306
378
 
307
379
  function getAppBindgenPaths() {
@@ -64,13 +64,19 @@ export class TemplateManager {
64
64
  // Core version follows 0.1.x pattern when CLI is 0.2.x
65
65
  const coreVersionRange = `^${major}.1.0`;
66
66
 
67
+ // Builder and bindgen also follow 0.1.x pattern
68
+ const builderVersionRange = `^${major}.1.0`;
69
+ const bindgenVersionRange = `^${major}.1.0`;
70
+
67
71
  // 4. Prepare template variables
68
72
  const variables = {
69
73
  PROJECT_NAME: projectName,
70
74
  PROJECT_NAME_LOWER: projectName.toLowerCase(),
71
75
  PROJECT_VERSION: '0.1.0',
72
76
  PLUSUI_CLI_VERSION: cliVersionRange,
73
- PLUSUI_CORE_VERSION: coreVersionRange
77
+ PLUSUI_CORE_VERSION: coreVersionRange,
78
+ PLUSUI_BUILDER_VERSION: builderVersionRange,
79
+ PLUSUI_BINDGEN_VERSION: bindgenVersionRange
74
80
  };
75
81
 
76
82
  // 5. Copy template files
@@ -19,6 +19,10 @@
19
19
  "dependencies": {
20
20
  "plusui-native": "{{PLUSUI_CLI_VERSION}}",
21
21
  "plusui-native-core": "{{PLUSUI_CORE_VERSION}}"
22
+ },
23
+ "devDependencies": {
24
+ "plusui-native-builder": "{{PLUSUI_BUILDER_VERSION}}",
25
+ "plusui-native-bindgen": "{{PLUSUI_BINDGEN_VERSION}}"
22
26
  }
23
27
  }
24
28
 
@@ -19,6 +19,10 @@
19
19
  "dependencies": {
20
20
  "plusui-native": "{{PLUSUI_CLI_VERSION}}",
21
21
  "plusui-native-core": "{{PLUSUI_CORE_VERSION}}"
22
+ },
23
+ "devDependencies": {
24
+ "plusui-native-builder": "{{PLUSUI_BUILDER_VERSION}}",
25
+ "plusui-native-bindgen": "{{PLUSUI_BINDGEN_VERSION}}"
22
26
  }
23
27
  }
24
28