@3-/srv-win32 0.1.20 → 0.1.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @3-/srv-win32
2
2
 
3
+ ## 0.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - auto update
8
+
3
9
  ## 0.1.20
4
10
 
5
11
  ### Patch Changes
package/install.js CHANGED
@@ -1,12 +1,26 @@
1
+ import { join } from "node:path";
2
+ import { tmpdir } from "node:os";
3
+ import { unlinkSync, readFileSync, writeFileSync } from "node:fs";
1
4
  import { $ } from "./init.js";
5
+ import gen from "@3-/obj_replace/gen.js";
2
6
 
3
7
  export default async (name, exec_path, args) => {
4
8
  try {
5
9
  await $`schtasks /End /TN ${name}`;
6
10
  } catch (e) {}
7
11
 
8
- const cmd = `schtasks /Create /F /TN ${name} /TR "\\"${exec_path}\\" \\"${args}\\" run" /SC ONLOGON`;
9
- await $([cmd]);
12
+ const xml_path = join(tmpdir(), `${name}.xml`);
13
+
14
+ gen(
15
+ { name, execPath: exec_path, scriptPath: args },
16
+ join(import.meta.dirname, "schtasks.xml"),
17
+ xml_path
18
+ );
19
+
20
+ writeFileSync(xml_path, "\uFEFF" + readFileSync(xml_path, "utf8"), "utf16le");
21
+
22
+ await $([`schtasks /Create /F /TN ${name} /XML "${xml_path}"`]);
23
+ unlinkSync(xml_path);
10
24
 
11
25
  await $`schtasks /Run /TN ${name}`;
12
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3-/srv-win32",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "os": [
5
5
  "win32"
6
6
  ],
@@ -10,6 +10,7 @@
10
10
  "./uninstall.js": "./uninstall.js"
11
11
  },
12
12
  "dependencies": {
13
+ "@3-/obj_replace": "^0.1.0",
13
14
  "zx": "^8.8.5"
14
15
  },
15
16
  "repository": "https://github.com/i18n-site/lib/tree/dev",
package/schtasks.xml ADDED
@@ -0,0 +1,43 @@
1
+ <?xml version="1.0" encoding="UTF-16"?>
2
+ <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
3
+ <Principals>
4
+ <Principal id="Author">
5
+ <LogonType>InteractiveToken</LogonType>
6
+ <RunLevel>HighestAvailable</RunLevel>
7
+ </Principal>
8
+ </Principals>
9
+ <Triggers>
10
+ <LogonTrigger>
11
+ <Enabled>true</Enabled>
12
+ </LogonTrigger>
13
+ </Triggers>
14
+ <Settings>
15
+ <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
16
+ <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
17
+ <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
18
+ <AllowHardTerminate>true</AllowHardTerminate>
19
+ <StartWhenAvailable>false</StartWhenAvailable>
20
+ <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
21
+ <IdleSettings>
22
+ <StopOnIdleEnd>true</StopOnIdleEnd>
23
+ <RestartOnIdle>false</RestartOnIdle>
24
+ </IdleSettings>
25
+ <AllowStartOnDemand>true</AllowStartOnDemand>
26
+ <Enabled>true</Enabled>
27
+ <Hidden>false</Hidden>
28
+ <RunOnlyIfIdle>false</RunOnlyIfIdle>
29
+ <WakeToRun>false</WakeToRun>
30
+ <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
31
+ <Priority>7</Priority>
32
+ <RestartOnFailure>
33
+ <Interval>PT1M</Interval>
34
+ <Count>999</Count>
35
+ </RestartOnFailure>
36
+ </Settings>
37
+ <Actions Context="Author">
38
+ <Exec>
39
+ <Command>$execPath</Command>
40
+ <Arguments>"$scriptPath" run</Arguments>
41
+ </Exec>
42
+ </Actions>
43
+ </Task>