base44 0.0.18 → 0.0.20
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 +39 -40
- 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";
|
|
@@ -7905,7 +7905,7 @@ var AuthValidationError = class extends Error {
|
|
|
7905
7905
|
const PROJECT_SUBDIR = "base44";
|
|
7906
7906
|
const CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
7907
7907
|
const FUNCTION_CONFIG_FILE = `function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
7908
|
-
const APP_CONFIG_PATTERN =
|
|
7908
|
+
const APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
7909
7909
|
const PROJECT_CONFIG_PATTERNS = [`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`, `config.${CONFIG_FILE_EXTENSION_GLOB}`];
|
|
7910
7910
|
const AUTH_CLIENT_ID = "base44_cli";
|
|
7911
7911
|
|
|
@@ -9781,6 +9781,9 @@ async function deleteFile(filePath) {
|
|
|
9781
9781
|
if (!await pathExists(filePath)) return;
|
|
9782
9782
|
await unlink(filePath);
|
|
9783
9783
|
}
|
|
9784
|
+
async function isDirEmpty(dir = process.cwd()) {
|
|
9785
|
+
return (await readdir(dir)).length === 0;
|
|
9786
|
+
}
|
|
9784
9787
|
|
|
9785
9788
|
//#endregion
|
|
9786
9789
|
//#region src/core/auth/config.ts
|
|
@@ -38055,9 +38058,8 @@ async function getTemplateById(templateId) {
|
|
|
38055
38058
|
return template;
|
|
38056
38059
|
}
|
|
38057
38060
|
function validateNonInteractiveFlags$1(command) {
|
|
38058
|
-
const {
|
|
38059
|
-
|
|
38060
|
-
if (providedCount > 0 && providedCount < 2) command.error("Non-interactive mode requires all flags: --name, --path");
|
|
38061
|
+
const { path: path$16 } = command.opts();
|
|
38062
|
+
if (path$16 && !command.args.length) command.error("Non-interactive mode requires all flags: --name, --path");
|
|
38061
38063
|
}
|
|
38062
38064
|
async function chooseCreate(options) {
|
|
38063
38065
|
if (!!(options.name && options.path)) await runCommand(() => createNonInteractive(options), {
|
|
@@ -38081,19 +38083,18 @@ async function createInteractive(options) {
|
|
|
38081
38083
|
message: "Pick a template",
|
|
38082
38084
|
options: templateOptions
|
|
38083
38085
|
}),
|
|
38084
|
-
name: () =>
|
|
38085
|
-
|
|
38086
|
-
|
|
38087
|
-
|
|
38088
|
-
|
|
38089
|
-
|
|
38090
|
-
|
|
38091
|
-
|
|
38092
|
-
|
|
38093
|
-
|
|
38094
|
-
}),
|
|
38086
|
+
name: () => {
|
|
38087
|
+
return options.name ? Promise.resolve(options.name) : he({
|
|
38088
|
+
message: "What is the name of your project?",
|
|
38089
|
+
placeholder: basename(process.cwd()),
|
|
38090
|
+
initialValue: basename(process.cwd()),
|
|
38091
|
+
validate: (value) => {
|
|
38092
|
+
if (!value || value.trim().length === 0) return "Every project deserves a name";
|
|
38093
|
+
}
|
|
38094
|
+
});
|
|
38095
|
+
},
|
|
38095
38096
|
projectPath: async ({ results }) => {
|
|
38096
|
-
const suggestedPath = `./${(0, import_lodash.default)(results.name)}`;
|
|
38097
|
+
const suggestedPath = await isDirEmpty() ? `./` : `./${(0, import_lodash.default)(results.name)}`;
|
|
38097
38098
|
return he({
|
|
38098
38099
|
message: "Where should we create your project?",
|
|
38099
38100
|
placeholder: suggestedPath,
|
|
@@ -38104,7 +38105,6 @@ async function createInteractive(options) {
|
|
|
38104
38105
|
return await executeCreate({
|
|
38105
38106
|
template: result.template,
|
|
38106
38107
|
name: result.name,
|
|
38107
|
-
description: result.description || void 0,
|
|
38108
38108
|
projectPath: result.projectPath,
|
|
38109
38109
|
deploy: options.deploy,
|
|
38110
38110
|
skills: options.skills,
|
|
@@ -38115,7 +38115,6 @@ async function createNonInteractive(options) {
|
|
|
38115
38115
|
return await executeCreate({
|
|
38116
38116
|
template: await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID),
|
|
38117
38117
|
name: options.name,
|
|
38118
|
-
description: options.description,
|
|
38119
38118
|
projectPath: options.path,
|
|
38120
38119
|
deploy: options.deploy,
|
|
38121
38120
|
skills: options.skills,
|
|
@@ -38182,32 +38181,32 @@ async function executeCreate({ template, name: rawName, description, projectPath
|
|
|
38182
38181
|
finalAppUrl = appUrl;
|
|
38183
38182
|
}
|
|
38184
38183
|
}
|
|
38185
|
-
|
|
38186
|
-
|
|
38187
|
-
|
|
38188
|
-
|
|
38189
|
-
|
|
38190
|
-
|
|
38191
|
-
|
|
38192
|
-
|
|
38193
|
-
|
|
38194
|
-
|
|
38195
|
-
|
|
38196
|
-
|
|
38197
|
-
|
|
38198
|
-
|
|
38184
|
+
if (skills ?? true) try {
|
|
38185
|
+
await runTask("Installing AI agent skills...", async () => {
|
|
38186
|
+
await execa("npx", [
|
|
38187
|
+
"-y",
|
|
38188
|
+
"add-skill",
|
|
38189
|
+
"base44/skills",
|
|
38190
|
+
"-y"
|
|
38191
|
+
], {
|
|
38192
|
+
cwd: resolvedPath,
|
|
38193
|
+
shell: true
|
|
38194
|
+
});
|
|
38195
|
+
}, {
|
|
38196
|
+
successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
|
|
38197
|
+
errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
|
|
38199
38198
|
});
|
|
38200
|
-
}
|
|
38201
|
-
successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
|
|
38202
|
-
errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
|
|
38203
|
-
});
|
|
38199
|
+
} catch {}
|
|
38204
38200
|
M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
|
|
38205
38201
|
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38206
38202
|
if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
|
|
38207
38203
|
return { outroMessage: "Your project is set up and ready to use" };
|
|
38208
38204
|
}
|
|
38209
|
-
const createCommand = new Command("create").description("Create a new Base44 project").
|
|
38210
|
-
await chooseCreate(
|
|
38205
|
+
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) => {
|
|
38206
|
+
await chooseCreate({
|
|
38207
|
+
name: name$1,
|
|
38208
|
+
...options
|
|
38209
|
+
});
|
|
38211
38210
|
});
|
|
38212
38211
|
|
|
38213
38212
|
//#endregion
|
|
@@ -38932,7 +38931,7 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
|
|
|
38932
38931
|
|
|
38933
38932
|
//#endregion
|
|
38934
38933
|
//#region package.json
|
|
38935
|
-
var version = "0.0.
|
|
38934
|
+
var version = "0.0.20";
|
|
38936
38935
|
|
|
38937
38936
|
//#endregion
|
|
38938
38937
|
//#region src/cli/program.ts
|
|
@@ -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
|
}
|