voidconnect 0.1.12 → 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 +6 -1
  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
 
@@ -106,6 +107,10 @@ function extract(file, dest, extension, binary) {
106
107
  throw error;
107
108
  }
108
109
 
110
+ addToPath(dest);
111
+ }
112
+
113
+ function addToPath(dest) {
109
114
  // Add to PATH on Windows if not present
110
115
  if (os.platform() === 'win32') {
111
116
  try {
@@ -113,7 +118,7 @@ function extract(file, dest, extension, binary) {
113
118
  if (!userPath.includes(dest)) {
114
119
  const newPath = `${userPath};${dest}`;
115
120
  // Powershell command to set the new path
116
- const setPathCmd = `[Environment]::SetEnvironmentVariable("Path", "${newPath}", [EnvironmentVariableTarget]::User)`;
121
+ const setPathCmd = `[Environment]::SetEnvironmentVariable('Path', '${newPath.replace(/'/g, "''")}', [EnvironmentVariableTarget]::User)`;
117
122
  execSync(`powershell -Command "${setPathCmd}"`);
118
123
  console.log(`Added ${dest} to user PATH.`);
119
124
  console.log('You may need to restart your terminal for changes to take effect.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voidconnect",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "NPM wrapper for voidconnect-cli",
5
5
  "bin": {
6
6
  "voidconnect": "bin/voidconnect.js"