@backtomyfuture/exchange-cli 0.2.5 → 0.2.6
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/bin/runtime-layout.js +51 -4
- package/package.json +7 -7
package/bin/runtime-layout.js
CHANGED
|
@@ -30,15 +30,54 @@ function copyDirRecursive(srcDir, dstDir) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
let inMemoryLayoutChecked = false;
|
|
34
|
+
|
|
35
|
+
function linkOrCopyFile(src, dst) {
|
|
36
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
37
|
+
// Try hardlink first (fast, zero extra disk space, works on same filesystem)
|
|
38
|
+
try {
|
|
39
|
+
fs.linkSync(src, dst);
|
|
40
|
+
return;
|
|
41
|
+
} catch {
|
|
42
|
+
// Fall back to relative symlink
|
|
43
|
+
try {
|
|
44
|
+
const rel = path.relative(path.dirname(dst), src);
|
|
45
|
+
fs.symlinkSync(rel, dst);
|
|
46
|
+
return;
|
|
47
|
+
} catch {
|
|
48
|
+
// Fall back to file copy
|
|
49
|
+
fs.copyFileSync(src, dst);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const stat = fs.statSync(src);
|
|
54
|
+
fs.chmodSync(dst, stat.mode & 0o777);
|
|
55
|
+
} catch {
|
|
56
|
+
// Best effort only.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function linkOrCopyDir(srcDir, dstDir) {
|
|
61
|
+
fs.mkdirSync(path.dirname(dstDir), { recursive: true });
|
|
62
|
+
// Try symlink first for directories (like Versions/Current -> 3.12)
|
|
63
|
+
try {
|
|
64
|
+
const rel = path.relative(path.dirname(dstDir), srcDir);
|
|
65
|
+
fs.symlinkSync(rel, dstDir, 'junction');
|
|
66
|
+
return;
|
|
67
|
+
} catch {
|
|
68
|
+
copyDirRecursive(srcDir, dstDir);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function linkOrCopyIfMissing(src, dst, logger) {
|
|
34
73
|
if (fs.existsSync(dst) || !fs.existsSync(src)) {
|
|
35
74
|
return false;
|
|
36
75
|
}
|
|
37
76
|
const stat = fs.statSync(src);
|
|
38
77
|
if (stat.isDirectory()) {
|
|
39
|
-
|
|
78
|
+
linkOrCopyDir(src, dst);
|
|
40
79
|
} else {
|
|
41
|
-
|
|
80
|
+
linkOrCopyFile(src, dst);
|
|
42
81
|
}
|
|
43
82
|
if (logger) {
|
|
44
83
|
logger(`exchange-cli: repaired missing runtime path ${path.basename(dst)}`);
|
|
@@ -70,22 +109,29 @@ function resolveFrameworkVersionDir(internalDir) {
|
|
|
70
109
|
}
|
|
71
110
|
|
|
72
111
|
function ensureDarwinArm64RuntimeLayout(binaryPath, logger = null) {
|
|
112
|
+
if (inMemoryLayoutChecked) {
|
|
113
|
+
return { changed: false };
|
|
114
|
+
}
|
|
73
115
|
if (!(process.platform === 'darwin' && process.arch === 'arm64')) {
|
|
116
|
+
inMemoryLayoutChecked = true;
|
|
74
117
|
return { changed: false };
|
|
75
118
|
}
|
|
76
119
|
const binDir = path.dirname(binaryPath);
|
|
77
120
|
const internalDir = path.join(binDir, '_internal');
|
|
78
121
|
if (!fs.existsSync(internalDir)) {
|
|
122
|
+
inMemoryLayoutChecked = true;
|
|
79
123
|
return { changed: false };
|
|
80
124
|
}
|
|
81
125
|
|
|
82
126
|
const markerPath = path.join(internalDir, '.runtime_layout_ok');
|
|
83
127
|
if (fs.existsSync(markerPath)) {
|
|
128
|
+
inMemoryLayoutChecked = true;
|
|
84
129
|
return { changed: false };
|
|
85
130
|
}
|
|
86
131
|
|
|
87
132
|
const frameworkVersionDir = resolveFrameworkVersionDir(internalDir);
|
|
88
133
|
if (!frameworkVersionDir) {
|
|
134
|
+
inMemoryLayoutChecked = true;
|
|
89
135
|
return { changed: false };
|
|
90
136
|
}
|
|
91
137
|
const sourcePython = path.join(frameworkVersionDir, 'Python');
|
|
@@ -103,7 +149,7 @@ function ensureDarwinArm64RuntimeLayout(binaryPath, logger = null) {
|
|
|
103
149
|
|
|
104
150
|
let changed = false;
|
|
105
151
|
for (const target of targets) {
|
|
106
|
-
changed =
|
|
152
|
+
changed = linkOrCopyIfMissing(target.src, target.dst, logger) || changed;
|
|
107
153
|
}
|
|
108
154
|
|
|
109
155
|
try {
|
|
@@ -118,6 +164,7 @@ function ensureDarwinArm64RuntimeLayout(binaryPath, logger = null) {
|
|
|
118
164
|
// Best effort only.
|
|
119
165
|
}
|
|
120
166
|
|
|
167
|
+
inMemoryLayoutChecked = true;
|
|
121
168
|
return { changed };
|
|
122
169
|
}
|
|
123
170
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtomyfuture/exchange-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Cross-platform CLI for on-premises Microsoft Exchange Server",
|
|
5
5
|
"bin": {
|
|
6
6
|
"exchange-cli": "./bin/exchange-cli.js"
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"install.js"
|
|
14
14
|
],
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@backtomyfuture/exchange-cli-darwin-arm64": "0.2.
|
|
17
|
-
"@backtomyfuture/exchange-cli-darwin-x64": "0.2.
|
|
18
|
-
"@backtomyfuture/exchange-cli-linux-x64": "0.2.
|
|
19
|
-
"@backtomyfuture/exchange-cli-linux-arm64": "0.2.
|
|
20
|
-
"@backtomyfuture/exchange-cli-win32-x64": "0.2.
|
|
21
|
-
"@backtomyfuture/exchange-cli-win32-ia32": "0.2.
|
|
16
|
+
"@backtomyfuture/exchange-cli-darwin-arm64": "0.2.6",
|
|
17
|
+
"@backtomyfuture/exchange-cli-darwin-x64": "0.2.6",
|
|
18
|
+
"@backtomyfuture/exchange-cli-linux-x64": "0.2.6",
|
|
19
|
+
"@backtomyfuture/exchange-cli-linux-arm64": "0.2.6",
|
|
20
|
+
"@backtomyfuture/exchange-cli-win32-x64": "0.2.6",
|
|
21
|
+
"@backtomyfuture/exchange-cli-win32-ia32": "0.2.6"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=14"
|