@codella-software/cli 2.2.3 → 2.2.5
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/cli.js +27 -42
- package/bin/codella +0 -0
- package/package.json +2 -2
package/bin/cli.js
CHANGED
|
@@ -1,50 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// Wrapper script to run the Go CLI binary
|
|
4
|
-
// In production, this would download and execute the appropriate binary for the platform
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import os from 'os';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
'darwin': {
|
|
13
|
-
'x64': 'codella-darwin-x64',
|
|
14
|
-
'arm64': 'codella-darwin-arm64'
|
|
15
|
-
},
|
|
16
|
-
'linux': {
|
|
17
|
-
'x64': 'codella-linux-x64',
|
|
18
|
-
'arm64': 'codella-linux-arm64'
|
|
19
|
-
},
|
|
20
|
-
'win32': {
|
|
21
|
-
'x64': 'codella-win32-x64.exe'
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const platform = os.platform();
|
|
26
|
-
const arch = os.arch() === 'x64' ? 'x64' : os.arch();
|
|
10
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const binaryPath = path.join(__dirname, 'codella');
|
|
27
12
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
13
|
+
// Spawn the Go CLI binary with all arguments passed through
|
|
14
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
15
|
+
stdio: 'inherit',
|
|
16
|
+
shell: false
|
|
17
|
+
});
|
|
33
18
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
│ │
|
|
39
|
-
│ Codella CLI v2.0.0 │
|
|
40
|
-
│ │
|
|
41
|
-
│ The Go CLI binary is not yet built for your platform. │
|
|
42
|
-
│ Please compile the CLI from source: │
|
|
43
|
-
│ │
|
|
44
|
-
│ cd packages/cli │
|
|
45
|
-
│ go build -o ../cli-npm/bin/codella ./cmd/codella │
|
|
46
|
-
│ │
|
|
47
|
-
└─────────────────────────────────────────────────────────────┘
|
|
48
|
-
`);
|
|
19
|
+
// Pass through exit code
|
|
20
|
+
child.on('exit', (code) => {
|
|
21
|
+
process.exit(code || 0);
|
|
22
|
+
});
|
|
49
23
|
|
|
50
|
-
|
|
24
|
+
// Handle errors
|
|
25
|
+
child.on('error', (error) => {
|
|
26
|
+
if (error.code === 'ENOENT') {
|
|
27
|
+
console.error('Error: Codella CLI binary not found');
|
|
28
|
+
console.error(`Expected at: ${binaryPath}`);
|
|
29
|
+
console.error('\nPlease rebuild the CLI:');
|
|
30
|
+
console.error(' npm run build -w packages/cli-npm');
|
|
31
|
+
} else {
|
|
32
|
+
console.error('Error running Codella CLI:', error.message);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
});
|
package/bin/codella
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codella-software/cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "CLI for scaffolding Codella components into React projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "
|
|
28
|
+
"build": "bash scripts/build.sh",
|
|
29
29
|
"postinstall": "node scripts/postinstall.js",
|
|
30
30
|
"test": "echo 'CLI package: no tests to run'",
|
|
31
31
|
"test:run": "echo 'CLI package: no tests to run'",
|