@webority/ensemble 0.5.3 → 0.5.4
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/lib/core.js +33 -4
- package/package.json +8 -1
package/lib/core.js
CHANGED
|
@@ -110,20 +110,49 @@ async function ensureRuntime() {
|
|
|
110
110
|
return ensureBinaries();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// The per-platform npm optionalDependency (esbuild model): npm installs only the one matching this
|
|
114
|
+
// OS/arch, with the binaries inside. Returns its directory, or null if it isn't installed (then we
|
|
115
|
+
// fall back to the CDN). require.resolve finds it whether hoisted or nested in node_modules.
|
|
116
|
+
function platformPackageDir() {
|
|
117
|
+
const map = {
|
|
118
|
+
'win-x64': '@webority/ensemble-win-x64',
|
|
119
|
+
'osx-arm64': '@webority/ensemble-darwin-arm64',
|
|
120
|
+
'osx-x64': '@webority/ensemble-darwin-x64',
|
|
121
|
+
'linux-x64': '@webority/ensemble-linux-x64',
|
|
122
|
+
'linux-arm64': '@webority/ensemble-linux-arm64',
|
|
123
|
+
};
|
|
124
|
+
const pkg = map[platform().key];
|
|
125
|
+
if (!pkg) return null;
|
|
126
|
+
try {
|
|
127
|
+
return path.dirname(require.resolve(pkg + '/package.json'));
|
|
128
|
+
} catch (e) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Put the runner + bus in ~/.ensemble (the stable location the daemon, hooks, and autostart use).
|
|
134
|
+
// Source them from the npm-installed platform package (instant copy, no download); only if that
|
|
135
|
+
// package isn't present do we download from the CDN. So `npm i` delivers the binary and `login`
|
|
136
|
+
// just copies + wires it.
|
|
113
137
|
async function ensureBinaries() {
|
|
114
138
|
ensureDirs();
|
|
115
139
|
const pf = platform();
|
|
116
140
|
assertSupported();
|
|
117
141
|
const busPath = path.join(BIN_DIR, 'ensemble-bus' + pf.exe);
|
|
118
142
|
const runnerPath = path.join(RUNNER_DIR, 'Ensemble.Runner' + pf.exe);
|
|
143
|
+
const pkgDir = platformPackageDir();
|
|
119
144
|
const targets = [
|
|
120
|
-
{
|
|
121
|
-
{
|
|
145
|
+
{ src: pkgDir && path.join(pkgDir, 'ensemble-bus' + pf.exe), cdn: 'ensemble-bus-' + pf.key + pf.exe, dest: busPath },
|
|
146
|
+
{ src: pkgDir && path.join(pkgDir, 'Ensemble.Runner' + pf.exe), cdn: 'ensemble-runner-' + pf.key + pf.exe, dest: runnerPath },
|
|
122
147
|
];
|
|
123
148
|
for (const t of targets) {
|
|
124
149
|
if (fs.existsSync(t.dest) && fs.statSync(t.dest).size > 0) continue;
|
|
125
|
-
|
|
126
|
-
|
|
150
|
+
if (t.src && fs.existsSync(t.src) && fs.statSync(t.src).size > 0) {
|
|
151
|
+
fs.copyFileSync(t.src, t.dest); // from the npm platform package — no download
|
|
152
|
+
} else {
|
|
153
|
+
log(' downloading ' + t.cdn + ' …');
|
|
154
|
+
await downloadTo(DL_BASE + '/' + t.cdn, t.dest);
|
|
155
|
+
}
|
|
127
156
|
if (pf.os !== 'windows') {
|
|
128
157
|
fs.chmodSync(t.dest, 0o755);
|
|
129
158
|
// macOS requires at least an ad-hoc signature to run an unsigned binary.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ensemble",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Connect this machine to your Ensemble control plane — runs the local agent runner and wires the ensemble-bus session bus so your coding sessions talk (per-org, isolated).",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ensemble": "bin/ensemble.js"
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"@webority/ensemble-darwin-arm64": "0.5.4",
|
|
13
|
+
"@webority/ensemble-darwin-x64": "0.5.4",
|
|
14
|
+
"@webority/ensemble-linux-arm64": "0.5.4",
|
|
15
|
+
"@webority/ensemble-linux-x64": "0.5.4",
|
|
16
|
+
"@webority/ensemble-win-x64": "0.5.4"
|
|
17
|
+
},
|
|
11
18
|
"files": [
|
|
12
19
|
"bin",
|
|
13
20
|
"lib",
|