@tedbrain/vlink 0.1.68 → 0.1.70
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/README.md +22 -0
- package/bin/vlink.js +1 -1
- package/binaries.json +8 -8
- package/installer.js +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,28 @@ npm exec --registry=https://registry.npmmirror.com \
|
|
|
66
66
|
npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install --no-setup
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
## 安装 Web 通道
|
|
70
|
+
|
|
71
|
+
用于网页接入、终端和协议命令调用时,执行:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install --web
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
该选项复用原生二进制下载、更新、安装路径、PATH 和补全配置,跳过
|
|
78
|
+
`vlink setup tedbrain`,随后使用安装后的二进制绝对路径依次执行:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
vlink channel web install-protocol
|
|
82
|
+
vlink channel web start
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
协议注册或服务启动失败时,安装命令返回非零退出码。
|
|
86
|
+
`--web` 可与 `--verbose`、`--no-setup` 一起使用;`--no-setup`
|
|
87
|
+
仅控制 TedBrain 向导,不会禁用 Web 初始化。
|
|
88
|
+
服务已运行时沿用 `channel web start` 的幂等复用行为,不强制重启现有终端。
|
|
89
|
+
该选项启动当前服务并注册 `vlink://` 唤起入口,不配置开机自启动。
|
|
90
|
+
|
|
69
91
|
## 下载地址
|
|
70
92
|
|
|
71
93
|
安装脚本优先从 Gitee Release 解析当前版本对应平台的附件并下载;Gitee 不可用、
|
package/bin/vlink.js
CHANGED
|
@@ -15,7 +15,7 @@ function verbose(message) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function diagnosticArgs(args) {
|
|
18
|
-
const safe = new Set(['install', '--verbose', '--no-setup', '--help', '-h']);
|
|
18
|
+
const safe = new Set(['install', '--verbose', '--no-setup', '--web', '--help', '-h']);
|
|
19
19
|
return args.map((arg) => {
|
|
20
20
|
if (safe.has(arg)) return arg;
|
|
21
21
|
if (arg.startsWith('--')) return arg.split('=', 1)[0];
|
package/binaries.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.70",
|
|
3
3
|
"binaries": {
|
|
4
|
-
"linux-x86_64": "
|
|
5
|
-
"linux-x86_64-glibc2.17": "
|
|
6
|
-
"linux-aarch64": "
|
|
7
|
-
"macos-x86_64": "
|
|
8
|
-
"macos-aarch64": "
|
|
9
|
-
"windows-x86_64.exe": "
|
|
10
|
-
"windows-aarch64.exe": "
|
|
4
|
+
"linux-x86_64": "f529d9a7f9570be4037468c1f5380fbf829c26303fcbd1b74dca960e1f021812",
|
|
5
|
+
"linux-x86_64-glibc2.17": "a5a971f8f8a582b47eb278e053c67a9e9064d7d4a81f6ff3451b97a581cb6156",
|
|
6
|
+
"linux-aarch64": "b63ba5fb4671de00f03d7374098f9afa49df54bc2fddc8d71d697644d8ed2735",
|
|
7
|
+
"macos-x86_64": "74018d79749e1bf70a3351ae7f570393e98bd277ce30551a5e04200e2a49ec86",
|
|
8
|
+
"macos-aarch64": "0960f17cb2e2367372a068d3acaf55aec4f5739a8801863dc820fa29130b3d89",
|
|
9
|
+
"windows-x86_64.exe": "e6727f3748cc9d54274429cbcd121a7c32bba6367fee7a0bd376aeafcc07747c",
|
|
10
|
+
"windows-aarch64.exe": "71f430f714772917510c010439260fe5805b22a70465c5ac4f695582edebe357"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/installer.js
CHANGED
|
@@ -435,7 +435,8 @@ async function runInstaller(options = {}) {
|
|
|
435
435
|
const env = options.env || process.env;
|
|
436
436
|
const platform = options.platform || env.VLINK_PLATFORM || process.platform;
|
|
437
437
|
const arch = options.arch || env.VLINK_ARCH || process.arch;
|
|
438
|
-
const
|
|
438
|
+
const web = Boolean(options.web);
|
|
439
|
+
const skipSetup = web || Boolean(options.skipSetup);
|
|
439
440
|
const verbose = verboseEnabled(options);
|
|
440
441
|
const home = options.home || os.homedir();
|
|
441
442
|
const fsImpl = options.fs || fs;
|
|
@@ -578,19 +579,34 @@ async function runInstaller(options = {}) {
|
|
|
578
579
|
verboseLog('setup stage: completed successfully', sharedOptions);
|
|
579
580
|
}
|
|
580
581
|
|
|
582
|
+
if (web) {
|
|
583
|
+
for (const operation of ['install-protocol', 'start']) {
|
|
584
|
+
const args = ['channel', 'web', operation];
|
|
585
|
+
log(operation === 'install-protocol'
|
|
586
|
+
? 'registering the vlink:// protocol'
|
|
587
|
+
: 'starting the Web channel service', output);
|
|
588
|
+
verboseLog(`web stage: executing ${vlinkPath} ${args.join(' ')}`, sharedOptions);
|
|
589
|
+
const result = spawnSyncImpl(vlinkPath, args, { env, stdio: 'inherit' });
|
|
590
|
+
const failure = commandFailure(result, `vlink ${args.join(' ')}`);
|
|
591
|
+
if (failure) throw new VlinkSetupError(failure);
|
|
592
|
+
}
|
|
593
|
+
log('Web channel is ready', output);
|
|
594
|
+
}
|
|
595
|
+
|
|
581
596
|
log(`installation complete: ${vlinkPath}`, output);
|
|
582
597
|
log('open a new terminal to use the updated PATH', output);
|
|
583
|
-
return { installDir, vlinkPath, commandShimPath, setupSkipped: skipSetup };
|
|
598
|
+
return { installDir, vlinkPath, commandShimPath, setupSkipped: skipSetup, webStarted: web };
|
|
584
599
|
}
|
|
585
600
|
|
|
586
601
|
function printInstallHelp(output = process.stdout) {
|
|
587
602
|
output.write(
|
|
588
603
|
[
|
|
589
|
-
'Usage: npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install [--no-setup] [--verbose]',
|
|
604
|
+
'Usage: npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install [--no-setup] [--web] [--verbose]',
|
|
590
605
|
'',
|
|
591
606
|
'Installs or updates vlink and adds it to the user PATH.',
|
|
592
607
|
'',
|
|
593
608
|
' --no-setup Install without starting the TedBrain setup wizard.',
|
|
609
|
+
' --web Register vlink:// and start the Web channel instead of TedBrain setup.',
|
|
594
610
|
' --verbose Print diagnostics for every installation stage.'
|
|
595
611
|
].join('\n') + '\n'
|
|
596
612
|
);
|
|
@@ -603,10 +619,13 @@ async function runInstallerFromArgs(args, options = {}) {
|
|
|
603
619
|
}
|
|
604
620
|
|
|
605
621
|
let skipSetup = false;
|
|
622
|
+
let web = false;
|
|
606
623
|
let verbose = verboseEnabled(options);
|
|
607
624
|
for (const arg of args) {
|
|
608
625
|
if (arg === '--no-setup') {
|
|
609
626
|
skipSetup = true;
|
|
627
|
+
} else if (arg === '--web') {
|
|
628
|
+
web = true;
|
|
610
629
|
} else if (arg === '--verbose') {
|
|
611
630
|
verbose = true;
|
|
612
631
|
} else {
|
|
@@ -614,7 +633,7 @@ async function runInstallerFromArgs(args, options = {}) {
|
|
|
614
633
|
throw new VlinkSetupError(`unknown install option: ${displayArg}`);
|
|
615
634
|
}
|
|
616
635
|
}
|
|
617
|
-
return runInstaller({ ...options, skipSetup, verbose });
|
|
636
|
+
return runInstaller({ ...options, skipSetup, web, verbose });
|
|
618
637
|
}
|
|
619
638
|
|
|
620
639
|
module.exports = {
|
package/package.json
CHANGED