@codella-software/cli 2.2.4 → 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.
Files changed (3) hide show
  1. package/bin/cli.js +27 -42
  2. package/bin/codella +0 -0
  3. 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
- const { spawn } = require('child_process');
7
- const path = require('path');
8
- const os = require('os');
5
+ import { spawn } from 'child_process';
6
+ import path from 'path';
7
+ import os from 'os';
8
+ import { fileURLToPath } from 'url';
9
9
 
10
- // Map Node.js platform/arch to Go binary naming
11
- const platformMap = {
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
- const binaryName = platformMap[platform]?.[arch];
29
- if (!binaryName) {
30
- console.error(`Unsupported platform: ${platform} ${arch}`);
31
- process.exit(1);
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
- // For now, just show a message since Go binary isn't built yet
35
- // In production, this would execute: path.join(__dirname, '..', 'bin', binaryName)
36
- console.error(`
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
- process.exit(1);
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.4",
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": "cd ../cli && go build -o ../cli-npm/bin/codella ./cmd/codella && chmod +x ../cli-npm/bin/codella",
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'",