@tedbrain/vlink 0.1.159 → 0.1.160
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 +13 -8
- package/binaries.json +21 -21
- package/install.js +50 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,20 +9,25 @@ npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
|
|
|
9
9
|
|
|
10
10
|
npm 包只注册 `vlink-install` 命令;`vlink` 命令由安装后的原生程序提供。
|
|
11
11
|
`npx` 会自动选择包中唯一的命令入口,因此上面的安装命令保持不变。
|
|
12
|
-
全局安装 npm
|
|
12
|
+
全局安装 npm 包会注册 `vlink-install`;Windows 下 npm 会生成
|
|
13
13
|
`vlink-install`、`vlink-install.cmd`、`vlink-install.ps1` 三个入口。
|
|
14
|
-
|
|
14
|
+
升级到原生程序只需一条命令:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install -g @tedbrain/vlink@latest --registry=https://registry.npmmirror.com
|
|
18
|
-
vlink-install install
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
`npm_config_global=true` 时,包内 `postinstall` 除下载二进制外,会像
|
|
21
|
+
`vlink-install install` 一样把它原子安装到用户安装目录、停掉旧 daemon 并
|
|
22
|
+
配置用户 PATH;它不会启动交互式的 `vlink setup tedbrain`。如果 PATH 中已有
|
|
23
|
+
原生 vlink,会优先更新该位置;旧文件或目录不可写时,自动回退到用户安装目录
|
|
24
|
+
(Unix 为 `~/.local/bin`,Windows 为 `%LOCALAPPDATA%\TedBrain\bin`),保留原来
|
|
25
|
+
的共享安装。显式设置 `VLINK_INSTALL_DIR` 时始终使用该目录,写入失败会报错,
|
|
26
|
+
不会再改装到其他位置。
|
|
27
|
+
|
|
28
|
+
需要交互式 setup 或 `--no-setup` / `--web` / `--verbose` 选项时,仍可执行
|
|
29
|
+
`vlink-install install`。在 CI 或不允许 postinstall 触碰用户目录/daemon 的
|
|
30
|
+
环境里,设置 `VLINK_NPM_GLOBAL_INSTALL=0` 让全局 `postinstall` 只下载二进制。
|
|
26
31
|
|
|
27
32
|
安装目录会优先加入当前安装进程的 PATH,补全和 setup 均使用新二进制的绝对路径。
|
|
28
33
|
默认目录还会写入 shell 配置或 Windows 用户 PATH;自定义 Unix 目录需要自行配置
|
package/binaries.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.160",
|
|
3
3
|
"binaries": {
|
|
4
4
|
"linux-x86_64": {
|
|
5
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
6
|
-
"sha256": "
|
|
7
|
-
"size":
|
|
5
|
+
"url": "https://cloud.tsinghua.edu.cn/f/e0fa60e0b68f4d2f88e3/?dl=1",
|
|
6
|
+
"sha256": "e1f5cb23e28da74a9f9a7962d2e880fd7f57d3171b5cb7c9edef9e5cbbe91eb8",
|
|
7
|
+
"size": 24803709
|
|
8
8
|
},
|
|
9
9
|
"linux-x86_64-glibc2.17": {
|
|
10
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
11
|
-
"sha256": "
|
|
12
|
-
"size":
|
|
10
|
+
"url": "https://cloud.tsinghua.edu.cn/f/729d55a84fb54d239f2f/?dl=1",
|
|
11
|
+
"sha256": "02d68d969eadd3757e771974c974b533ae571230e10addfcd0409b9a26c3a539",
|
|
12
|
+
"size": 25526985
|
|
13
13
|
},
|
|
14
14
|
"linux-aarch64": {
|
|
15
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
16
|
-
"sha256": "
|
|
15
|
+
"url": "https://cloud.tsinghua.edu.cn/f/f913297b974f475b8535/?dl=1",
|
|
16
|
+
"sha256": "edfb9470a416046b352cc95f062daf40915d0263f18b46767d6eefd85d950ef3",
|
|
17
17
|
"size": 21113765
|
|
18
18
|
},
|
|
19
19
|
"macos-x86_64": {
|
|
20
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
21
|
-
"sha256": "
|
|
22
|
-
"size":
|
|
20
|
+
"url": "https://cloud.tsinghua.edu.cn/f/1bf74767cf074d24a149/?dl=1",
|
|
21
|
+
"sha256": "2789f0e2f9fdc3884aef92fff9824490e52f75029c7acd04ae0f3cd7be0a7549",
|
|
22
|
+
"size": 22181593
|
|
23
23
|
},
|
|
24
24
|
"macos-aarch64": {
|
|
25
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
26
|
-
"sha256": "
|
|
27
|
-
"size":
|
|
25
|
+
"url": "https://cloud.tsinghua.edu.cn/f/824b1cf060ff4d548054/?dl=1",
|
|
26
|
+
"sha256": "127e180ba53d4033a7543d97e1e5df81b6c7c2dac6ad123d8f6b777e28fbdd48",
|
|
27
|
+
"size": 17956309
|
|
28
28
|
},
|
|
29
29
|
"windows-x86_64.exe": {
|
|
30
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
31
|
-
"sha256": "
|
|
32
|
-
"size":
|
|
30
|
+
"url": "https://cloud.tsinghua.edu.cn/f/2ee4076c15ee4af4a1c3/?dl=1",
|
|
31
|
+
"sha256": "529795cb23428b70de94f2256b6c2a620c2d662e8f6e1edcaad043346d699ea9",
|
|
32
|
+
"size": 9742629
|
|
33
33
|
},
|
|
34
34
|
"windows-aarch64.exe": {
|
|
35
|
-
"url": "https://cloud.tsinghua.edu.cn/f/
|
|
36
|
-
"sha256": "
|
|
37
|
-
"size":
|
|
35
|
+
"url": "https://cloud.tsinghua.edu.cn/f/78af63aa46ad4fd69395/?dl=1",
|
|
36
|
+
"sha256": "2915213f17f874cde721f288c8875c2e78b2bd05310c974088ef07e50d72d049",
|
|
37
|
+
"size": 11224361
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
package/install.js
CHANGED
|
@@ -611,6 +611,48 @@ async function ensureBinary(options = {}) {
|
|
|
611
611
|
throw new VlinkInstallError(`all download sources failed: ${lastError.message}`);
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
+
// `npm i -g @tedbrain/vlink` must be the only step a user needs. npm runs this
|
|
615
|
+
// file as the global postinstall, but the package's own `vlink-install` bin is
|
|
616
|
+
// not on PATH, so download-only would leave no `vlink` command behind. When
|
|
617
|
+
// npm reports a global install, hand over to the installer: it atomically
|
|
618
|
+
// places the binary in the user install directory, stops the previous daemon
|
|
619
|
+
// and updates PATH, exactly like `vlink-install install` does.
|
|
620
|
+
function globalInstallRequested(env = process.env) {
|
|
621
|
+
return ['1', 'true', 'yes', 'on'].includes(
|
|
622
|
+
String(env.npm_config_global || '').toLowerCase()
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function globalInstallDisabled(env = process.env) {
|
|
627
|
+
return ['0', 'false', 'no', 'off'].includes(
|
|
628
|
+
String(env.VLINK_NPM_GLOBAL_INSTALL || '').toLowerCase()
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
async function runPostinstall(options = {}) {
|
|
633
|
+
const env = options.env || process.env;
|
|
634
|
+
const output = options.output || process.stderr;
|
|
635
|
+
const globalInstall =
|
|
636
|
+
options.globalInstall === undefined
|
|
637
|
+
? globalInstallRequested(env) && !globalInstallDisabled(env)
|
|
638
|
+
: options.globalInstall === true;
|
|
639
|
+
if (globalInstall) {
|
|
640
|
+
// Installer setup is interactive; npm postinstall has no terminal. The
|
|
641
|
+
// explicit `vlink-install install` / `vlink setup tedbrain` path still
|
|
642
|
+
// offers the wizard and its --no-setup/--web flags.
|
|
643
|
+
const runInstaller =
|
|
644
|
+
options.runInstaller || require('./installer').runInstaller;
|
|
645
|
+
const result = await runInstaller({ env, output, skipSetup: true });
|
|
646
|
+
output.write(`[vlink] installed ${result.vlinkPath}\n`);
|
|
647
|
+
return { global: true, ...result };
|
|
648
|
+
}
|
|
649
|
+
const ensure = options.ensureBinary || ensureBinary;
|
|
650
|
+
const binaryPath = await ensure();
|
|
651
|
+
cleanupLegacyNpmShims();
|
|
652
|
+
output.write(`[vlink] installed ${binaryPath}\n`);
|
|
653
|
+
return { global: false, binaryPath };
|
|
654
|
+
}
|
|
655
|
+
|
|
614
656
|
module.exports = {
|
|
615
657
|
VlinkInstallError,
|
|
616
658
|
VERSION,
|
|
@@ -631,17 +673,15 @@ module.exports = {
|
|
|
631
673
|
downloadFile,
|
|
632
674
|
resolveBinaryPath,
|
|
633
675
|
ensureBinary,
|
|
634
|
-
verifyBinary
|
|
676
|
+
verifyBinary,
|
|
677
|
+
globalInstallRequested,
|
|
678
|
+
globalInstallDisabled,
|
|
679
|
+
runPostinstall
|
|
635
680
|
};
|
|
636
681
|
|
|
637
682
|
if (require.main === module) {
|
|
638
|
-
|
|
639
|
-
.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
})
|
|
643
|
-
.catch((err) => {
|
|
644
|
-
console.error(`[vlink] install failed: ${err.message}`);
|
|
645
|
-
process.exitCode = 1;
|
|
646
|
-
});
|
|
683
|
+
runPostinstall().catch((err) => {
|
|
684
|
+
console.error(`[vlink] install failed: ${err.message}`);
|
|
685
|
+
process.exitCode = 1;
|
|
686
|
+
});
|
|
647
687
|
}
|
package/package.json
CHANGED