@base44-preview/cli 0.0.19-pr.112.3ef73f2 → 0.0.19-pr.112.bf45693
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/dist/index.js +37 -38
- package/dist/templates/templates.json +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import O from "node:readline";
|
|
|
10
10
|
import Stream, { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
11
11
|
import os, { constants, homedir, tmpdir } from "node:os";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
|
-
import fs$1, { access, constants as constants$1, copyFile, mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
13
|
+
import fs$1, { access, constants as constants$1, copyFile, mkdir, readFile, readdir, unlink, writeFile } from "node:fs/promises";
|
|
14
14
|
import { finished } from "node:stream/promises";
|
|
15
15
|
import path$1, { dirname as dirname$1, parse } from "path";
|
|
16
16
|
import EE, { EventEmitter as EventEmitter$1 } from "events";
|
|
@@ -9782,6 +9782,9 @@ async function deleteFile(filePath) {
|
|
|
9782
9782
|
if (!await pathExists(filePath)) return;
|
|
9783
9783
|
await unlink(filePath);
|
|
9784
9784
|
}
|
|
9785
|
+
async function isDirEmpty(dir = process.cwd()) {
|
|
9786
|
+
return (await readdir(dir)).length === 0;
|
|
9787
|
+
}
|
|
9785
9788
|
|
|
9786
9789
|
//#endregion
|
|
9787
9790
|
//#region src/core/auth/config.ts
|
|
@@ -38228,9 +38231,8 @@ async function getTemplateById(templateId) {
|
|
|
38228
38231
|
return template;
|
|
38229
38232
|
}
|
|
38230
38233
|
function validateNonInteractiveFlags$1(command) {
|
|
38231
|
-
const {
|
|
38232
|
-
|
|
38233
|
-
if (providedCount > 0 && providedCount < 2) command.error("Non-interactive mode requires all flags: --name, --path");
|
|
38234
|
+
const { path: path$16 } = command.opts();
|
|
38235
|
+
if (path$16 && !command.args.length) command.error("Non-interactive mode requires all flags: --name, --path");
|
|
38234
38236
|
}
|
|
38235
38237
|
async function chooseCreate(options) {
|
|
38236
38238
|
if (!!(options.name && options.path)) await runCommand(() => createNonInteractive(options), {
|
|
@@ -38254,19 +38256,18 @@ async function createInteractive(options) {
|
|
|
38254
38256
|
message: "Pick a template",
|
|
38255
38257
|
options: templateOptions
|
|
38256
38258
|
}),
|
|
38257
|
-
name: () =>
|
|
38258
|
-
|
|
38259
|
-
|
|
38260
|
-
|
|
38261
|
-
|
|
38262
|
-
|
|
38263
|
-
|
|
38264
|
-
|
|
38265
|
-
|
|
38266
|
-
|
|
38267
|
-
}),
|
|
38259
|
+
name: () => {
|
|
38260
|
+
return options.name ? Promise.resolve(options.name) : he({
|
|
38261
|
+
message: "What is the name of your project?",
|
|
38262
|
+
placeholder: basename(process.cwd()),
|
|
38263
|
+
initialValue: basename(process.cwd()),
|
|
38264
|
+
validate: (value) => {
|
|
38265
|
+
if (!value || value.trim().length === 0) return "Every project deserves a name";
|
|
38266
|
+
}
|
|
38267
|
+
});
|
|
38268
|
+
},
|
|
38268
38269
|
projectPath: async ({ results }) => {
|
|
38269
|
-
const suggestedPath = `./${(0, import_lodash.default)(results.name)}`;
|
|
38270
|
+
const suggestedPath = await isDirEmpty() ? `./` : `./${(0, import_lodash.default)(results.name)}`;
|
|
38270
38271
|
return he({
|
|
38271
38272
|
message: "Where should we create your project?",
|
|
38272
38273
|
placeholder: suggestedPath,
|
|
@@ -38277,7 +38278,6 @@ async function createInteractive(options) {
|
|
|
38277
38278
|
return await executeCreate({
|
|
38278
38279
|
template: result.template,
|
|
38279
38280
|
name: result.name,
|
|
38280
|
-
description: result.description || void 0,
|
|
38281
38281
|
projectPath: result.projectPath,
|
|
38282
38282
|
deploy: options.deploy,
|
|
38283
38283
|
skills: options.skills,
|
|
@@ -38288,7 +38288,6 @@ async function createNonInteractive(options) {
|
|
|
38288
38288
|
return await executeCreate({
|
|
38289
38289
|
template: await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID),
|
|
38290
38290
|
name: options.name,
|
|
38291
|
-
description: options.description,
|
|
38292
38291
|
projectPath: options.path,
|
|
38293
38292
|
deploy: options.deploy,
|
|
38294
38293
|
skills: options.skills,
|
|
@@ -38355,32 +38354,32 @@ async function executeCreate({ template, name: rawName, description, projectPath
|
|
|
38355
38354
|
finalAppUrl = appUrl;
|
|
38356
38355
|
}
|
|
38357
38356
|
}
|
|
38358
|
-
|
|
38359
|
-
|
|
38360
|
-
|
|
38361
|
-
|
|
38362
|
-
|
|
38363
|
-
|
|
38364
|
-
|
|
38365
|
-
|
|
38366
|
-
|
|
38367
|
-
|
|
38368
|
-
|
|
38369
|
-
|
|
38370
|
-
|
|
38371
|
-
|
|
38357
|
+
if (skills ?? true) try {
|
|
38358
|
+
await runTask("Installing AI agent skills...", async () => {
|
|
38359
|
+
await execa("npx", [
|
|
38360
|
+
"-y",
|
|
38361
|
+
"add-skill",
|
|
38362
|
+
"base44/skills",
|
|
38363
|
+
"-y"
|
|
38364
|
+
], {
|
|
38365
|
+
cwd: resolvedPath,
|
|
38366
|
+
shell: true
|
|
38367
|
+
});
|
|
38368
|
+
}, {
|
|
38369
|
+
successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
|
|
38370
|
+
errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
|
|
38372
38371
|
});
|
|
38373
|
-
}
|
|
38374
|
-
successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
|
|
38375
|
-
errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
|
|
38376
|
-
});
|
|
38372
|
+
} catch {}
|
|
38377
38373
|
M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
|
|
38378
38374
|
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38379
38375
|
if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
38380
38376
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
38381
38377
|
}
|
|
38382
|
-
const createCommand = new Command("create").description("Create a new Base44 project").
|
|
38383
|
-
await chooseCreate(
|
|
38378
|
+
const createCommand = new Command("create").description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).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").option("--skills", "Add AI agent skills").hook("preAction", validateNonInteractiveFlags$1).action(async (name$1, options) => {
|
|
38379
|
+
await chooseCreate({
|
|
38380
|
+
name: name$1,
|
|
38381
|
+
...options
|
|
38382
|
+
});
|
|
38384
38383
|
});
|
|
38385
38384
|
|
|
38386
38385
|
//#endregion
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"templates": [
|
|
3
|
-
{
|
|
4
|
-
"id": "backend-only",
|
|
5
|
-
"name": "Create a basic project",
|
|
6
|
-
"description": "Minimal Base44 backend for defining your data models and logic",
|
|
7
|
-
"path": "backend-only"
|
|
8
|
-
},
|
|
9
3
|
{
|
|
10
4
|
"id": "backend-and-client",
|
|
11
5
|
"name": "Start from a template",
|
|
12
6
|
"description": "Full-stack example with a Base44 backend and a Vite + React client application",
|
|
13
7
|
"path": "backend-and-client"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "backend-only",
|
|
11
|
+
"name": "Create a basic project",
|
|
12
|
+
"description": "Minimal Base44 backend for defining your data models and logic",
|
|
13
|
+
"path": "backend-only"
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
}
|