create-cookbook 1.0.0-beta.204 → 1.0.0-beta.206

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/__VERSION__.mjs CHANGED
@@ -1 +1 @@
1
- export const __VERSION__ = '1.0.0-beta.204'
1
+ export const __VERSION__ = "1.0.0-beta.206";
package/index.mjs CHANGED
@@ -127,10 +127,18 @@ const color = gradient(["cyan", "#2d9b87"]);
127
127
  await move(execPath, join(targetPath, execName), { overwrite: true });
128
128
 
129
129
  try {
130
- execFileSync("powershell.exe", [
131
- "-Command",
132
- `[System.Environment]::SetEnvironmentVariable('PATH', $env:PATH + ';${targetPath}', 'User')`
133
- ]);
130
+ const ps =
131
+ `${target}=' ${targetPath.replace(/'/g,"''")}'
132
+ $userPath = [Environment]::GetEnvironmentVariable('Path','User')
133
+ if($null -eq $userPath) { $userPath = ''}
134
+ $parts = $userPath -split ';' | Where-Object {$_ -and $_.Trim() -ne ''}
135
+ $partsLower = $parts | ForEach-Object { $_.Trim().ToLowerInvariant() }
136
+ if ($partsLower -notcontains $target.Trim().ToLowerInvariant()) {
137
+ $newPath = ($parts + $target) -join ';'
138
+ [Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
139
+ }
140
+ `
141
+ execFileSync('powershell.exe', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', ps], { stdio: 'ignore' });
134
142
  consola.success(color("Added to PATH (requires restart)"));
135
143
  } catch {
136
144
  consola.warn(color("Manual PATH configuration required"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cookbook",
3
- "version": "1.0.0-beta.204",
3
+ "version": "1.0.0-beta.206",
4
4
  "main": "index.mjs",
5
5
  "repository": {
6
6
  "type": "git",