voidconnect 0.1.10 → 0.1.13

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/install.js +22 -0
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -38,6 +38,7 @@ async function install() {
38
38
 
39
39
  const destPath = path.join(binDir, binary);
40
40
  if (fs.existsSync(destPath)) {
41
+ addToPath(binDir);
41
42
  return;
42
43
  }
43
44
 
@@ -105,6 +106,27 @@ function extract(file, dest, extension, binary) {
105
106
  } catch (error) {
106
107
  throw error;
107
108
  }
109
+
110
+ addToPath(dest);
111
+ }
112
+
113
+ function addToPath(dest) {
114
+ // Add to PATH on Windows if not present
115
+ if (os.platform() === 'win32') {
116
+ try {
117
+ const userPath = execSync('powershell -Command "[Environment]::GetEnvironmentVariable(\'Path\', [EnvironmentVariableTarget]::User)"', { encoding: 'utf8' }).trim();
118
+ if (!userPath.includes(dest)) {
119
+ const newPath = `${userPath};${dest}`;
120
+ // Powershell command to set the new path
121
+ const setPathCmd = `[Environment]::SetEnvironmentVariable('Path', '${newPath.replace(/'/g, "''")}', [EnvironmentVariableTarget]::User)`;
122
+ execSync(`powershell -Command "${setPathCmd}"`);
123
+ console.log(`Added ${dest} to user PATH.`);
124
+ console.log('You may need to restart your terminal for changes to take effect.');
125
+ }
126
+ } catch (err) {
127
+ console.warn('Failed to add to PATH:', err.message);
128
+ }
129
+ }
108
130
  }
109
131
 
110
132
  if (require.main === module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voidconnect",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "NPM wrapper for voidconnect-cli",
5
5
  "bin": {
6
6
  "voidconnect": "bin/voidconnect.js"