plusui-native 0.2.13 → 0.2.15

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.13",
3
+ "version": "0.2.15",
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.13",
31
- "plusui-native-bindgen": "^0.1.13"
30
+ "plusui-native-builder": "^0.1.14",
31
+ "plusui-native-bindgen": "^0.1.14"
32
32
  },
33
33
  "peerDependencies": {
34
- "plusui-native-bindgen": "^0.1.13"
34
+ "plusui-native-bindgen": "^0.1.14"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.js CHANGED
@@ -13,6 +13,11 @@ import { TemplateManager } from '../templates/manager.js';
13
13
  const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = dirname(__filename);
15
15
 
16
+ // Load package.json for version info
17
+ const cliPackageJson = JSON.parse(
18
+ await readFile(join(__dirname, '..', 'package.json'), 'utf8')
19
+ );
20
+
16
21
  const COLORS = {
17
22
  reset: '\x1b[0m',
18
23
  bright: '\x1b[1m',
@@ -119,7 +124,7 @@ function checkTools() {
119
124
  }
120
125
 
121
126
  const USAGE = `
122
- ${COLORS.bright}PlusUI CLI${COLORS.reset} - Build C++ desktop apps with web tech
127
+ ${COLORS.bright}${cliPackageJson.name}${COLORS.reset} v${cliPackageJson.version} - Build C++ desktop apps with web tech
123
128
 
124
129
  ${COLORS.bright}Usage:${COLORS.reset}
125
130
  plusui doctor Check development environment
@@ -133,6 +138,7 @@ ${COLORS.bright}Usage:${COLORS.reset}
133
138
  plusui run Run the built application
134
139
  plusui clean Clean build artifacts
135
140
  plusui bind Generate bindings for current app (alias: bindgen)
141
+ plusui update Update all PlusUI packages to latest versions
136
142
  plusui help Show this help message
137
143
 
138
144
  ${COLORS.bright}Platform Builds:${COLORS.reset}
@@ -195,6 +201,109 @@ function runCMake(args, options = {}) {
195
201
  return execSync(`"${cmake}" ${args}`, { stdio: 'inherit', ...options });
196
202
  }
197
203
 
204
+ function getInstalledPackageVersion(packageName) {
205
+ try {
206
+ const result = execSync(`npm list ${packageName} --depth=0 --json`, {
207
+ encoding: 'utf8',
208
+ stdio: ['pipe', 'pipe', 'ignore']
209
+ });
210
+ const json = JSON.parse(result);
211
+ if (json.dependencies && json.dependencies[packageName]) {
212
+ return json.dependencies[packageName].version;
213
+ }
214
+ } catch {
215
+ // Package not installed locally
216
+ }
217
+
218
+ // Try global installation
219
+ try {
220
+ const result = execSync(`npm list -g ${packageName} --depth=0 --json`, {
221
+ encoding: 'utf8',
222
+ stdio: ['pipe', 'pipe', 'ignore']
223
+ });
224
+ const json = JSON.parse(result);
225
+ if (json.dependencies && json.dependencies[packageName]) {
226
+ return json.dependencies[packageName].version;
227
+ }
228
+ } catch {
229
+ return null;
230
+ }
231
+
232
+ return null;
233
+ }
234
+
235
+ function showVersionInfo() {
236
+ const packages = [
237
+ cliPackageJson.name,
238
+ 'plusui-native-core',
239
+ 'plusui-native-builder',
240
+ 'plusui-native-bindgen'
241
+ ];
242
+
243
+ logSection('PlusUI Package Versions');
244
+
245
+ packages.forEach(pkg => {
246
+ let version;
247
+ if (pkg === cliPackageJson.name) {
248
+ version = cliPackageJson.version;
249
+ log(`${pkg}: ${COLORS.green}v${version}${COLORS.reset} ${COLORS.dim}(current)${COLORS.reset}`, 'reset');
250
+ } else {
251
+ version = getInstalledPackageVersion(pkg);
252
+ if (version) {
253
+ log(`${pkg}: ${COLORS.green}v${version}${COLORS.reset}`, 'reset');
254
+ } else {
255
+ log(`${pkg}: ${COLORS.dim}not installed${COLORS.reset}`, 'reset');
256
+ }
257
+ }
258
+ });
259
+
260
+ console.log('');
261
+ }
262
+
263
+ async function updatePlusUIPackages() {
264
+ logSection('Updating PlusUI Packages');
265
+
266
+ const packages = [
267
+ cliPackageJson.name,
268
+ 'plusui-native-core',
269
+ 'plusui-native-builder',
270
+ 'plusui-native-bindgen'
271
+ ];
272
+
273
+ log('Checking for updates...', 'blue');
274
+
275
+ // Check if packages are installed locally or globally
276
+ const isInProject = existsSync(join(process.cwd(), 'package.json'));
277
+
278
+ if (isInProject) {
279
+ log('Detected project environment - updating local packages...', 'cyan');
280
+ for (const pkg of packages) {
281
+ const localVersion = getInstalledPackageVersion(pkg);
282
+ if (localVersion) {
283
+ try {
284
+ log(`Updating ${pkg}...`, 'dim');
285
+ execSync(`npm install ${pkg}@latest`, { stdio: 'inherit' });
286
+ } catch (e) {
287
+ log(`Failed to update ${pkg}`, 'yellow');
288
+ }
289
+ }
290
+ }
291
+ } 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');
300
+ }
301
+ }
302
+
303
+ log('\\n✓ Update complete!', 'green');
304
+ log('Run "plusui -v" to see installed versions\\n', 'dim');
305
+ }
306
+
198
307
  function getAppBindgenPaths() {
199
308
  return {
200
309
  featuresDir: join(process.cwd(), 'src', 'features'),
@@ -996,6 +1105,9 @@ async function main() {
996
1105
  case 'bindgen':
997
1106
  await runBindgen();
998
1107
  break;
1108
+ case 'update':
1109
+ await updatePlusUIPackages();
1110
+ break;
999
1111
  case 'icons':
1000
1112
  await generateIcons(args[1]);
1001
1113
  break;
@@ -1009,7 +1121,7 @@ async function main() {
1009
1121
  break;
1010
1122
  case '-v':
1011
1123
  case '--version':
1012
- console.log('plusui-cli v0.2.0');
1124
+ showVersionInfo();
1013
1125
  break;
1014
1126
  default:
1015
1127
  console.log(USAGE);
@@ -17,8 +17,8 @@
17
17
  "clean": "plusui clean"
18
18
  },
19
19
  "dependencies": {
20
- "plusui-native": "^0.2.9",
21
- "plusui-native-core": "^0.1.9"
20
+ "plusui-native": "^0.2.14",
21
+ "plusui-native-core": "^0.1.14"
22
22
  }
23
23
  }
24
24
 
@@ -17,8 +17,8 @@
17
17
  "clean": "plusui clean"
18
18
  },
19
19
  "dependencies": {
20
- "plusui-native": "^0.2.9",
21
- "plusui-native-core": "^0.1.9"
20
+ "plusui-native": "^0.2.14",
21
+ "plusui-native-core": "^0.1.14"
22
22
  }
23
23
  }
24
24