@base44-preview/cli 0.0.15-pr.87.e3632a6 → 0.0.15-pr.93.f0d4819
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 +42 -135
- package/dist/cli/index.js +49 -222
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,171 +1,78 @@
|
|
|
1
1
|
# Base44 CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command-line interface for building applications with [Base44's backend service](https://docs.base44.com/developers/backend/overview/introduction).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Base44's backend service provides a managed backend for your applications, including data storage with entities, serverless functions, authentication, and hosting. The CLI lets you:
|
|
6
|
+
|
|
7
|
+
- **Create projects** from templates.
|
|
8
|
+
- **Sync** resources defined in local code with your Base44 backend.
|
|
9
|
+
- **Deploy sites** to Base44's hosting platform.
|
|
10
|
+
|
|
11
|
+
To get started, see the full list of commands below or check out the [documentation](https://docs.base44.com/developers/references/cli/get-started/overview).
|
|
6
12
|
|
|
7
13
|
## Installation
|
|
8
14
|
|
|
9
15
|
```bash
|
|
10
|
-
# Using npm (globally)
|
|
11
16
|
npm install -g base44
|
|
17
|
+
```
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
Or run commands directly with npx:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
14
22
|
npx base44 <command>
|
|
15
23
|
```
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
Requires Node.js 20.19.0 or higher.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
18
28
|
|
|
19
29
|
```bash
|
|
20
|
-
#
|
|
30
|
+
# Authenticate
|
|
21
31
|
base44 login
|
|
22
32
|
|
|
23
|
-
#
|
|
33
|
+
# Create a project
|
|
24
34
|
base44 create
|
|
25
|
-
|
|
26
|
-
# 3. Deploy everything (entities, functions, and site)
|
|
27
|
-
npm run build
|
|
28
|
-
base44 deploy
|
|
29
35
|
```
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Authentication
|
|
34
|
-
|
|
35
|
-
| Command | Description |
|
|
36
|
-
|---------|-------------|
|
|
37
|
-
| `base44 login` | Authenticate with Base44 using device code flow |
|
|
38
|
-
| `base44 whoami` | Display current authenticated user |
|
|
39
|
-
| `base44 logout` | Logout from current device |
|
|
40
|
-
|
|
41
|
-
### Project Management
|
|
37
|
+
The CLI will guide you through project setup. For step-by-step tutorials, see the quickstart guides:
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
| `base44 create` | Create a new Base44 project from a template |
|
|
46
|
-
| `base44 link` | Link an existing local project to Base44 |
|
|
47
|
-
| `base44 dashboard` | Open the app dashboard in your browser |
|
|
48
|
-
|
|
49
|
-
### Deployment
|
|
50
|
-
|
|
51
|
-
| Command | Description |
|
|
52
|
-
|---------|-------------|
|
|
53
|
-
| `base44 deploy` | Deploy all resources (entities, functions, and site) |
|
|
54
|
-
|
|
55
|
-
### Entities
|
|
56
|
-
|
|
57
|
-
| Command | Description |
|
|
58
|
-
|---------|-------------|
|
|
59
|
-
| `base44 entities push` | Push local entity schemas to Base44 |
|
|
60
|
-
|
|
61
|
-
### Functions
|
|
62
|
-
|
|
63
|
-
| Command | Description |
|
|
64
|
-
|---------|-------------|
|
|
65
|
-
| `base44 functions deploy` | Deploy local functions to Base44 |
|
|
39
|
+
- [Backend only](https://docs.base44.com/developers/backend/quickstart/quickstart-backend-only) — for headless apps or custom frontends
|
|
40
|
+
- [React](https://docs.base44.com/developers/backend/quickstart/quickstart-with-react) — full-stack with Vite + React
|
|
66
41
|
|
|
67
|
-
|
|
42
|
+
## Commands
|
|
68
43
|
|
|
69
44
|
| Command | Description |
|
|
70
|
-
|
|
71
|
-
| `base44
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"functionsDir": "./functions", // Default: ./functions
|
|
85
|
-
"site": {
|
|
86
|
-
"outputDirectory": "../dist" // Path to built site files
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### App Configuration
|
|
92
|
-
|
|
93
|
-
Your app ID is stored in a `.app.jsonc` file in the `base44/` directory. This file is created automatically when you run `base44 create` or `base44 link`:
|
|
94
|
-
|
|
95
|
-
```jsonc
|
|
96
|
-
// base44/.app.jsonc
|
|
97
|
-
{
|
|
98
|
-
"id": "your-app-id"
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Project Structure
|
|
103
|
-
|
|
104
|
-
A typical Base44 project has this structure:
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
my-project/
|
|
108
|
-
├── base44/
|
|
109
|
-
│ ├── config.jsonc # Project configuration
|
|
110
|
-
│ ├── .app.jsonc # App ID (git-ignored)
|
|
111
|
-
│ ├── entities/ # Entity schema files
|
|
112
|
-
│ │ ├── user.jsonc
|
|
113
|
-
│ │ └── product.jsonc
|
|
114
|
-
│ └── functions/ # Backend functions
|
|
115
|
-
│ └── my-function/
|
|
116
|
-
│ ├── config.jsonc
|
|
117
|
-
│ └── index.js
|
|
118
|
-
├── src/ # Your frontend code
|
|
119
|
-
├── dist/ # Built site files (for deployment)
|
|
120
|
-
└── package.json
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Development
|
|
124
|
-
|
|
125
|
-
### Prerequisites
|
|
126
|
-
|
|
127
|
-
- Node.js >= 20.19.0
|
|
128
|
-
- npm
|
|
129
|
-
|
|
130
|
-
### Setup
|
|
45
|
+
| ------- | ----------- |
|
|
46
|
+
| [`create`](https://docs.base44.com/developers/references/cli/commands/create) | Create a new Base44 project from a template |
|
|
47
|
+
| [`deploy`](https://docs.base44.com/developers/references/cli/commands/deploy) | Deploy resources and site to Base44 |
|
|
48
|
+
| [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Create a Base44 backend project from an existing Base44 app |
|
|
49
|
+
| [`link`](https://docs.base44.com/developers/references/cli/commands/link) | Link a local project to a project on Base44 |
|
|
50
|
+
| [`dashboard`](https://docs.base44.com/developers/references/cli/commands/dashboard) | Open the app dashboard in your browser |
|
|
51
|
+
| [`login`](https://docs.base44.com/developers/references/cli/commands/login) | Authenticate with Base44 |
|
|
52
|
+
| [`logout`](https://docs.base44.com/developers/references/cli/commands/logout) | Sign out and clear stored credentials |
|
|
53
|
+
| [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
|
|
54
|
+
| [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entity schemas to Base44 |
|
|
55
|
+
| [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
|
|
56
|
+
| [`site deploy`](https://docs.base44.com/developers/references/cli/commands/site-deploy) | Deploy built site files to Base44 hosting |
|
|
57
|
+
|
|
58
|
+
## Help
|
|
131
59
|
|
|
132
60
|
```bash
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
cd cli
|
|
136
|
-
|
|
137
|
-
# Install dependencies
|
|
138
|
-
npm install
|
|
139
|
-
|
|
140
|
-
# Build
|
|
141
|
-
npm run build
|
|
142
|
-
|
|
143
|
-
# Run in development mode
|
|
144
|
-
npm run dev -- <command>
|
|
61
|
+
base44 --help
|
|
62
|
+
base44 <command> --help
|
|
145
63
|
```
|
|
146
64
|
|
|
147
|
-
|
|
65
|
+
## Version
|
|
148
66
|
|
|
149
67
|
```bash
|
|
150
|
-
|
|
151
|
-
npm run typecheck # Type check with tsc
|
|
152
|
-
npm run dev # Run in development mode with tsx
|
|
153
|
-
npm run lint # Lint with ESLint
|
|
154
|
-
npm test # Run tests with Vitest
|
|
68
|
+
base44 --version
|
|
155
69
|
```
|
|
156
70
|
|
|
157
|
-
|
|
71
|
+
## Alpha
|
|
158
72
|
|
|
159
|
-
|
|
160
|
-
# After building
|
|
161
|
-
npm start -- <command>
|
|
162
|
-
|
|
163
|
-
# Or directly
|
|
164
|
-
./dist/cli/index.js <command>
|
|
165
|
-
```
|
|
166
|
-
## Contributing
|
|
73
|
+
The CLI and Base44 backend service are currently in alpha. We're actively improving them based on user feedback. Share your thoughts and feature requests on our [GitHub Discussions](https://github.com/orgs/base44/discussions).
|
|
167
74
|
|
|
168
|
-
|
|
75
|
+
Found a bug? [Open an issue](https://github.com/base44/cli/issues).
|
|
169
76
|
|
|
170
77
|
## License
|
|
171
78
|
|
package/dist/cli/index.js
CHANGED
|
@@ -31050,58 +31050,6 @@ async function printBanner() {
|
|
|
31050
31050
|
else console.log(theme.colors.base44Orange(BANNER_LINES.join("\n")));
|
|
31051
31051
|
}
|
|
31052
31052
|
|
|
31053
|
-
//#endregion
|
|
31054
|
-
//#region src/cli/utils/json.ts
|
|
31055
|
-
/**
|
|
31056
|
-
* JSON output utilities for CLI commands.
|
|
31057
|
-
*
|
|
31058
|
-
* These utilities support the `--json` flag which outputs machine-readable JSON
|
|
31059
|
-
* instead of human-friendly formatted output.
|
|
31060
|
-
*/
|
|
31061
|
-
let jsonModeEnabled = false;
|
|
31062
|
-
/**
|
|
31063
|
-
* Enable JSON output mode. Called by runCommand when --json flag is detected.
|
|
31064
|
-
*/
|
|
31065
|
-
function setJsonMode(enabled) {
|
|
31066
|
-
jsonModeEnabled = enabled;
|
|
31067
|
-
}
|
|
31068
|
-
/**
|
|
31069
|
-
* Check if JSON output mode is currently active.
|
|
31070
|
-
*/
|
|
31071
|
-
function isJsonMode() {
|
|
31072
|
-
return jsonModeEnabled;
|
|
31073
|
-
}
|
|
31074
|
-
/**
|
|
31075
|
-
* Output a success JSON response to stdout.
|
|
31076
|
-
* Only outputs if JSON mode is enabled.
|
|
31077
|
-
*/
|
|
31078
|
-
function outputJson(data) {
|
|
31079
|
-
if (!jsonModeEnabled) return;
|
|
31080
|
-
const response = {
|
|
31081
|
-
success: true,
|
|
31082
|
-
data
|
|
31083
|
-
};
|
|
31084
|
-
console.log(JSON.stringify(response, null, 2));
|
|
31085
|
-
}
|
|
31086
|
-
/**
|
|
31087
|
-
* Output an error JSON response to stderr.
|
|
31088
|
-
* Only outputs if JSON mode is enabled.
|
|
31089
|
-
*
|
|
31090
|
-
* @param error - The error to output
|
|
31091
|
-
* @param code - Optional error code
|
|
31092
|
-
*/
|
|
31093
|
-
function outputJsonError(error, code$1) {
|
|
31094
|
-
if (!jsonModeEnabled) return;
|
|
31095
|
-
const response = {
|
|
31096
|
-
success: false,
|
|
31097
|
-
error: {
|
|
31098
|
-
message: error instanceof Error ? error.message : error,
|
|
31099
|
-
...code$1 && { code: code$1 }
|
|
31100
|
-
}
|
|
31101
|
-
};
|
|
31102
|
-
console.error(JSON.stringify(response, null, 2));
|
|
31103
|
-
}
|
|
31104
|
-
|
|
31105
31053
|
//#endregion
|
|
31106
31054
|
//#region src/cli/utils/runCommand.ts
|
|
31107
31055
|
/**
|
|
@@ -31135,35 +31083,25 @@ function outputJsonError(error, code$1) {
|
|
|
31135
31083
|
* });
|
|
31136
31084
|
*/
|
|
31137
31085
|
async function runCommand(commandFn, options) {
|
|
31138
|
-
|
|
31139
|
-
if (
|
|
31140
|
-
|
|
31141
|
-
|
|
31142
|
-
|
|
31143
|
-
Ie("");
|
|
31144
|
-
} else Ie(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
31145
|
-
}
|
|
31086
|
+
console.log();
|
|
31087
|
+
if (options?.fullBanner) {
|
|
31088
|
+
await printBanner();
|
|
31089
|
+
Ie("");
|
|
31090
|
+
} else Ie(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
31146
31091
|
try {
|
|
31147
31092
|
if (options?.requireAuth) {
|
|
31148
31093
|
if (!await isLoggedIn()) {
|
|
31149
|
-
if (jsonMode) throw new Error("Authentication required. Please run 'base44 login' first.");
|
|
31150
31094
|
M.info("You need to login first to continue.");
|
|
31151
31095
|
await login();
|
|
31152
31096
|
}
|
|
31153
31097
|
}
|
|
31154
31098
|
if (options?.requireAppConfig !== false) await initAppConfig();
|
|
31155
|
-
const { outroMessage
|
|
31156
|
-
|
|
31157
|
-
else Se(outroMessage || "");
|
|
31099
|
+
const { outroMessage } = await commandFn();
|
|
31100
|
+
Se(outroMessage || "");
|
|
31158
31101
|
} catch (e$1) {
|
|
31159
|
-
if (
|
|
31160
|
-
|
|
31161
|
-
|
|
31162
|
-
} else {
|
|
31163
|
-
if (e$1 instanceof Error) M.error(e$1.stack ?? e$1.message);
|
|
31164
|
-
else M.error(String(e$1));
|
|
31165
|
-
process.exit(1);
|
|
31166
|
-
}
|
|
31102
|
+
if (e$1 instanceof Error) M.error(e$1.stack ?? e$1.message);
|
|
31103
|
+
else M.error(String(e$1));
|
|
31104
|
+
process.exit(1);
|
|
31167
31105
|
}
|
|
31168
31106
|
}
|
|
31169
31107
|
|
|
@@ -31173,8 +31111,6 @@ async function runCommand(commandFn, options) {
|
|
|
31173
31111
|
* Wraps an async operation with automatic spinner management.
|
|
31174
31112
|
* The spinner is automatically started, and stopped on both success and error.
|
|
31175
31113
|
*
|
|
31176
|
-
* In JSON mode, the spinner is suppressed and the operation runs silently.
|
|
31177
|
-
*
|
|
31178
31114
|
* @param startMessage - Message to show when spinner starts
|
|
31179
31115
|
* @param operation - The async operation to execute. Receives an updateMessage function
|
|
31180
31116
|
* to update the spinner text during long-running operations.
|
|
@@ -31210,10 +31146,6 @@ async function runCommand(commandFn, options) {
|
|
|
31210
31146
|
* );
|
|
31211
31147
|
*/
|
|
31212
31148
|
async function runTask(startMessage, operation, options) {
|
|
31213
|
-
if (isJsonMode()) {
|
|
31214
|
-
const noopUpdateMessage = () => {};
|
|
31215
|
-
return await operation(noopUpdateMessage);
|
|
31216
|
-
}
|
|
31217
31149
|
const s = Y();
|
|
31218
31150
|
s.start(startMessage);
|
|
31219
31151
|
const updateMessage = (message) => s.message(message);
|
|
@@ -31254,10 +31186,6 @@ function getDashboardUrl(projectId) {
|
|
|
31254
31186
|
|
|
31255
31187
|
//#endregion
|
|
31256
31188
|
//#region src/cli/commands/auth/login.ts
|
|
31257
|
-
/**
|
|
31258
|
-
* Login command does not support --json output.
|
|
31259
|
-
* It requires interactive browser authentication via device code flow.
|
|
31260
|
-
*/
|
|
31261
31189
|
async function generateAndDisplayDeviceCode() {
|
|
31262
31190
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
31263
31191
|
return await generateDeviceCode();
|
|
@@ -31319,13 +31247,7 @@ const loginCommand = new Command("login").description("Authenticate with Base44"
|
|
|
31319
31247
|
//#region src/cli/commands/auth/whoami.ts
|
|
31320
31248
|
async function whoami() {
|
|
31321
31249
|
const auth = await readAuth();
|
|
31322
|
-
return {
|
|
31323
|
-
outroMessage: `Logged in as: ${theme.styles.bold(auth.email)}`,
|
|
31324
|
-
data: {
|
|
31325
|
-
email: auth.email,
|
|
31326
|
-
name: auth.name
|
|
31327
|
-
}
|
|
31328
|
-
};
|
|
31250
|
+
return { outroMessage: `Logged in as: ${theme.styles.bold(auth.email)}` };
|
|
31329
31251
|
}
|
|
31330
31252
|
const whoamiCommand = new Command("whoami").description("Display current authenticated user").action(async () => {
|
|
31331
31253
|
await runCommand(whoami, {
|
|
@@ -31336,10 +31258,6 @@ const whoamiCommand = new Command("whoami").description("Display current authent
|
|
|
31336
31258
|
|
|
31337
31259
|
//#endregion
|
|
31338
31260
|
//#region src/cli/commands/auth/logout.ts
|
|
31339
|
-
/**
|
|
31340
|
-
* Logout command does not support --json output.
|
|
31341
|
-
* It is a user-facing auth command that is rarely scripted.
|
|
31342
|
-
*/
|
|
31343
31261
|
async function logout() {
|
|
31344
31262
|
await deleteAuth();
|
|
31345
31263
|
return { outroMessage: "Logged out successfully" };
|
|
@@ -31352,31 +31270,18 @@ const logoutCommand = new Command("logout").description("Logout from current dev
|
|
|
31352
31270
|
//#region src/cli/commands/entities/push.ts
|
|
31353
31271
|
async function pushEntitiesAction() {
|
|
31354
31272
|
const { entities } = await readProjectConfig();
|
|
31355
|
-
if (entities.length === 0) return {
|
|
31356
|
-
|
|
31357
|
-
data: {
|
|
31358
|
-
created: [],
|
|
31359
|
-
updated: [],
|
|
31360
|
-
deleted: []
|
|
31361
|
-
}
|
|
31362
|
-
};
|
|
31363
|
-
if (!isJsonMode()) M.info(`Found ${entities.length} entities to push`);
|
|
31273
|
+
if (entities.length === 0) return { outroMessage: "No entities found in project" };
|
|
31274
|
+
M.info(`Found ${entities.length} entities to push`);
|
|
31364
31275
|
const result = await runTask("Pushing entities to Base44", async () => {
|
|
31365
31276
|
return await pushEntities(entities);
|
|
31366
31277
|
}, {
|
|
31367
31278
|
successMessage: "Entities pushed successfully",
|
|
31368
31279
|
errorMessage: "Failed to push entities"
|
|
31369
31280
|
});
|
|
31370
|
-
if (
|
|
31371
|
-
|
|
31372
|
-
|
|
31373
|
-
|
|
31374
|
-
}
|
|
31375
|
-
return { data: {
|
|
31376
|
-
created: result.created,
|
|
31377
|
-
updated: result.updated,
|
|
31378
|
-
deleted: result.deleted
|
|
31379
|
-
} };
|
|
31281
|
+
if (result.created.length > 0) M.success(`Created: ${result.created.join(", ")}`);
|
|
31282
|
+
if (result.updated.length > 0) M.success(`Updated: ${result.updated.join(", ")}`);
|
|
31283
|
+
if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
31284
|
+
return {};
|
|
31380
31285
|
}
|
|
31381
31286
|
const entitiesPushCommand = new Command("entities").description("Manage project entities").addCommand(new Command("push").description("Push local entities to Base44").action(async () => {
|
|
31382
31287
|
await runCommand(pushEntitiesAction, { requireAuth: true });
|
|
@@ -31386,32 +31291,21 @@ const entitiesPushCommand = new Command("entities").description("Manage project
|
|
|
31386
31291
|
//#region src/cli/commands/functions/deploy.ts
|
|
31387
31292
|
async function deployFunctionsAction() {
|
|
31388
31293
|
const { functions } = await readProjectConfig();
|
|
31389
|
-
if (functions.length === 0) return {
|
|
31390
|
-
|
|
31391
|
-
data: {
|
|
31392
|
-
deployed: [],
|
|
31393
|
-
deleted: []
|
|
31394
|
-
}
|
|
31395
|
-
};
|
|
31396
|
-
if (!isJsonMode()) M.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
|
|
31294
|
+
if (functions.length === 0) return { outroMessage: "No functions found. Create functions in the 'functions' directory." };
|
|
31295
|
+
M.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
|
|
31397
31296
|
const result = await runTask("Deploying functions to Base44", async () => {
|
|
31398
31297
|
return await pushFunctions(functions);
|
|
31399
31298
|
}, {
|
|
31400
31299
|
successMessage: "Functions deployed successfully",
|
|
31401
31300
|
errorMessage: "Failed to deploy functions"
|
|
31402
31301
|
});
|
|
31403
|
-
if (
|
|
31404
|
-
|
|
31405
|
-
if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
31406
|
-
}
|
|
31302
|
+
if (result.deployed.length > 0) M.success(`Deployed: ${result.deployed.join(", ")}`);
|
|
31303
|
+
if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
31407
31304
|
if (result.errors && result.errors.length > 0) {
|
|
31408
31305
|
const errorMessages = result.errors.map((e$1) => `'${e$1.name}' function: ${e$1.message}`).join("\n");
|
|
31409
31306
|
throw new Error(`Function deployment errors:\n${errorMessages}`);
|
|
31410
31307
|
}
|
|
31411
|
-
return {
|
|
31412
|
-
deployed: result.deployed,
|
|
31413
|
-
deleted: result.deleted
|
|
31414
|
-
} };
|
|
31308
|
+
return {};
|
|
31415
31309
|
}
|
|
31416
31310
|
const functionsDeployCommand = new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
|
|
31417
31311
|
await runCommand(deployFunctionsAction, { requireAuth: true });
|
|
@@ -38095,10 +37989,9 @@ async function getTemplateById(templateId) {
|
|
|
38095
37989
|
}
|
|
38096
37990
|
return template;
|
|
38097
37991
|
}
|
|
38098
|
-
function validateNonInteractiveFlags$
|
|
38099
|
-
const { name: name$1, path: path$16
|
|
37992
|
+
function validateNonInteractiveFlags$1(command) {
|
|
37993
|
+
const { name: name$1, path: path$16 } = command.opts();
|
|
38100
37994
|
const providedCount = [name$1, path$16].filter(Boolean).length;
|
|
38101
|
-
if (json && providedCount < 2) command.error("JSON mode requires all flags: --name, --path");
|
|
38102
37995
|
if (providedCount > 0 && providedCount < 2) command.error("Non-interactive mode requires all flags: --name, --path");
|
|
38103
37996
|
}
|
|
38104
37997
|
async function chooseCreate(options) {
|
|
@@ -38222,23 +38115,12 @@ async function executeCreate({ template, name: rawName, description, projectPath
|
|
|
38222
38115
|
finalAppUrl = appUrl;
|
|
38223
38116
|
}
|
|
38224
38117
|
}
|
|
38225
|
-
|
|
38226
|
-
|
|
38227
|
-
|
|
38228
|
-
|
|
38229
|
-
if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
38230
|
-
}
|
|
38231
|
-
return {
|
|
38232
|
-
outroMessage: "Your project is set up and ready to use",
|
|
38233
|
-
data: {
|
|
38234
|
-
projectId,
|
|
38235
|
-
path: resolvedPath,
|
|
38236
|
-
dashboardUrl,
|
|
38237
|
-
...finalAppUrl && { appUrl: finalAppUrl }
|
|
38238
|
-
}
|
|
38239
|
-
};
|
|
38118
|
+
M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
|
|
38119
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38120
|
+
if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
38121
|
+
return { outroMessage: "Your project is set up and ready to use" };
|
|
38240
38122
|
}
|
|
38241
|
-
const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").hook("preAction", validateNonInteractiveFlags$
|
|
38123
|
+
const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
|
|
38242
38124
|
await chooseCreate(options);
|
|
38243
38125
|
});
|
|
38244
38126
|
|
|
@@ -38783,36 +38665,20 @@ var open_default = open;
|
|
|
38783
38665
|
|
|
38784
38666
|
//#endregion
|
|
38785
38667
|
//#region src/cli/commands/project/dashboard.ts
|
|
38786
|
-
async function openDashboard(
|
|
38668
|
+
async function openDashboard() {
|
|
38787
38669
|
const dashboardUrl = getDashboardUrl();
|
|
38788
|
-
|
|
38789
|
-
|
|
38790
|
-
return {
|
|
38791
|
-
outroMessage: shouldOpen ? `Dashboard opened at ${dashboardUrl}` : `Dashboard URL: ${dashboardUrl}`,
|
|
38792
|
-
data: { dashboardUrl }
|
|
38793
|
-
};
|
|
38670
|
+
await open_default(dashboardUrl);
|
|
38671
|
+
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
38794
38672
|
}
|
|
38795
|
-
const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").
|
|
38796
|
-
await runCommand(
|
|
38673
|
+
const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").action(async () => {
|
|
38674
|
+
await runCommand(openDashboard, { requireAuth: true });
|
|
38797
38675
|
});
|
|
38798
38676
|
|
|
38799
38677
|
//#endregion
|
|
38800
38678
|
//#region src/cli/commands/project/deploy.ts
|
|
38801
|
-
function validateNonInteractiveFlags$1(command) {
|
|
38802
|
-
const opts = command.optsWithGlobals();
|
|
38803
|
-
if (opts.json && !opts.yes) command.error("JSON mode requires: --yes (-y) to skip confirmation");
|
|
38804
|
-
}
|
|
38805
38679
|
async function deployAction$1(options) {
|
|
38806
38680
|
const projectData = await readProjectConfig();
|
|
38807
|
-
if (!hasResourcesToDeploy(projectData)) return {
|
|
38808
|
-
outroMessage: "No resources found to deploy",
|
|
38809
|
-
data: {
|
|
38810
|
-
dashboardUrl: getDashboardUrl(),
|
|
38811
|
-
entitiesCount: 0,
|
|
38812
|
-
functionsCount: 0,
|
|
38813
|
-
siteDeployed: false
|
|
38814
|
-
}
|
|
38815
|
-
};
|
|
38681
|
+
if (!hasResourcesToDeploy(projectData)) return { outroMessage: "No resources found to deploy" };
|
|
38816
38682
|
const { project, entities, functions } = projectData;
|
|
38817
38683
|
const summaryLines = [];
|
|
38818
38684
|
if (entities.length > 0) summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -38821,48 +38687,26 @@ async function deployAction$1(options) {
|
|
|
38821
38687
|
if (!options.yes) {
|
|
38822
38688
|
M.warn(`This will update your Base44 app with:\n${summaryLines.join("\n")}`);
|
|
38823
38689
|
const shouldDeploy = await ye({ message: "Are you sure you want to continue?" });
|
|
38824
|
-
if (pD(shouldDeploy) || !shouldDeploy) return {
|
|
38825
|
-
|
|
38826
|
-
data: {
|
|
38827
|
-
dashboardUrl: getDashboardUrl(),
|
|
38828
|
-
entitiesCount: entities.length,
|
|
38829
|
-
functionsCount: functions.length,
|
|
38830
|
-
siteDeployed: false,
|
|
38831
|
-
cancelled: true
|
|
38832
|
-
}
|
|
38833
|
-
};
|
|
38834
|
-
} else if (!isJsonMode()) M.info(`Deploying:\n${summaryLines.join("\n")}`);
|
|
38690
|
+
if (pD(shouldDeploy) || !shouldDeploy) return { outroMessage: "Deployment cancelled" };
|
|
38691
|
+
} else M.info(`Deploying:\n${summaryLines.join("\n")}`);
|
|
38835
38692
|
const result = await runTask("Deploying your app...", async () => {
|
|
38836
38693
|
return await deployAll(projectData);
|
|
38837
38694
|
}, {
|
|
38838
38695
|
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
38839
38696
|
errorMessage: "Deployment failed"
|
|
38840
38697
|
});
|
|
38841
|
-
|
|
38842
|
-
if (
|
|
38843
|
-
|
|
38844
|
-
if (result.appUrl) M.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
38845
|
-
}
|
|
38846
|
-
return {
|
|
38847
|
-
outroMessage: "App deployed successfully",
|
|
38848
|
-
data: {
|
|
38849
|
-
dashboardUrl,
|
|
38850
|
-
appUrl: result.appUrl,
|
|
38851
|
-
entitiesCount: entities.length,
|
|
38852
|
-
functionsCount: functions.length,
|
|
38853
|
-
siteDeployed: !!project.site?.outputDirectory
|
|
38854
|
-
}
|
|
38855
|
-
};
|
|
38698
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
38699
|
+
if (result.appUrl) M.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
38700
|
+
return { outroMessage: "App deployed successfully" };
|
|
38856
38701
|
}
|
|
38857
|
-
const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, and site)").option("-y, --yes", "Skip confirmation prompt").
|
|
38702
|
+
const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
38858
38703
|
await runCommand(() => deployAction$1(options), { requireAuth: true });
|
|
38859
38704
|
});
|
|
38860
38705
|
|
|
38861
38706
|
//#endregion
|
|
38862
38707
|
//#region src/cli/commands/project/link.ts
|
|
38863
38708
|
function validateNonInteractiveFlags(command) {
|
|
38864
|
-
const { create: create$1, name: name$1
|
|
38865
|
-
if (json && (!create$1 || !name$1)) command.error("JSON mode requires flags: --create, --name");
|
|
38709
|
+
const { create: create$1, name: name$1 } = command.opts();
|
|
38866
38710
|
if (create$1 && !name$1) command.error("--name is required when using --create");
|
|
38867
38711
|
}
|
|
38868
38712
|
async function promptForProjectDetails() {
|
|
@@ -38914,15 +38758,8 @@ async function link(options) {
|
|
|
38914
38758
|
id: projectId,
|
|
38915
38759
|
projectRoot: projectRoot.root
|
|
38916
38760
|
});
|
|
38917
|
-
|
|
38918
|
-
|
|
38919
|
-
return {
|
|
38920
|
-
outroMessage: "Project linked",
|
|
38921
|
-
data: {
|
|
38922
|
-
projectId,
|
|
38923
|
-
dashboardUrl
|
|
38924
|
-
}
|
|
38925
|
-
};
|
|
38761
|
+
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38762
|
+
return { outroMessage: "Project linked" };
|
|
38926
38763
|
}
|
|
38927
38764
|
const linkCommand = new Command("link").description("Link a local project to a Base44 project").option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").hook("preAction", validateNonInteractiveFlags).action(async (options) => {
|
|
38928
38765
|
await runCommand(() => link(options), {
|
|
@@ -38937,23 +38774,16 @@ async function deployAction(options) {
|
|
|
38937
38774
|
const { project } = await readProjectConfig();
|
|
38938
38775
|
if (!project.site?.outputDirectory) throw new Error("No site configuration found. Please add 'site.outputDirectory' to your config.jsonc");
|
|
38939
38776
|
const outputDir = resolve(project.root, project.site.outputDirectory);
|
|
38940
|
-
if (!options.yes
|
|
38777
|
+
if (!options.yes) {
|
|
38941
38778
|
const shouldDeploy = await ye({ message: `Deploy site from ${project.site.outputDirectory}?` });
|
|
38942
|
-
if (pD(shouldDeploy) || !shouldDeploy) return {
|
|
38943
|
-
outroMessage: "Deployment cancelled",
|
|
38944
|
-
data: { cancelled: true }
|
|
38945
|
-
};
|
|
38779
|
+
if (pD(shouldDeploy) || !shouldDeploy) return { outroMessage: "Deployment cancelled" };
|
|
38946
38780
|
}
|
|
38947
|
-
|
|
38781
|
+
return { outroMessage: `Visit your site at: ${(await runTask("Creating archive and deploying site...", async () => {
|
|
38948
38782
|
return await deploySite(outputDir);
|
|
38949
38783
|
}, {
|
|
38950
38784
|
successMessage: "Site deployed successfully",
|
|
38951
38785
|
errorMessage: "Deployment failed"
|
|
38952
|
-
});
|
|
38953
|
-
return {
|
|
38954
|
-
outroMessage: `Visit your site at: ${result.appUrl}`,
|
|
38955
|
-
data: { appUrl: result.appUrl }
|
|
38956
|
-
};
|
|
38786
|
+
})).appUrl}` };
|
|
38957
38787
|
}
|
|
38958
38788
|
const siteDeployCommand = new Command("site").description("Manage site deployments").addCommand(new Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
38959
38789
|
await runCommand(() => deployAction(options), { requireAuth: true });
|
|
@@ -38966,10 +38796,7 @@ var version = "0.0.15";
|
|
|
38966
38796
|
//#endregion
|
|
38967
38797
|
//#region src/cli/index.ts
|
|
38968
38798
|
const program = new Command();
|
|
38969
|
-
program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version)
|
|
38970
|
-
program.hook("preAction", (thisCommand) => {
|
|
38971
|
-
if (thisCommand.optsWithGlobals().json) setJsonMode(true);
|
|
38972
|
-
});
|
|
38799
|
+
program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version);
|
|
38973
38800
|
program.configureHelp({ sortSubcommands: true });
|
|
38974
38801
|
program.addCommand(loginCommand);
|
|
38975
38802
|
program.addCommand(whoamiCommand);
|
package/package.json
CHANGED