@tixyel/cli 2.3.2 → 2.5.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 +83 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -25,6 +25,89 @@ program
|
|
|
25
25
|
const { workspace_config } = await import('./templates/workspace.js');
|
|
26
26
|
const root = process.cwd();
|
|
27
27
|
const config = resolve(root, 'tixyel.config.ts');
|
|
28
|
+
// Pergunta se o usuário quer instalar pacotes npm
|
|
29
|
+
const inquirer = (await import('inquirer')).default;
|
|
30
|
+
const { exec } = await import('child_process');
|
|
31
|
+
const util = await import('util');
|
|
32
|
+
const execPromise = util.promisify(exec);
|
|
33
|
+
const { installPackages } = await inquirer.prompt([
|
|
34
|
+
{
|
|
35
|
+
type: 'confirm',
|
|
36
|
+
name: 'installPackages',
|
|
37
|
+
message: 'You want to install essential npm/bun packages?',
|
|
38
|
+
default: true,
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
if (installPackages) {
|
|
42
|
+
const availablesManagers = [];
|
|
43
|
+
// check if npm is available
|
|
44
|
+
const checkManager = async (manager) => {
|
|
45
|
+
try {
|
|
46
|
+
await execPromise(`${manager} --version`);
|
|
47
|
+
availablesManagers.push(manager);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// not available
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
await Promise.all(['npm', 'yarn', 'pnpm', 'bun'].map((mgr) => checkManager(mgr)));
|
|
54
|
+
var packageManager;
|
|
55
|
+
if (availablesManagers.length === 0) {
|
|
56
|
+
console.error('❌ No package managers found (npm, yarn, pnpm, bun). Please install one and try again.');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
else if (availablesManagers.length === 1) {
|
|
60
|
+
packageManager = availablesManagers[0];
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const response = await inquirer.prompt([
|
|
64
|
+
{
|
|
65
|
+
type: 'select',
|
|
66
|
+
name: 'packageManager',
|
|
67
|
+
message: 'Select your package manager:',
|
|
68
|
+
choices: availablesManagers,
|
|
69
|
+
default: 'npm',
|
|
70
|
+
},
|
|
71
|
+
]);
|
|
72
|
+
packageManager = response.packageManager;
|
|
73
|
+
}
|
|
74
|
+
console.log(`📦 Installing packages using ${packageManager} ...`);
|
|
75
|
+
let installCommand = '';
|
|
76
|
+
const packages = ['@tixyel/cli', '@tixyel/streamelements', 'comfy.js', 'motion', 'typescript', '@types/node', '@types/jquery', 'lottie-web'];
|
|
77
|
+
switch (packageManager) {
|
|
78
|
+
case 'npm': {
|
|
79
|
+
installCommand = `npm install ${packages.join(' ')}`;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'yarn': {
|
|
83
|
+
installCommand = `yarn add ${packages.join(' ')}`;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case 'pnpm': {
|
|
87
|
+
installCommand = `pnpm add ${packages.join(' ')}`;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
case 'bun': {
|
|
91
|
+
installCommand = `bun add ${packages.join(' ')}`;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!installCommand) {
|
|
96
|
+
console.error('❌ Invalid package manager selected.');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const { stdout, stderr } = await execPromise(installCommand, { cwd: root });
|
|
101
|
+
if (stdout)
|
|
102
|
+
process.stdout.write(stdout);
|
|
103
|
+
if (stderr)
|
|
104
|
+
process.stderr.write(stderr);
|
|
105
|
+
console.log('✅ Packages installed successfully.');
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error('❌ Error installing packages:', error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
28
111
|
console.log('🚀 Initializing new workspace...');
|
|
29
112
|
console.log(`📁 Workspace root: ${root}`);
|
|
30
113
|
const content = workspace_config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tixyel/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "CLI tool for streamelements widgets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"@types/inquirer": "^9.0.9",
|
|
78
78
|
"@types/react": "^19.2.7",
|
|
79
79
|
"@types/react-dom": "^19.2.3",
|
|
80
|
-
"@types/ws": "^8.5.12"
|
|
80
|
+
"@types/ws": "^8.5.12",
|
|
81
|
+
"typescript": "^5.9.3"
|
|
81
82
|
},
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public",
|