@moredrive/sync 0.0.0-stage → 1.2.0
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 +10 -2
- package/bin/moredrive-sync.mjs +28 -0
- package/build-info.json +4 -0
- package/package.json +26 -4
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MoreDrive Sync
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
远端到本地的同步工具。需要 Node.js 22 或更新版本。支持 macOS Apple Silicon、Windows x64、Linux x64(glibc 2.34 或更新版本及 libgcc_s,不支持 Alpine/musl)。Windows 需要 Microsoft Visual C++ 2015–2022 x64 运行库。
|
|
4
|
+
|
|
5
|
+
安装:`npm install -g @moredrive/sync`
|
|
6
|
+
|
|
7
|
+
更新:`npm install -g @moredrive/sync@latest`
|
|
8
|
+
|
|
9
|
+
检查:`moredrive-sync --version`、`moredrive-sync --help`。先通过 MoreDrive CLI 登录,再按帮助配置同步目录,先 dry-run 验证计划。删除操作需显式启用。程序不会自动替换自身。
|
|
10
|
+
|
|
11
|
+
安装时会按平台选择对应的原生程序,无安装脚本或安装时下载器。原生包附有依赖许可证。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
9
|
+
const supported = ['darwin-arm64', 'win32-x64', 'linux-x64'];
|
|
10
|
+
let binary;
|
|
11
|
+
try {
|
|
12
|
+
if (!supported.includes(platform)) throw new Error(`Unsupported platform: ${platform}`);
|
|
13
|
+
if (process.platform === 'linux' && !process.report.getReport().header.glibcVersionRuntime) {
|
|
14
|
+
throw new Error('Linux musl is not supported; use a glibc distribution');
|
|
15
|
+
}
|
|
16
|
+
const manifestPath = require.resolve(`@moredrive/sync-${platform}/package.json`);
|
|
17
|
+
const native = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
18
|
+
const wrapper = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
19
|
+
if (native.version !== wrapper.version) throw new Error('Native package version does not match wrapper');
|
|
20
|
+
binary = join(dirname(manifestPath), 'bin', process.platform === 'win32' ? 'moredrive-sync.exe' : 'moredrive-sync');
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(`MoreDrive Sync: ${error.message}. Install with optional dependencies enabled.`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit', shell: false });
|
|
26
|
+
for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => child.kill(signal));
|
|
27
|
+
child.on('error', (error) => { console.error(`MoreDrive Sync: ${error.message}`); process.exitCode = 1; });
|
|
28
|
+
child.on('exit', (code, signal) => { process.exitCode = code ?? (signal === 'SIGINT' ? 130 : signal === 'SIGTERM' ? 143 : 1); });
|
package/build-info.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
+
"version": "1.2.0",
|
|
3
|
+
"license": "UNLICENSED",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public",
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
2
8
|
"name": "@moredrive/sync",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
9
|
+
"description": "MoreDrive remote-to-local synchronization client",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"moredrive-sync": "bin/moredrive-sync.mjs"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin/",
|
|
19
|
+
"*.md",
|
|
20
|
+
"docs/",
|
|
21
|
+
"build-info.json"
|
|
22
|
+
],
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@moredrive/sync-darwin-arm64": "1.2.0",
|
|
25
|
+
"@moredrive/sync-win32-x64": "1.2.0",
|
|
26
|
+
"@moredrive/sync-linux-x64": "1.2.0"
|
|
27
|
+
}
|
|
28
|
+
}
|