@arcteninc/core 0.0.25 → 0.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcteninc/core",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Wrapper script to run the TypeScript CLI with bun
4
- * Works with both npm and bun
3
+ * Wrapper script to run the TypeScript CLI
4
+ * Works with Node.js - no bun required!
5
5
  */
6
6
 
7
7
  import { spawn } from 'child_process';
8
8
  import { fileURLToPath } from 'url';
9
- import { dirname, join, resolve } from 'path';
9
+ import { dirname, resolve } from 'path';
10
10
  import { existsSync } from 'fs';
11
11
 
12
12
  const __filename = fileURLToPath(import.meta.url);
@@ -15,53 +15,78 @@ const __dirname = dirname(__filename);
15
15
  // Path to the TypeScript script - resolve relative to this wrapper
16
16
  const tsScript = resolve(__dirname, 'cli-extract-types-auto.ts');
17
17
 
18
- // Check if bun is available
19
- function checkBun() {
18
+ // Check if a command is available
19
+ function checkCommand(cmd) {
20
20
  return new Promise((resolve) => {
21
- const bunCheck = spawn('bun', ['--version'], { stdio: 'ignore' });
22
- bunCheck.on('close', (code) => {
21
+ const check = spawn(cmd, ['--version'], { stdio: 'ignore', shell: true });
22
+ check.on('close', (code) => {
23
23
  resolve(code === 0);
24
24
  });
25
- bunCheck.on('error', () => {
25
+ check.on('error', () => {
26
26
  resolve(false);
27
27
  });
28
28
  });
29
29
  }
30
30
 
31
31
  async function main() {
32
- const hasBun = await checkBun();
33
-
34
- if (!hasBun) {
35
- console.error('❌ Error: bun is required to run arcten-extract-types');
36
- console.error('');
37
- console.error('Please install bun:');
38
- console.error(' curl -fsSL https://bun.sh/install | bash');
39
- console.error('');
40
- console.error('Or use bunx instead of npx:');
41
- console.error(' bunx arcten-extract-types .');
42
- process.exit(1);
43
- }
44
-
45
32
  if (!existsSync(tsScript)) {
46
33
  console.error(`❌ Error: Script not found at ${tsScript}`);
47
34
  process.exit(1);
48
35
  }
49
36
 
50
- // Run the TypeScript script with bun
51
37
  const args = process.argv.slice(2);
52
- const bunProcess = spawn('bun', [tsScript, ...args], {
53
- stdio: 'inherit',
54
- shell: true
55
- });
38
+
39
+ // Try tsx first (lightweight TypeScript runner for Node.js)
40
+ // Use npx to run it without requiring installation
41
+ const hasTsx = await checkCommand('npx');
42
+
43
+ if (hasTsx) {
44
+ // Use tsx via npx - it's lightweight and works great with Node.js
45
+ const tsxProcess = spawn('npx', ['-y', 'tsx', tsScript, ...args], {
46
+ stdio: 'inherit',
47
+ shell: true
48
+ });
56
49
 
57
- bunProcess.on('close', (code) => {
58
- process.exit(code || 0);
59
- });
50
+ tsxProcess.on('close', (code) => {
51
+ process.exit(code || 0);
52
+ });
60
53
 
61
- bunProcess.on('error', (err) => {
62
- console.error('❌ Error running script:', err.message);
54
+ tsxProcess.on('error', (err) => {
55
+ // If tsx fails, try bun as fallback
56
+ tryBunFallback(args);
57
+ });
58
+ } else {
59
+ // Fallback to bun if npx isn't available
60
+ tryBunFallback(args);
61
+ }
62
+ }
63
+
64
+ async function tryBunFallback(args) {
65
+ const hasBun = await checkCommand('bun');
66
+
67
+ if (hasBun) {
68
+ const bunProcess = spawn('bun', [tsScript, ...args], {
69
+ stdio: 'inherit',
70
+ shell: true
71
+ });
72
+
73
+ bunProcess.on('close', (code) => {
74
+ process.exit(code || 0);
75
+ });
76
+
77
+ bunProcess.on('error', (err) => {
78
+ console.error('❌ Error: Could not run script');
79
+ console.error('Please ensure you have Node.js (with npx) or bun installed');
80
+ process.exit(1);
81
+ });
82
+ } else {
83
+ console.error('❌ Error: Could not find a TypeScript runner');
84
+ console.error('');
85
+ console.error('Please install one of the following:');
86
+ console.error(' - Node.js (comes with npx) - recommended');
87
+ console.error(' - bun: curl -fsSL https://bun.sh/install | bash');
63
88
  process.exit(1);
64
- });
89
+ }
65
90
  }
66
91
 
67
92
  main();