gingee-cli 1.0.3 → 1.0.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/README.md +165 -8
- package/commands/init.js +4 -3
- package/commands/resetGlade.js +2 -1
- package/package.json +1 -2
- package/templates/glade.gin +0 -0
- package/templates/project/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,58 @@
|
|
|
1
1
|
# Gingee CLI: Command Reference
|
|
2
2
|
|
|
3
|
-
The `gingee-cli` is the official, all-in-one command-line interface for the
|
|
3
|
+
The `gingee-cli` is the official, all-in-one command-line interface for the Gingee platform. It is a powerful tool for both developers and system administrators, designed to streamline every phase of the application lifecycle, from initial project creation to ongoing production management.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
The `gingee-cli` is designed to be installed globally on your machine, making it available everywhere.
|
|
8
|
+
NOTE: You might need to install pre-requistes based on your setup.
|
|
8
9
|
|
|
9
10
|
```bash
|
|
10
11
|
npm install -g gingee-cli
|
|
11
12
|
```
|
|
12
13
|
After installation, you will have access to the `gingee-cli` command in your terminal.
|
|
13
14
|
|
|
15
|
+
## Verifying the Installation
|
|
16
|
+
|
|
17
|
+
After the installation is complete, you can verify that it was successful by running the version command:
|
|
18
|
+
```bash
|
|
19
|
+
gingee-cli --version
|
|
20
|
+
```
|
|
21
|
+
This should print the installed version number of the CLI.
|
|
22
|
+
|
|
23
|
+
## Platform Specific Requirements
|
|
24
|
+
|
|
25
|
+
### **Windows**
|
|
26
|
+
For most Windows users, no additional setup is required. The standard Node.js installer from [nodejs.org](https://nodejs.org/) includes everything you need.
|
|
27
|
+
|
|
28
|
+
For advanced users or those who encounter issues, it's recommended to install the Node.js build tools by running the following command in an **Administrator PowerShell**:
|
|
29
|
+
|
|
30
|
+
```code
|
|
31
|
+
npm install --global windows-build-tools
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### **macOS**
|
|
35
|
+
macOS users need the **Xcode Command Line Tools**. Most developer-focused setups will already have this. You can install them by running:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
xcode-select --install
|
|
39
|
+
```
|
|
40
|
+
If you already have them, this command will report an error, which you can safely ignore.
|
|
41
|
+
|
|
42
|
+
### **Linux (Debian/Ubuntu)**
|
|
43
|
+
Linux systems require a C++ compiler toolchain to build some of the CLI's dependencies. You can install the necessary packages by running:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sudo apt-get update && sudo apt-get install -y build-essential python
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### **Linux (RHEL/Fedora/CentOS)**
|
|
50
|
+
For Red Hat-based distributions, you can install the necessary build tools with:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
sudo yum groupinstall "Development Tools" && sudo yum install python3
|
|
54
|
+
```
|
|
55
|
+
|
|
14
56
|
---
|
|
15
57
|
|
|
16
58
|
## Commands
|
|
@@ -25,7 +67,7 @@ Scaffolds a complete, new Gingee project in a new directory. It launches an inte
|
|
|
25
67
|
|
|
26
68
|
**Usage:**
|
|
27
69
|
```bash
|
|
28
|
-
gingee-cli init my-awesome-project
|
|
70
|
+
gingee-cli init my-awesome-project
|
|
29
71
|
```
|
|
30
72
|
|
|
31
73
|
**Wizard Prompts:**
|
|
@@ -50,6 +92,8 @@ gingee-cli add-app my-blog
|
|
|
50
92
|
|
|
51
93
|
**Wizard Prompts:**
|
|
52
94
|
- `What type of app is this?` Choose between `MPA` (Multi-Page App, default) or `SPA` (Single Page Application, for React/Vue/Angular).
|
|
95
|
+
- If `MPA` is chosen, it scaffolds a complete "hello world" application with HTML, CSS, and JS.
|
|
96
|
+
- If `SPA` is chosen, it scaffolds a minimal backend structure (`box/`, `app.json`) and provides clear instructions for you to initialize your chosen frontend framework inside the app's directory.
|
|
53
97
|
- `Would you like to configure a database connection?` If yes, it will guide you through setting up the `db` block in the new app's `app.json`.
|
|
54
98
|
- `Generate a JWT secret for this app?` If yes, it will automatically generate a secure secret and add it to `app.json`.
|
|
55
99
|
|
|
@@ -81,10 +125,11 @@ gingee-cli login
|
|
|
81
125
|
|
|
82
126
|
- Login to a remote server
|
|
83
127
|
```bash
|
|
84
|
-
gingee-cli login
|
|
128
|
+
gingee-cli login -s http://remote-gingee:7070
|
|
85
129
|
```
|
|
86
130
|
|
|
87
131
|
**Options:**
|
|
132
|
+
- `-s, --serverUrl <server-url>`: The target Gingee server URL. Defaults to `http://localhost:7070`.
|
|
88
133
|
- `-u, --username <username>`: Provide the username non-interactively. Defaults to `admin`.
|
|
89
134
|
- `-p, --password <password>`: Provide the password non-interactively. If this option is omitted, you will be securely prompted to enter a password.
|
|
90
135
|
|
|
@@ -94,20 +139,78 @@ Logs out of a specific Glade session by deleting the stored credentials.
|
|
|
94
139
|
|
|
95
140
|
**Usage:**
|
|
96
141
|
```bash
|
|
97
|
-
gingee-cli logout
|
|
142
|
+
gingee-cli logout -s http://remote-gingee:7070
|
|
98
143
|
```
|
|
99
144
|
|
|
145
|
+
**Options:**
|
|
146
|
+
- `-s, --serverUrl <server-url>`: The target Gingee server URL. Defaults to `http://localhost:7070`
|
|
147
|
+
|
|
100
148
|
#### `list-apps`
|
|
101
149
|
|
|
102
150
|
Lists all applications installed on the target server.
|
|
103
151
|
|
|
104
152
|
**Usage:**
|
|
105
153
|
```bash
|
|
106
|
-
gingee-cli list-apps
|
|
154
|
+
gingee-cli list-apps -s https://remote-gingee:7070
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Options:**
|
|
158
|
+
- `-s, --server <url>` (Optional): The base URL of the target Gingee server. Defaults to `http://localhost:7070`.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### App Store Commands
|
|
163
|
+
|
|
164
|
+
These commands allow you to discover and install applications from a decentralized "app store," which is simply a server hosting a `store.json` manifest file.
|
|
165
|
+
|
|
166
|
+
#### `list-store-apps`
|
|
167
|
+
|
|
168
|
+
Fetches the manifest from a store URL and displays a list of available applications.
|
|
169
|
+
|
|
170
|
+
**Usage:**
|
|
171
|
+
```bash
|
|
172
|
+
gingee-cli list-store-apps -g https://my-store.example.com
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Options:**
|
|
176
|
+
- `-g, --gStoreUrl <gstore-url>` (Optional): The Gingee App Store url
|
|
177
|
+
|
|
178
|
+
#### `install-store-app <app-name>`
|
|
179
|
+
|
|
180
|
+
Initiates an interactive installation of an application from a store. The CLI will:
|
|
181
|
+
1. Download the app's `.gin` package.
|
|
182
|
+
2. Read the app's required permissions from its internal `pmft.json` manifest.
|
|
183
|
+
3. Prompt you for consent to grant these permissions.
|
|
184
|
+
4. Prompt you to configure any requirements (like database connections).
|
|
185
|
+
5. Repackage the app with your configuration and securely install it on your target Gingee server.
|
|
186
|
+
|
|
187
|
+
**Usage:**
|
|
188
|
+
```bash
|
|
189
|
+
gingee-cli install-store-app my-blog-app -g https://my-store.example.com -s http://<remote-gingee>
|
|
107
190
|
```
|
|
108
191
|
|
|
109
192
|
**Options:**
|
|
110
|
-
- `-
|
|
193
|
+
- `-g, --gStoreUrl <gstore-url>` (Optional): The Gingee App Store url
|
|
194
|
+
- `-s, --server <url>` (Optional): The base URL of the target Gingee server. Defaults to `http://localhost:7070`
|
|
195
|
+
|
|
196
|
+
#### `upgrade-store-app <app-name>`
|
|
197
|
+
|
|
198
|
+
Initiates an interactive installation of an application from a store. The CLI will:
|
|
199
|
+
1. Download the app's `.gin` package.
|
|
200
|
+
2. Read the app's required permissions from its internal `pmft.json` manifest.
|
|
201
|
+
3. Create the new set of permissions that are requested. (auto assigns previous version grants)
|
|
202
|
+
4. Prompt you for consent to grant these permissions.
|
|
203
|
+
5. Prompt you to configure any requirements (like database connections).
|
|
204
|
+
6. Repackage the app with your configuration and securely install it on your target Gingee server.
|
|
205
|
+
|
|
206
|
+
**Usage:**
|
|
207
|
+
```bash
|
|
208
|
+
gingee-cli install-store-app my-blog-app -g https://my-store.example.com -s http://<remote-gingee>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Options:**
|
|
212
|
+
- `-g, --gStoreUrl <gstore-url>` (Optional): The Gingee App Store url
|
|
213
|
+
- `-s, --server <url>` (Optional): The base URL of the target Gingee server. Defaults to `http://localhost:7070`
|
|
111
214
|
|
|
112
215
|
---
|
|
113
216
|
|
|
@@ -126,10 +229,13 @@ These powerful commands allow for remote deployment and management of your appli
|
|
|
126
229
|
- `-s, --server <url>` (Optional): The URL of the target server. Defaults to the last-logged-in server.
|
|
127
230
|
- `-a, --appName <app-name>` (Required): The name of the target application.
|
|
128
231
|
- `-p, --ginPath <path>` (Required for install/upgrade): The path to the local `.gin` package file.
|
|
232
|
+
- `-f, --file <path>` (Automation): Provide a preset file for non-interactive execution.
|
|
129
233
|
|
|
130
|
-
**Example Usage
|
|
234
|
+
**Example Usage:**
|
|
235
|
+
```bash
|
|
131
236
|
# Upgrade the 'my-blog' app on a production server
|
|
132
|
-
gingee-cli upgrade-app --appName my-blog --ginPath ./builds/my-blog-v2.gin --server https://prod.server
|
|
237
|
+
gingee-cli upgrade-app --appName my-blog --ginPath ./builds/my-blog-v2.gin --server https://prod.server
|
|
238
|
+
```
|
|
133
239
|
|
|
134
240
|
---
|
|
135
241
|
|
|
@@ -145,9 +251,58 @@ Commands for the disaster recovery and rollback features.
|
|
|
145
251
|
**Common Options for Recovery Commands:**
|
|
146
252
|
- `-s, --server <url>` (Optional): The URL of the target server.
|
|
147
253
|
- `-a, --appName <app-name>` (Required): The name of the target application.
|
|
254
|
+
- `-f, --file <path>` (Automation): Provide a preset file for non-interactive execution.
|
|
148
255
|
|
|
149
256
|
---
|
|
150
257
|
|
|
258
|
+
### **Automation with Preset Files**
|
|
259
|
+
|
|
260
|
+
For use in CI/CD pipelines or other automated scripts, the lifecycle commands (`install-app`, `upgrade-app`, `rollback-app`, `delete-app`) can be run in a non-interactive mode by providing a preset file using the `-f, --file <path>` option.
|
|
261
|
+
|
|
262
|
+
The preset file is a simple JSON file that contains the configuration for the action you want to perform. The CLI will use the values from this file instead of showing interactive prompts.
|
|
263
|
+
|
|
264
|
+
**Example `myapp-deploy-presets.json`:**
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"upgrade": {
|
|
268
|
+
"ginPath": "./build/my-blog-app-v2.gin",
|
|
269
|
+
"consent": {
|
|
270
|
+
"grantPermissions": ["db", "fs", "httpclient"]
|
|
271
|
+
},
|
|
272
|
+
"config": {
|
|
273
|
+
"db": [
|
|
274
|
+
{
|
|
275
|
+
"name": "main_db",
|
|
276
|
+
"host": "prod-db.cluster.internal",
|
|
277
|
+
"user": "prod_user",
|
|
278
|
+
"password": "$DB_PASSWORD_PROD",
|
|
279
|
+
"database": "blog_production"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"rollback": {
|
|
285
|
+
"consent": {
|
|
286
|
+
"grantPermissions": ["db", "fs"]
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"delete": {
|
|
290
|
+
"confirm": true
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Security with Environment Variables:**
|
|
296
|
+
For sensitive values like passwords, you can use environment variable placeholders (a string starting with `$`). The CLI will automatically substitute `$VAR_NAME` with the value of the `process.env.VAR_NAME` variable at runtime.
|
|
297
|
+
|
|
298
|
+
**Example Usage in a CI/CD script:**
|
|
299
|
+
```bash
|
|
300
|
+
# The server URL and app name are still passed as arguments for safety
|
|
301
|
+
export DB_PASSWORD_PROD="a-very-secret-password"
|
|
302
|
+
gingee-cli upgrade-app --appName my-blog-app --serverUrl https://prod.server --file ./deploy.json
|
|
303
|
+
```
|
|
304
|
+
---
|
|
305
|
+
|
|
151
306
|
### Service Management
|
|
152
307
|
|
|
153
308
|
Commands for running Gingee as a native background service. These commands must be run from a project's root directory and typically require `sudo` or Administrator privileges.
|
|
@@ -157,6 +312,8 @@ Commands for running Gingee as a native background service. These commands must
|
|
|
157
312
|
- **`service start`**: Manually starts the installed service.
|
|
158
313
|
- **`service stop`**: Manually stops the installed service.
|
|
159
314
|
|
|
315
|
+
---
|
|
316
|
+
|
|
160
317
|
### Local Utilities
|
|
161
318
|
|
|
162
319
|
- **`reset-pwd`**: A local recovery tool. Prompts for a new admin user password for `glade` admin panel.
|
package/commands/init.js
CHANGED
|
@@ -56,8 +56,9 @@ async function init(projectName) {
|
|
|
56
56
|
|
|
57
57
|
spinner.start('Scaffolding project files...');
|
|
58
58
|
fs.mkdirSync(projectPath);
|
|
59
|
-
const templatePath = path.join(__dirname, '..', 'templates'
|
|
60
|
-
|
|
59
|
+
const templatePath = path.join(__dirname, '..', 'templates');
|
|
60
|
+
const projectTemplatePath = path.join(templatePath, 'project');
|
|
61
|
+
fs.copySync(projectTemplatePath, projectPath);
|
|
61
62
|
|
|
62
63
|
const pkgJsonPath = path.join(projectPath, 'package.json');
|
|
63
64
|
const pkgJson = fs.readJsonSync(pkgJsonPath);
|
|
@@ -73,7 +74,7 @@ async function init(projectName) {
|
|
|
73
74
|
|
|
74
75
|
// Find the glade.gin file using require.resolve, which is robust.
|
|
75
76
|
// It looks for the 'gingee' package in the CLI's own node_modules.
|
|
76
|
-
const gladeGinPath =
|
|
77
|
+
const gladeGinPath = path.join(templatePath, 'glade.gin');
|
|
77
78
|
const gladePackageBuffer = fs.readFileSync(gladeGinPath);
|
|
78
79
|
const gladeDestPath = path.join(projectPath, 'web', 'glade');
|
|
79
80
|
|
package/commands/resetGlade.js
CHANGED
|
@@ -43,7 +43,8 @@ async function resetGlade() {
|
|
|
43
43
|
|
|
44
44
|
// --- Re-installation ---
|
|
45
45
|
spinner.start('Installing a clean version of `glade`...');
|
|
46
|
-
const
|
|
46
|
+
const templatePath = path.join(__dirname, '..', 'templates');
|
|
47
|
+
const gladeGinPath = path.join(templatePath, 'glade.gin');
|
|
47
48
|
const gladePackageBuffer = fs.readFileSync(gladeGinPath);
|
|
48
49
|
await _unzipBuffer(gladePackageBuffer, gladeAppPath);
|
|
49
50
|
spinner.succeed('Clean `glade` version installed.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gingee-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "The Gingee Command Line Interface (CLI), official command line tool for creating and managing Gingee projects.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"commander": "^14.0.0",
|
|
42
42
|
"form-data": "^4.0.4",
|
|
43
43
|
"fs-extra": "^11.3.1",
|
|
44
|
-
"gingee": "^1.0.2",
|
|
45
44
|
"inquirer": "^12.9.2",
|
|
46
45
|
"ora": "^8.2.0",
|
|
47
46
|
"yauzl": "^3.2.0"
|
|
Binary file
|