@chahuadev/framework 1.0.10
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 +67 -0
- package/index.js +26 -0
- package/package.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @chahuadev/framework
|
|
2
|
+
|
|
3
|
+
The official core executable framework for Chahuadev.
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://github.com/saharuthc-art/chahuadev-framework/blob/39932ffc5482af35968c1d217d0c07613e13e6fc/chahuadev.png" width="600" alt="Chahuadev Framework">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
This package provides a seamless way to integrate and run the Chahuadev Framework directly from your Node.js environment or Command Line Interface (CLI).
|
|
10
|
+
|
|
11
|
+
> **Note:** Currently, this framework is optimized exclusively for **Windows (x64)** architecture.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
You only need to install this main package. Our system uses `optionalDependencies` to automatically detect your operating system and securely download the required Windows binary (`.exe`) behind the scenes.
|
|
18
|
+
|
|
19
|
+
### Global Install (Recommended for CLI)
|
|
20
|
+
If you want to use the framework directly from your terminal anywhere on your system:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @chahuadev/framework
|
|
24
|
+
```
|
|
25
|
+
### Local Install (For Node.js projects)
|
|
26
|
+
If you want to integrate the framework into your specific project:
|
|
27
|
+
|
|
28
|
+
Bash
|
|
29
|
+
```bash
|
|
30
|
+
npm install @chahuadev/framework
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 💻 Usage
|
|
34
|
+
You can use the Chahuadev Framework either via Command Line or programmatically in your Node.js code.
|
|
35
|
+
|
|
36
|
+
### 1. Command Line Interface (CLI)
|
|
37
|
+
If installed globally, you can launch the application by simply typing:
|
|
38
|
+
|
|
39
|
+
Bash
|
|
40
|
+
chahuadev-framework
|
|
41
|
+
(You can also pass arguments directly, e.g., chahuadev-framework --start)
|
|
42
|
+
|
|
43
|
+
### 2. Node.js API
|
|
44
|
+
If installed locally in your project, you can require and run it via code:
|
|
45
|
+
|
|
46
|
+
```JavaScript
|
|
47
|
+
const chf = require('@chahuadev/framework');
|
|
48
|
+
|
|
49
|
+
// Launch the application
|
|
50
|
+
chf.run();
|
|
51
|
+
|
|
52
|
+
// Or if you just need the absolute path to the .exe file
|
|
53
|
+
const exePath = chf.getPath();
|
|
54
|
+
console.log('Executable is located at:', exePath);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Platform Support
|
|
58
|
+
OS: Windows (win32)
|
|
59
|
+
|
|
60
|
+
Architecture: 64-bit (x64) only
|
|
61
|
+
|
|
62
|
+
If you attempt to install or run this on Mac or Linux, it will safely exit and notify you of the platform requirement.
|
|
63
|
+
|
|
64
|
+
### License
|
|
65
|
+
Proprietary - Chahua Development Thailand
|
|
66
|
+
#
|
|
67
|
+
|
package/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
// เช็คว่าใช่ Windows x64 หรือไม่
|
|
7
|
+
if (os.platform() !== 'win32' || os.arch() !== 'x64') {
|
|
8
|
+
console.error('Error: Chahuadev Framework currently only supports Windows x64.');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
// หา Path ของไฟล์ .exe จากแพ็กเกจย่อยที่เราตั้งไว้ใน optionalDependencies
|
|
14
|
+
const exePath = path.join(
|
|
15
|
+
require.resolve('@chahuadev/framework-win32-x64/package.json'),
|
|
16
|
+
'../bin/chahuadev-framework.exe'
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// รันไฟล์ .exe และส่งต่อคำสั่งต่างๆ (arguments) ไปให้แอปของคุณ
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
spawnSync(exePath, args, { stdio: 'inherit' });
|
|
22
|
+
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error('Failed to start Chahuadev Framework:', error.message);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chahuadev/framework",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "Chahuadev Framework",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"chahuadev-framework": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"optionalDependencies": {
|
|
10
|
+
"@chahuadev/framework-win32-x64": "^1.0.0"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
}
|
|
15
|
+
}
|