lwazi 1.2.3 → 1.2.4

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.
Files changed (2) hide show
  1. package/bin/uninstall.js +51 -56
  2. package/package.json +1 -1
package/bin/uninstall.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync, spawn } = require('child_process');
3
+ const { execSync } = require('child_process');
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
 
@@ -50,28 +50,45 @@ console.log();
50
50
 
51
51
  // Run the appropriate uninstallation script
52
52
  const platform = process.platform;
53
+ const scriptPath = platform === 'win32'
54
+ ? (fs.existsSync(path.join(lwaziDir, 'uninstall.ps1')) ? path.join(lwaziDir, 'uninstall.ps1') : path.join(lwaziDir, 'uninstall.bat'))
55
+ : path.join(lwaziDir, 'uninstall');
56
+
57
+ if (!fs.existsSync(scriptPath)) {
58
+ console.log(colors.yellow('⚠️ No uninstall script found in lwazi directory.'));
59
+ console.log('Attempting manual cleanup...');
60
+ manualCleanup();
61
+ return;
62
+ }
53
63
 
54
- async function runUninstall() {
55
- let scriptPath;
56
- let scriptCommand;
57
-
58
- if (platform === 'win32') {
59
- // Windows: try PowerShell first, then batch
60
- const ps1Path = path.join(lwaziDir, 'uninstall.ps1');
61
- const batPath = path.join(lwaziDir, 'uninstall.bat');
62
-
63
- if (fs.existsSync(ps1Path)) {
64
- scriptPath = ps1Path;
65
- scriptCommand = `powershell -ExecutionPolicy Bypass -File "${scriptPath}"`;
66
- } else if (fs.existsSync(batPath)) {
67
- scriptPath = batPath;
68
- scriptCommand = `cmd /c "${scriptPath}"`;
69
- } else {
70
- console.log(colors.yellow('⚠️ No Windows uninstall script found in lwazi directory.'));
71
- console.log('Attempting manual cleanup...');
72
- await manualCleanup();
73
- return;
74
- }
64
+ // Make executable on Unix
65
+ if (platform !== 'win32') {
66
+ fs.chmodSync(scriptPath, '755');
67
+ }
68
+
69
+ console.log(colors.blue('Running uninstallation script...'));
70
+ console.log();
71
+
72
+ try {
73
+ const cmd = platform === 'win32'
74
+ ? `powershell -ExecutionPolicy Bypass -File "${scriptPath}"`
75
+ : `"${scriptPath}"`;
76
+
77
+ execSync(cmd, {
78
+ stdio: 'inherit',
79
+ cwd: projectRoot
80
+ });
81
+ console.log();
82
+ console.log(colors.green('✅ Uninstallation completed!'));
83
+ } catch (error) {
84
+ if (error.status === 1) {
85
+ console.log();
86
+ console.log(colors.yellow('⚠️ Uninstallation cancelled by user.'));
87
+ } else {
88
+ console.log();
89
+ console.log(colors.yellow('⚠️ Uninstallation script finished with warnings.'));
90
+ }
91
+ }
75
92
  } else {
76
93
  // Unix-like systems (Linux, macOS, etc.)
77
94
  scriptPath = path.join(lwaziDir, 'uninstall');
@@ -85,45 +102,29 @@ async function runUninstall() {
85
102
 
86
103
  // Make executable
87
104
  fs.chmodSync(scriptPath, '755');
88
- scriptCommand = `"${scriptPath}"`;
89
105
  }
90
106
 
91
107
  console.log(colors.blue('Running uninstallation script...'));
92
108
  console.log();
93
109
 
94
110
  try {
95
- const child = spawn(scriptCommand, [], {
111
+ execSync(`"${scriptPath}"`, {
96
112
  stdio: 'inherit',
97
- cwd: projectRoot,
98
- shell: platform === 'win32'
99
- });
100
-
101
- return new Promise((resolve, reject) => {
102
- child.on('close', (code) => {
103
- if (code === 0) {
104
- console.log();
105
- console.log(colors.green('✅ Uninstallation completed!'));
106
- resolve();
107
- } else {
108
- console.log();
109
- console.log(colors.yellow('⚠️ Uninstallation script finished with warnings.'));
110
- resolve();
111
- }
112
- });
113
-
114
- child.on('error', (err) => {
115
- console.log(colors.red('❌ Error running uninstall script:'), err.message);
116
- reject(err);
117
- });
113
+ cwd: projectRoot
118
114
  });
115
+ console.log();
116
+ console.log(colors.green('✅ Uninstallation completed!'));
119
117
  } catch (error) {
120
- console.log(colors.red('❌ Error:'), error.message);
121
- console.log('Attempting manual cleanup...');
122
- await manualCleanup();
118
+ if (error.status === 1) {
119
+ console.log();
120
+ console.log(colors.yellow('⚠️ Uninstallation cancelled by user.'));
121
+ } else {
122
+ console.log();
123
+ console.log(colors.yellow('⚠️ Uninstallation script finished with warnings.'));
124
+ }
123
125
  }
124
- }
125
126
 
126
- async function manualCleanup() {
127
+ function manualCleanup() {
127
128
  console.log(colors.blue('Performing manual cleanup...'));
128
129
  console.log();
129
130
 
@@ -190,9 +191,3 @@ async function manualCleanup() {
190
191
  console.log();
191
192
  console.log(colors.green('✅ Manual cleanup completed!'));
192
193
  }
193
-
194
- // Run the uninstaller
195
- runUninstall().catch((error) => {
196
- console.error(colors.red('❌ Uninstallation failed:'), error.message);
197
- process.exit(1);
198
- });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lwazi",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Lwazi is an AI assistant for Laravel. Install with one command to add an AI assistant to your Laravel app.",
5
5
  "main": "bin/lwazi.js",
6
6
  "bin": {