@ffflorian/windows-shortcut-maker 2.14.0 → 2.14.2
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/dist/index.d.ts +1 -1
- package/dist/index.js +27 -27
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -20,5 +20,5 @@ export interface ShortcutOptions {
|
|
|
20
20
|
/** the initial window mode adopted by the original file when executed. (e.g. `3` is maximized, `4` is normal and `7` is minimized) */
|
|
21
21
|
linkWindowMode?: number;
|
|
22
22
|
}
|
|
23
|
-
export declare function makeSync(options: ShortcutOptions | string): void;
|
|
24
23
|
export declare function make(options: ShortcutOptions | string): Promise<void>;
|
|
24
|
+
export declare function makeSync(options: ShortcutOptions | string): void;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { spawn, spawnSync } from 'node:child_process';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
export function make(options) {
|
|
5
|
+
const checkedOptions = prepare(options);
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
spawn('wscript', buildArgs(checkedOptions))
|
|
8
|
+
.on('error', reject)
|
|
9
|
+
.on('exit', () => resolve());
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function makeSync(options) {
|
|
13
|
+
const checkedOptions = prepare(options);
|
|
14
|
+
spawnSync('wscript', buildArgs(checkedOptions));
|
|
15
|
+
}
|
|
16
|
+
function buildArgs(options) {
|
|
17
|
+
const scriptPath = path.join(__dirname, '../scripts/createLink.vbs');
|
|
18
|
+
return [
|
|
19
|
+
scriptPath,
|
|
20
|
+
options.filepath,
|
|
21
|
+
options.linkFilepath,
|
|
22
|
+
options.linkName,
|
|
23
|
+
options.linkArgs,
|
|
24
|
+
options.linkDescription,
|
|
25
|
+
options.linkCwd,
|
|
26
|
+
options.linkIcon,
|
|
27
|
+
options.linkWindowMode.toString(),
|
|
28
|
+
options.linkHotkey,
|
|
29
|
+
];
|
|
30
|
+
}
|
|
4
31
|
function mergeOptions(options) {
|
|
5
32
|
const rawName = path.basename(options.filepath).replace(/(.*)\..*$/, '$1');
|
|
6
33
|
const defaultOptions = {
|
|
@@ -38,30 +65,3 @@ function prepare(options) {
|
|
|
38
65
|
}
|
|
39
66
|
return checkedOptions;
|
|
40
67
|
}
|
|
41
|
-
function buildArgs(options) {
|
|
42
|
-
const scriptPath = path.join(__dirname, '../scripts/createLink.vbs');
|
|
43
|
-
return [
|
|
44
|
-
scriptPath,
|
|
45
|
-
options.filepath,
|
|
46
|
-
options.linkFilepath,
|
|
47
|
-
options.linkName,
|
|
48
|
-
options.linkArgs,
|
|
49
|
-
options.linkDescription,
|
|
50
|
-
options.linkCwd,
|
|
51
|
-
options.linkIcon,
|
|
52
|
-
options.linkWindowMode.toString(),
|
|
53
|
-
options.linkHotkey,
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
export function makeSync(options) {
|
|
57
|
-
const checkedOptions = prepare(options);
|
|
58
|
-
spawnSync('wscript', buildArgs(checkedOptions));
|
|
59
|
-
}
|
|
60
|
-
export function make(options) {
|
|
61
|
-
const checkedOptions = prepare(options);
|
|
62
|
-
return new Promise((resolve, reject) => {
|
|
63
|
-
spawn('wscript', buildArgs(checkedOptions))
|
|
64
|
-
.on('error', reject)
|
|
65
|
-
.on('exit', () => resolve());
|
|
66
|
-
});
|
|
67
|
-
}
|
package/package.json
CHANGED