@glassnote/client 2.4.5 → 2.4.6

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/glassnote.js +24 -4
  2. package/package.json +1 -1
package/bin/glassnote.js CHANGED
@@ -204,10 +204,10 @@ function addToPathUnix() {
204
204
  return { touched, line };
205
205
  }
206
206
 
207
- function addToPathWindows() {
207
+ function addToPathWindows(dir = mode.BIN_DIR) {
208
208
  // Nada de `setx`: trunca el PATH a 1024 caracteres y se come el de la gente.
209
209
  const ps = [
210
- "$dir = '" + mode.BIN_DIR.replace(/'/g, "''") + "'",
210
+ "$dir = '" + dir.replace(/'/g, "''") + "'",
211
211
  "$cur = [Environment]::GetEnvironmentVariable('Path','User')",
212
212
  "if ($null -eq $cur) { $cur = '' }",
213
213
  "if (($cur -split ';') -notcontains $dir) {",
@@ -220,7 +220,22 @@ function addToPathWindows() {
220
220
  encoding: 'utf8',
221
221
  });
222
222
  const added = res.status === 0 && String(res.stdout).includes('added');
223
- return { touched: added ? ['PATH de usuario (sin administrador)'] : [], line: mode.BIN_DIR };
223
+ return { touched: added ? ['PATH de usuario (sin administrador)'] : [], line: dir };
224
+ }
225
+
226
+ // El shim `glassnote.cmd` que crea npm invoca `node` del PATH. Cuando el Node lo bajó el
227
+ // instalador a ~/.glassnote, ese directorio solo quedaba en el PATH de la sesión de
228
+ // PowerShell que corrió la instalación: en una terminal nueva —o en cualquier proceso
229
+ // posterior— `glassnote` moría con «"node" no se reconoce como un comando». Se agrega el
230
+ // directorio del node al PATH de usuario, igual que BIN_DIR.
231
+ function addNodeToPathWindows() {
232
+ if (!IS_WIN) return null;
233
+ const nodeBinary = mode.resolveNodeBinary(process.execPath);
234
+ // Solo el node que trajimos nosotros: el del sistema ya está donde tiene que estar.
235
+ if (!nodeBinary || !mode.isInside(nodeBinary, mode.HOME_DIR)) return null;
236
+ const dir = path.dirname(nodeBinary);
237
+ const res = addToPathWindows(dir);
238
+ return res.touched.length ? dir : null;
224
239
  }
225
240
 
226
241
  function removeFromPathUnix() {
@@ -253,7 +268,10 @@ function removeFromPathWindows() {
253
268
  "$dir = '" + mode.BIN_DIR.replace(/'/g, "''") + "'",
254
269
  "$cur = [Environment]::GetEnvironmentVariable('Path','User')",
255
270
  "if ($null -eq $cur) { Write-Output 'absent'; exit }",
256
- "$new = (($cur -split ';') | Where-Object { $_ -ne '' -and $_ -ne $dir }) -join ';'",
271
+ // Se quita cualquier entrada bajo ~/.glassnote, no solo BIN_DIR: el install tambien
272
+ // agrega el directorio del node que bajo, y dejarlo seria una ruta muerta.
273
+ "$home2 = '" + mode.HOME_DIR.replace(/'/g, "''") + "'",
274
+ "$new = (($cur -split ';') | Where-Object { $_ -ne '' -and $_ -ne $dir -and -not $_.StartsWith($home2, [StringComparison]::OrdinalIgnoreCase) }) -join ';'",
257
275
  'if ($new -ne $cur) {',
258
276
  " [Environment]::SetEnvironmentVariable('Path', $new, 'User')",
259
277
  " Write-Output 'removed'",
@@ -457,6 +475,8 @@ function cmdInstall(args) {
457
475
  if (!noPath) {
458
476
  pathInfo = IS_WIN ? addToPathWindows() : addToPathUnix();
459
477
  if (pathInfo.touched.length) step(`agregado al PATH en: ${pathInfo.touched.join(' ')}`);
478
+ const nodeDir = addNodeToPathWindows();
479
+ if (nodeDir) step(`agregado al PATH: ${nodeDir} (lo necesita el comando glassnote)`);
460
480
  }
461
481
 
462
482
  log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassnote/client",
3
- "version": "2.4.5",
3
+ "version": "2.4.6",
4
4
  "description": "GlassNote — cliente de escritorio de notas superpuestas. Se instala con npx, sin instaladores nativos ni firmas.",
5
5
  "main": "main.js",
6
6
  "publishConfig": {