@arcteninc/core 0.0.64 → 0.0.66

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.64",
3
+ "version": "0.0.66",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -26,6 +26,7 @@
26
26
  "files": [
27
27
  "dist",
28
28
  "scripts/cli-extract-types-auto.ts",
29
+ "scripts/cli-extract-types-auto-wrapper.cjs",
29
30
  "scripts/cli-extract-types-auto-wrapper.js",
30
31
  "scripts/arcten-cli.cjs"
31
32
  ],
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Wrapper script that checks for bun first, then tsx, then falls back to node with tsx
4
+ * This ensures compatibility across different environments
5
+ */
6
+
7
+ const { spawn } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ const scriptPath = path.join(__dirname, 'cli-extract-types-auto.ts');
12
+ const args = process.argv.slice(2);
13
+
14
+ // Check if a command is available
15
+ function checkCommand(command) {
16
+ return new Promise((resolve) => {
17
+ const check = spawn(command, ['--version'], {
18
+ stdio: 'ignore',
19
+ shell: true
20
+ });
21
+
22
+ check.on('error', () => resolve(false));
23
+ check.on('close', (code) => resolve(code === 0));
24
+ });
25
+ }
26
+
27
+ // Check if tsx is available in node_modules
28
+ function findTsxInNodeModules() {
29
+ let currentDir = __dirname;
30
+ while (currentDir !== path.dirname(currentDir)) {
31
+ const tsxPath = path.join(currentDir, 'node_modules', '.bin', 'tsx');
32
+ if (fs.existsSync(tsxPath)) {
33
+ return tsxPath;
34
+ }
35
+ currentDir = path.dirname(currentDir);
36
+ }
37
+ return null;
38
+ }
39
+
40
+ async function run() {
41
+ // Try bun first (faster, native TypeScript support)
42
+ if (await checkCommand('bun')) {
43
+ const proc = spawn('bun', [scriptPath, ...args], {
44
+ stdio: 'inherit',
45
+ shell: true
46
+ });
47
+ proc.on('error', (err) => {
48
+ console.error('Error running with bun:', err.message);
49
+ process.exit(1);
50
+ });
51
+ proc.on('exit', (code) => {
52
+ process.exit(code || 0);
53
+ });
54
+ return;
55
+ }
56
+
57
+ // Try tsx from node_modules first (if installed as dependency)
58
+ const tsxPath = findTsxInNodeModules();
59
+ if (tsxPath) {
60
+ const proc = spawn(tsxPath, [scriptPath, ...args], {
61
+ stdio: 'inherit',
62
+ shell: true
63
+ });
64
+ proc.on('error', (err) => {
65
+ console.error('Error running with tsx:', err.message);
66
+ process.exit(1);
67
+ });
68
+ proc.on('exit', (code) => {
69
+ process.exit(code || 0);
70
+ });
71
+ return;
72
+ }
73
+
74
+ // Try global tsx
75
+ if (await checkCommand('tsx')) {
76
+ const proc = spawn('tsx', [scriptPath, ...args], {
77
+ stdio: 'inherit',
78
+ shell: true
79
+ });
80
+ proc.on('error', (err) => {
81
+ console.error('Error running with tsx:', err.message);
82
+ process.exit(1);
83
+ });
84
+ proc.on('exit', (code) => {
85
+ process.exit(code || 0);
86
+ });
87
+ return;
88
+ }
89
+
90
+ // Try npx tsx as last resort (will download tsx if needed)
91
+ const proc = spawn('npx', ['--yes', 'tsx', scriptPath, ...args], {
92
+ stdio: 'inherit',
93
+ shell: true
94
+ });
95
+ proc.on('error', (err) => {
96
+ console.error('Error running with npx tsx:', err.message);
97
+ console.error('\nPlease install one of the following:');
98
+ console.error(' - bun: https://bun.sh');
99
+ console.error(' - tsx: npm install -g tsx (or it will be installed via npx)');
100
+ process.exit(1);
101
+ });
102
+ proc.on('exit', (code) => {
103
+ process.exit(code || 0);
104
+ });
105
+ }
106
+
107
+ run();
108
+
@@ -1,108 +1,25 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Wrapper script that checks for bun first, then tsx, then falls back to node with tsx
4
- * This ensures compatibility across different environments
5
- */
6
-
7
- const { spawn } = require('child_process');
8
- const path = require('path');
9
- const fs = require('fs');
10
-
11
- const scriptPath = path.join(__dirname, 'cli-extract-types-auto.ts');
12
- const args = process.argv.slice(2);
13
-
14
- // Check if a command is available
15
- function checkCommand(command) {
16
- return new Promise((resolve) => {
17
- const check = spawn(command, ['--version'], {
18
- stdio: 'ignore',
19
- shell: true
20
- });
21
-
22
- check.on('error', () => resolve(false));
23
- check.on('close', (code) => resolve(code === 0));
24
- });
25
- }
26
-
27
- // Check if tsx is available in node_modules
28
- function findTsxInNodeModules() {
29
- let currentDir = __dirname;
30
- while (currentDir !== path.dirname(currentDir)) {
31
- const tsxPath = path.join(currentDir, 'node_modules', '.bin', 'tsx');
32
- if (fs.existsSync(tsxPath)) {
33
- return tsxPath;
34
- }
35
- currentDir = path.dirname(currentDir);
36
- }
37
- return null;
38
- }
39
-
40
- async function run() {
41
- // Try bun first (faster, native TypeScript support)
42
- if (await checkCommand('bun')) {
43
- const proc = spawn('bun', [scriptPath, ...args], {
44
- stdio: 'inherit',
45
- shell: true
46
- });
47
- proc.on('error', (err) => {
48
- console.error('Error running with bun:', err.message);
49
- process.exit(1);
50
- });
51
- proc.on('exit', (code) => {
52
- process.exit(code || 0);
53
- });
54
- return;
55
- }
56
-
57
- // Try tsx from node_modules first (if installed as dependency)
58
- const tsxPath = findTsxInNodeModules();
59
- if (tsxPath) {
60
- const proc = spawn(tsxPath, [scriptPath, ...args], {
61
- stdio: 'inherit',
62
- shell: true
63
- });
64
- proc.on('error', (err) => {
65
- console.error('Error running with tsx:', err.message);
66
- process.exit(1);
67
- });
68
- proc.on('exit', (code) => {
69
- process.exit(code || 0);
70
- });
71
- return;
72
- }
73
-
74
- // Try global tsx
75
- if (await checkCommand('tsx')) {
76
- const proc = spawn('tsx', [scriptPath, ...args], {
77
- stdio: 'inherit',
78
- shell: true
79
- });
80
- proc.on('error', (err) => {
81
- console.error('Error running with tsx:', err.message);
82
- process.exit(1);
83
- });
84
- proc.on('exit', (code) => {
85
- process.exit(code || 0);
86
- });
87
- return;
88
- }
89
-
90
- // Try npx tsx as last resort (will download tsx if needed)
91
- const proc = spawn('npx', ['--yes', 'tsx', scriptPath, ...args], {
92
- stdio: 'inherit',
93
- shell: true
94
- });
95
- proc.on('error', (err) => {
96
- console.error('Error running with npx tsx:', err.message);
97
- console.error('\nPlease install one of the following:');
98
- console.error(' - bun: https://bun.sh');
99
- console.error(' - tsx: npm install -g tsx (or it will be installed via npx)');
100
- process.exit(1);
101
- });
102
- proc.on('exit', (code) => {
103
- process.exit(code || 0);
104
- });
105
- }
106
-
107
- run();
108
-
1
+ #!/usr/bin/env node
2
+ /**
3
+ * JavaScript wrapper for the CommonJS wrapper script
4
+ * This file exists to ensure binary resolution works correctly
5
+ * when package managers look for .js files
6
+ *
7
+ * Works in both Bun and Node.js environments, even when package.json has "type": "module"
8
+ */
9
+
10
+ import { createRequire } from 'module';
11
+ import { fileURLToPath } from 'url';
12
+ import { dirname, join } from 'path';
13
+
14
+ // Get __dirname equivalent for ES modules
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+
18
+ // Create require function that works in ES module context
19
+ const require = createRequire(import.meta.url);
20
+
21
+ // Load and execute the CommonJS wrapper
22
+ // This works in both Node.js (v12+) and Bun
23
+ const wrapperPath = join(__dirname, 'cli-extract-types-auto-wrapper.cjs');
24
+ require(wrapperPath);
25
+