@willbooster/wbfy 19.3.2 → 20.1.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/bin/wbfy.js CHANGED
@@ -1,50 +1,3 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- import child_process from 'node:child_process';
4
- import fs from 'node:fs';
5
-
6
- const { minimumBunVersion } = JSON.parse(
7
- fs.readFileSync(new URL('../configs/runtime.json', import.meta.url), 'utf8')
8
- );
9
- const bootstrapMarker = 'WBFY_BUN_BOOTSTRAPPED';
10
- const autoInstallMarker = 'WBFY_MISE_EXEC_AUTO_INSTALL';
11
- const originalAutoInstall = process.env[autoInstallMarker];
12
- if (originalAutoInstall !== undefined) {
13
- if (originalAutoInstall) process.env.MISE_EXEC_AUTO_INSTALL = originalAutoInstall;
14
- else delete process.env.MISE_EXEC_AUTO_INSTALL;
15
- delete process.env[autoInstallMarker];
16
- }
17
-
18
- if (Bun.semver.order(Bun.version, minimumBunVersion) < 0) {
19
- const bootstrapStage = process.env[bootstrapMarker];
20
- if (bootstrapStage === 'minimum') {
21
- console.error(`mise did not provide Bun ${minimumBunVersion} (still running ${Bun.version}).`);
22
- process.exit(1);
23
- }
24
- // Prefer a supported target pin so every descendant Bun command uses that same version. A target
25
- // still on the previous runtime needs one fallback to the new floor so wbfy can migrate its pin.
26
- // With auto-install disabled, mise can fall back to the old Bun on PATH; the stages bound that
27
- // re-entry to one target attempt and one explicit-minimum attempt.
28
- const useMinimum = bootstrapStage === 'target';
29
- const env = { ...process.env, [bootstrapMarker]: useMinimum ? 'minimum' : 'target' };
30
- if (!useMinimum) {
31
- env[autoInstallMarker] = process.env.MISE_EXEC_AUTO_INSTALL ?? '';
32
- env.MISE_EXEC_AUTO_INSTALL = 'false';
33
- }
34
- const result = child_process.spawnSync(
35
- 'mise',
36
- [
37
- 'exec',
38
- ...(useMinimum ? [`bun@${minimumBunVersion}`] : []),
39
- '--',
40
- 'bun',
41
- process.argv[1],
42
- ...process.argv.slice(2),
43
- ],
44
- { env, stdio: 'inherit' }
45
- );
46
- if (result.error) console.error(`Failed to start Bun ${minimumBunVersion} through mise: ${result.error.message}`);
47
- process.exit(result.status ?? 1);
48
- }
49
-
50
- await import('../dist/index.js');
3
+ import '../dist/index.js';