electrobun 2.0.4 → 2.0.5-beta.2

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  // Resolve the exact Hutch release paired with this electrobun npm version.
4
4
  // The single npm package stays platform-neutral: each Electrobun GitHub
5
- // Release carries the five Hutch archives, and this shim verifies and caches
5
+ // Release carries the six Hutch archives, and this shim verifies and caches
6
6
  // the host archive on first use. A compatible machine-wide launcher remains
7
7
  // a fallback, but Hutch before 0.22 cannot honor the paired default variables.
8
8
 
@@ -27,7 +27,7 @@ const { homedir, tmpdir } = require("node:os");
27
27
  const path = require("node:path");
28
28
 
29
29
  // Stamped by push-version.js from package/hutch.config.ts.
30
- const PAIRED_HUTCH_VERSION = "0.28.1";
30
+ const PAIRED_HUTCH_VERSION = "0.28.2-canary.3";
31
31
  const ELECTROBUN_VERSION = require("../package.json").version;
32
32
 
33
33
  const MINIMUM_DEFAULTS_HUTCH_VERSION = "0.22.0";
@@ -64,6 +64,7 @@ const strictSemver =
64
64
 
65
65
  const releasedPlatforms = {
66
66
  "darwin-arm64": "macos-arm64",
67
+ "darwin-x64": "macos-x64",
67
68
  "linux-arm64": "linux-arm64",
68
69
  "linux-x64": "linux-x64",
69
70
  "win32-x64": "windows-x64",
@@ -76,12 +77,14 @@ function normalizeHutchChannel(value) {
76
77
  return null;
77
78
  }
78
79
 
79
- function hutchChannel(environment) {
80
+ function hutchChannel(environment, pairedVersion = PAIRED_HUTCH_VERSION) {
80
81
  for (const key of ["ELECTROBUN_HUTCH_CHANNEL", "HUTCH_ACTIVE_CHANNEL"]) {
81
82
  const selected = normalizeHutchChannel(environment[key]);
82
83
  if (selected) return selected;
83
84
  }
84
- return "production";
85
+ const paired = parseVersion(pairedVersion);
86
+ if (!paired) throw new Error("paired Hutch version must be an exact SemVer");
87
+ return paired.prerelease === null ? "production" : "canary";
85
88
  }
86
89
 
87
90
  function environmentFlagEnabled(environment, name) {
@@ -245,19 +248,22 @@ function checkedSpawn(command, args, options) {
245
248
  }
246
249
  }
247
250
 
248
- async function installHutch({ channel, environment, platform }) {
251
+ async function installHutch(
252
+ { channel, environment, platform },
253
+ { downloadInstaller = download, execute = checkedSpawn } = {},
254
+ ) {
249
255
  const temporary = mkdtempSync(path.join(tmpdir(), "electrobun-hutch-installer-"));
250
256
  try {
251
257
  if (platform === "win32") {
252
258
  const installer = path.join(temporary, "install.ps1");
253
259
  writeFileSync(
254
260
  installer,
255
- await download(`${defaultInstallerBaseUrl}/install.ps1`, {
261
+ await downloadInstaller(`${defaultInstallerBaseUrl}/install.ps1`, {
256
262
  label: "Hutch installer",
257
263
  maxBytes: maxInstallerBytes,
258
264
  }),
259
265
  );
260
- checkedSpawn(
266
+ execute(
261
267
  "powershell.exe",
262
268
  [
263
269
  "-NoProfile",
@@ -268,6 +274,8 @@ async function installHutch({ channel, environment, platform }) {
268
274
  installer,
269
275
  "-Channel",
270
276
  channel,
277
+ "-Version",
278
+ PAIRED_HUTCH_VERSION,
271
279
  ],
272
280
  { env: environment, stdio: "inherit" },
273
281
  );
@@ -275,13 +283,13 @@ async function installHutch({ channel, environment, platform }) {
275
283
  const installer = path.join(temporary, "install.sh");
276
284
  writeFileSync(
277
285
  installer,
278
- await download(`${defaultInstallerBaseUrl}/install.sh`, {
286
+ await downloadInstaller(`${defaultInstallerBaseUrl}/install.sh`, {
279
287
  label: "Hutch installer",
280
288
  maxBytes: maxInstallerBytes,
281
289
  }),
282
290
  { mode: 0o700 },
283
291
  );
284
- checkedSpawn("sh", [installer, "--channel", channel], {
292
+ execute("sh", [installer, "--channel", channel, "--version", PAIRED_HUTCH_VERSION], {
285
293
  env: environment,
286
294
  stdio: "inherit",
287
295
  });
@@ -1242,7 +1250,7 @@ async function ensureCompatibleGlobal(options) {
1242
1250
  );
1243
1251
  }
1244
1252
  console.error(
1245
- `Electrobun projects use Hutch; installing the latest ${channel} release...`,
1253
+ `Electrobun projects use Hutch; installing paired Hutch ${PAIRED_HUTCH_VERSION} (${channel})...`,
1246
1254
  );
1247
1255
  await options.install({
1248
1256
  channel,
@@ -1390,6 +1398,7 @@ module.exports = {
1390
1398
  hutchChannel,
1391
1399
  hutchBinaryVersion,
1392
1400
  hutchPlatformKey,
1401
+ installHutch,
1393
1402
  installDownloadedArchive,
1394
1403
  resolveHutchBinary,
1395
1404
  runHutch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrobun",
3
- "version": "2.0.4",
3
+ "version": "2.0.5-beta.2",
4
4
  "description": "The lightweight npm bootstrap for Electrobun and Hutch.",
5
5
  "license": "MIT",
6
6
  "author": "Blackboard Technologies Inc.",