@almadar/cli 0.3.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/README.md +45 -0
- package/bin/almadar +64 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @almadar/cli
|
|
2
|
+
|
|
3
|
+
Almadar CLI - Compile Almadar schemas to full-stack applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @almadar/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Validate a schema
|
|
15
|
+
almadar validate schema.orb
|
|
16
|
+
|
|
17
|
+
# Compile to TypeScript (React + Express)
|
|
18
|
+
almadar compile schema.orb --shell typescript
|
|
19
|
+
|
|
20
|
+
# Compile to Python (FastAPI + PyTorch)
|
|
21
|
+
almadar compile schema.orb --shell python
|
|
22
|
+
|
|
23
|
+
# Start development server
|
|
24
|
+
almadar dev schema.orb
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
| Command | Description |
|
|
30
|
+
|---------|-------------|
|
|
31
|
+
| `almadar validate <file>` | Validate an Almadar schema |
|
|
32
|
+
| `almadar parse <file>` | Parse and display schema information |
|
|
33
|
+
| `almadar compile <file>` | Compile schema to generated code |
|
|
34
|
+
| `almadar serve <file>` | Start the Almadar server runtime |
|
|
35
|
+
| `almadar gui <file>` | Start the Almadar desktop GUI |
|
|
36
|
+
| `almadar dev <file>` | Start both server and client (dev mode) |
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
- [Getting Started](https://almadar.io/docs/en/getting-started)
|
|
41
|
+
- [CLI Reference](https://almadar.io/docs/en/reference/cli)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/bin/almadar
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const BINARY_NAME = process.platform === 'win32' ? 'almadar.exe' : 'almadar';
|
|
8
|
+
|
|
9
|
+
function getBinaryPath() {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
const arch = process.arch;
|
|
12
|
+
|
|
13
|
+
// Map Node.js platform/arch to package names
|
|
14
|
+
const platformMap = {
|
|
15
|
+
'darwin-x64': '@almadar/cli-darwin-x64',
|
|
16
|
+
'darwin-arm64': '@almadar/cli-darwin-arm64',
|
|
17
|
+
'linux-x64': '@almadar/cli-linux-x64',
|
|
18
|
+
'linux-arm64': '@almadar/cli-linux-arm64',
|
|
19
|
+
'win32-x64': '@almadar/cli-win32-x64',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const key = `${platform}-${arch}`;
|
|
23
|
+
const packageName = platformMap[key];
|
|
24
|
+
|
|
25
|
+
if (!packageName) {
|
|
26
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
27
|
+
console.error('Supported platforms: darwin-x64, darwin-arm64, linux-x64, linux-arm64, win32-x64');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Try to find the binary in node_modules
|
|
32
|
+
const possiblePaths = [
|
|
33
|
+
// Installed as dependency
|
|
34
|
+
path.join(__dirname, '..', 'node_modules', packageName, BINARY_NAME),
|
|
35
|
+
// Hoisted to parent node_modules
|
|
36
|
+
path.join(__dirname, '..', '..', packageName, BINARY_NAME),
|
|
37
|
+
// Global install
|
|
38
|
+
path.join(__dirname, '..', '..', '..', packageName, BINARY_NAME),
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
for (const binaryPath of possiblePaths) {
|
|
42
|
+
if (fs.existsSync(binaryPath)) {
|
|
43
|
+
return binaryPath;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.error(`Could not find Almadar binary for ${platform}-${arch}`);
|
|
48
|
+
console.error('Please try reinstalling: npm install -g @almadar/cli');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const binaryPath = getBinaryPath();
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
execFileSync(binaryPath, process.argv.slice(2), {
|
|
56
|
+
stdio: 'inherit',
|
|
57
|
+
env: process.env,
|
|
58
|
+
});
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error.status !== undefined) {
|
|
61
|
+
process.exit(error.status);
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@almadar/cli",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Almadar CLI - Compile Almadar schemas to full-stack applications",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/almadar-io/almadar.git",
|
|
9
|
+
"directory": "cli/npm"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://almadar.io",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/almadar-io/almadar/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"almadar",
|
|
17
|
+
"orbital",
|
|
18
|
+
"cli",
|
|
19
|
+
"compiler",
|
|
20
|
+
"codegen",
|
|
21
|
+
"full-stack",
|
|
22
|
+
"react",
|
|
23
|
+
"typescript",
|
|
24
|
+
"python",
|
|
25
|
+
"fastapi"
|
|
26
|
+
],
|
|
27
|
+
"bin": {
|
|
28
|
+
"almadar": "bin/almadar"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"bin",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"postinstall": "node scripts/postinstall.js"
|
|
36
|
+
},
|
|
37
|
+
"os": [
|
|
38
|
+
"darwin",
|
|
39
|
+
"linux",
|
|
40
|
+
"win32"
|
|
41
|
+
],
|
|
42
|
+
"cpu": [
|
|
43
|
+
"x64",
|
|
44
|
+
"arm64"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=16.0.0"
|
|
48
|
+
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"@almadar/cli-darwin-x64": "0.3.0",
|
|
51
|
+
"@almadar/cli-darwin-arm64": "0.3.0",
|
|
52
|
+
"@almadar/cli-linux-x64": "0.3.0",
|
|
53
|
+
"@almadar/cli-linux-arm64": "0.3.0",
|
|
54
|
+
"@almadar/cli-win32-x64": "0.3.0"
|
|
55
|
+
}
|
|
56
|
+
}
|