@base44-preview/cli 0.0.7-pr.63.fe74e75 → 0.0.7-pr.67.27422e7
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/cli/index.js +61 -32
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -38152,37 +38152,56 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
38152
38152
|
var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
|
|
38153
38153
|
const orange = source_default.hex("#E86B3C");
|
|
38154
38154
|
const cyan = source_default.hex("#00D4FF");
|
|
38155
|
-
async function create() {
|
|
38156
|
-
const
|
|
38155
|
+
async function create(options) {
|
|
38156
|
+
const templates = await listTemplates();
|
|
38157
|
+
const templateOptions = templates.map((t) => ({
|
|
38157
38158
|
value: t,
|
|
38158
38159
|
label: t.name,
|
|
38159
38160
|
hint: t.description
|
|
38160
38161
|
}));
|
|
38161
|
-
|
|
38162
|
-
|
|
38163
|
-
|
|
38164
|
-
|
|
38165
|
-
|
|
38166
|
-
|
|
38167
|
-
|
|
38168
|
-
|
|
38169
|
-
|
|
38170
|
-
|
|
38162
|
+
let template;
|
|
38163
|
+
let name$1;
|
|
38164
|
+
let description;
|
|
38165
|
+
let projectPath;
|
|
38166
|
+
if (options.template && options.name) {
|
|
38167
|
+
const foundTemplate = templates.find((t) => t.name === options.template);
|
|
38168
|
+
if (!foundTemplate) throw new Error(`Template "${options.template}" not found. Available templates: ${templates.map((t) => t.name).join(", ")}`);
|
|
38169
|
+
if (!options.name || options.name.trim().length === 0) throw new Error("Project name is required");
|
|
38170
|
+
template = foundTemplate;
|
|
38171
|
+
name$1 = options.name;
|
|
38172
|
+
description = options.description;
|
|
38173
|
+
projectPath = options.path || `./${(0, import_lodash.default)(options.name)}`;
|
|
38174
|
+
} else {
|
|
38175
|
+
const result = await Ce({
|
|
38176
|
+
template: () => ve({
|
|
38177
|
+
message: "Pick a template",
|
|
38178
|
+
options: templateOptions
|
|
38179
|
+
}),
|
|
38180
|
+
name: () => he({
|
|
38181
|
+
message: "What is the name of your project?",
|
|
38182
|
+
placeholder: "my-app",
|
|
38183
|
+
validate: (value) => {
|
|
38184
|
+
if (!value || value.trim().length === 0) return "Every project deserves a name";
|
|
38185
|
+
}
|
|
38186
|
+
}),
|
|
38187
|
+
description: () => he({
|
|
38188
|
+
message: "Description (optional)",
|
|
38189
|
+
placeholder: "A brief description of your project"
|
|
38190
|
+
}),
|
|
38191
|
+
projectPath: async ({ results }) => {
|
|
38192
|
+
const suggestedPath = `./${(0, import_lodash.default)(results.name)}`;
|
|
38193
|
+
return he({
|
|
38194
|
+
message: "Where should we create the base44 folder?",
|
|
38195
|
+
placeholder: suggestedPath,
|
|
38196
|
+
initialValue: suggestedPath
|
|
38197
|
+
});
|
|
38171
38198
|
}
|
|
38172
|
-
})
|
|
38173
|
-
|
|
38174
|
-
|
|
38175
|
-
|
|
38176
|
-
|
|
38177
|
-
|
|
38178
|
-
const suggestedPath = `./${(0, import_lodash.default)(results.name)}`;
|
|
38179
|
-
return he({
|
|
38180
|
-
message: "Where should we create the base44 folder?",
|
|
38181
|
-
placeholder: suggestedPath,
|
|
38182
|
-
initialValue: suggestedPath
|
|
38183
|
-
});
|
|
38184
|
-
}
|
|
38185
|
-
}, { onCancel: onPromptCancel });
|
|
38199
|
+
}, { onCancel: onPromptCancel });
|
|
38200
|
+
template = result.template;
|
|
38201
|
+
name$1 = result.name;
|
|
38202
|
+
description = result.description;
|
|
38203
|
+
projectPath = result.projectPath;
|
|
38204
|
+
}
|
|
38186
38205
|
const resolvedPath = resolve(projectPath);
|
|
38187
38206
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
38188
38207
|
return await createProjectFiles({
|
|
@@ -38199,8 +38218,13 @@ async function create() {
|
|
|
38199
38218
|
const { project, entities } = await readProjectConfig(resolvedPath);
|
|
38200
38219
|
let finalAppUrl;
|
|
38201
38220
|
if (entities.length > 0) {
|
|
38202
|
-
|
|
38203
|
-
if (
|
|
38221
|
+
let shouldPushEntities;
|
|
38222
|
+
if (options.pushEntities !== void 0) shouldPushEntities = options.pushEntities;
|
|
38223
|
+
else {
|
|
38224
|
+
const result = await ye({ message: "Would you like to push entities now?" });
|
|
38225
|
+
shouldPushEntities = !pD(result) && result;
|
|
38226
|
+
}
|
|
38227
|
+
if (shouldPushEntities) await runTask(`Pushing ${entities.length} entities to Base44...`, async () => {
|
|
38204
38228
|
await pushEntities(entities);
|
|
38205
38229
|
}, {
|
|
38206
38230
|
successMessage: orange("Entities pushed successfully"),
|
|
@@ -38211,8 +38235,13 @@ async function create() {
|
|
|
38211
38235
|
const installCommand = project.site.installCommand;
|
|
38212
38236
|
const buildCommand = project.site.buildCommand;
|
|
38213
38237
|
const outputDirectory = project.site.outputDirectory;
|
|
38214
|
-
|
|
38215
|
-
if (
|
|
38238
|
+
let shouldDeploy;
|
|
38239
|
+
if (options.deploy !== void 0) shouldDeploy = options.deploy;
|
|
38240
|
+
else {
|
|
38241
|
+
const result = await ye({ message: "Would you like to deploy the site now?" });
|
|
38242
|
+
shouldDeploy = !pD(result) && result;
|
|
38243
|
+
}
|
|
38244
|
+
if (shouldDeploy && installCommand && buildCommand && outputDirectory) {
|
|
38216
38245
|
const { appUrl } = await runTask("Installing dependencies...", async (updateMessage) => {
|
|
38217
38246
|
await execa({
|
|
38218
38247
|
cwd: resolvedPath,
|
|
@@ -38238,8 +38267,8 @@ async function create() {
|
|
|
38238
38267
|
if (finalAppUrl) M.message(`${source_default.dim("Site")}: ${cyan(finalAppUrl)}`);
|
|
38239
38268
|
return { outroMessage: "Your project is set and ready to use" };
|
|
38240
38269
|
}
|
|
38241
|
-
const createCommand = new Command("create").description("Create a new Base44 project").action(async () => {
|
|
38242
|
-
await runCommand(create, {
|
|
38270
|
+
const createCommand = new Command("create").description("Create a new Base44 project").option("-t, --template <template>", "Template to use").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("--push-entities", "Automatically push entities after creation").option("--no-push-entities", "Skip pushing entities").option("--deploy", "Automatically deploy the site after creation").option("--no-deploy", "Skip deploying the site").action(async (options) => {
|
|
38271
|
+
await runCommand(() => create(options), {
|
|
38243
38272
|
fullBanner: true,
|
|
38244
38273
|
requireAuth: true
|
|
38245
38274
|
});
|
package/package.json
CHANGED