@tixyel/cli 2.6.7 → 2.7.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/dist/index.js CHANGED
@@ -316,4 +316,101 @@ program
316
316
  throw error;
317
317
  }
318
318
  });
319
+ program
320
+ .command('update')
321
+ .aliases(['upgrade', 'u'])
322
+ .description('Update Tixyel packages to the latest version.')
323
+ .option('-f --force', 'Force update even if already on latest version', false)
324
+ .option('-nc --no-cache', 'Disable package manager cache during installation', false)
325
+ .action(async (options) => {
326
+ const root = process.cwd();
327
+ const inquirer = (await import('inquirer')).default;
328
+ const { exec } = await import('child_process');
329
+ const util = await import('util');
330
+ const execPromise = util.promisify(exec);
331
+ const availablesManagers = [];
332
+ // check if npm is available
333
+ const checkManager = async (manager) => {
334
+ try {
335
+ await execPromise(`${manager} --version`);
336
+ availablesManagers.push(manager);
337
+ }
338
+ catch {
339
+ // not available
340
+ }
341
+ };
342
+ await Promise.all(['npm', 'yarn', 'pnpm', 'bun'].map((mgr) => checkManager(mgr)));
343
+ var packageManager;
344
+ if (availablesManagers.length === 0) {
345
+ console.error('❌ No package managers found (npm, yarn, pnpm, bun). Please install one and try again.');
346
+ return;
347
+ }
348
+ else if (availablesManagers.length === 1) {
349
+ packageManager = availablesManagers[0];
350
+ }
351
+ else {
352
+ const response = await inquirer.prompt([
353
+ {
354
+ type: 'select',
355
+ name: 'packageManager',
356
+ message: 'Select your package manager:',
357
+ choices: availablesManagers,
358
+ default: 'npm',
359
+ },
360
+ ]);
361
+ packageManager = response.packageManager;
362
+ }
363
+ console.log(`📦 Installing packages using ${packageManager} ...`);
364
+ let installCommand = '';
365
+ const packages = ['@tixyel/cli@latest', '@tixyel/streamelements@latest'];
366
+ switch (packageManager) {
367
+ case 'npm': {
368
+ installCommand = `npm install ${packages.join(' ')}`;
369
+ if (options.noCache)
370
+ installCommand += ' --no-cache';
371
+ if (options.force)
372
+ installCommand += ' --force';
373
+ break;
374
+ }
375
+ case 'yarn': {
376
+ installCommand = `yarn add ${packages.join(' ')}`;
377
+ if (options.noCache)
378
+ installCommand += ' --no-cache';
379
+ if (options.force)
380
+ installCommand += ' --force';
381
+ break;
382
+ }
383
+ case 'pnpm': {
384
+ installCommand = `pnpm add ${packages.join(' ')}`;
385
+ if (options.noCache)
386
+ installCommand += ' --no-cache';
387
+ if (options.force)
388
+ installCommand += ' --force';
389
+ break;
390
+ }
391
+ case 'bun': {
392
+ installCommand = `bun add ${packages.join(' ')}`;
393
+ if (options.noCache)
394
+ installCommand += ' --no-cache';
395
+ if (options.force)
396
+ installCommand += ' --force';
397
+ break;
398
+ }
399
+ }
400
+ if (!installCommand) {
401
+ console.error('❌ Invalid package manager selected.');
402
+ return;
403
+ }
404
+ try {
405
+ const { stdout, stderr } = await execPromise(installCommand, { cwd: root });
406
+ if (stdout)
407
+ process.stdout.write(stdout);
408
+ if (stderr)
409
+ process.stderr.write(stderr);
410
+ console.log('✅ Packages updated successfully.');
411
+ }
412
+ catch (error) {
413
+ console.error('❌ Error installing packages:', error);
414
+ }
415
+ });
319
416
  program.parse();
@@ -9,7 +9,7 @@ export const watermark = {
9
9
  return [
10
10
  `<!---`,
11
11
  logo,
12
- `Generated by Tixyel Widgets SDK`,
12
+ `Generated by @Tixyel Widgets SDK`,
13
13
  `Widget name: ${widget.config.name}`,
14
14
  `Version: ${widget.config.version}`,
15
15
  `Description: ${widget.config.description}`,
@@ -30,7 +30,7 @@ export const watermark = {
30
30
  return [
31
31
  `/**`,
32
32
  logo,
33
- `Generated by Tixyel Widgets SDK`,
33
+ `Generated by @Tixyel Widgets SDK`,
34
34
  `Widget name: ${widget.config.name}`,
35
35
  `Version: ${widget.config.version}`,
36
36
  `Description: ${widget.config.description}`,
@@ -51,7 +51,7 @@ export const watermark = {
51
51
  return [
52
52
  `/**`,
53
53
  logo,
54
- `Generated by Tixyel Widgets SDK`,
54
+ `Generated by @Tixyel Widgets SDK`,
55
55
  `Widget name: ${widget.config.name}`,
56
56
  `Version: ${widget.config.version}`,
57
57
  `Description: ${widget.config.description}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tixyel/cli",
3
- "version": "2.6.7",
3
+ "version": "2.7.0",
4
4
  "description": "CLI tool for streamelements widgets",
5
5
  "keywords": [
6
6
  "cli",