@base44-preview/cli 0.0.15-pr.97.e56bc81 → 0.0.15-pr.98.72adf3c
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 +11 -123
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4547,7 +4547,6 @@ const string$1 = (params) => {
|
|
|
4547
4547
|
};
|
|
4548
4548
|
const integer = /^-?\d+$/;
|
|
4549
4549
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
4550
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
4551
4550
|
const lowercase = /^[^A-Z]*$/;
|
|
4552
4551
|
const uppercase = /^[^a-z]*$/;
|
|
4553
4552
|
|
|
@@ -5326,24 +5325,6 @@ const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst,
|
|
|
5326
5325
|
$ZodCheckNumberFormat.init(inst, def);
|
|
5327
5326
|
$ZodNumber.init(inst, def);
|
|
5328
5327
|
});
|
|
5329
|
-
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
5330
|
-
$ZodType.init(inst, def);
|
|
5331
|
-
inst._zod.pattern = boolean$1;
|
|
5332
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5333
|
-
if (def.coerce) try {
|
|
5334
|
-
payload.value = Boolean(payload.value);
|
|
5335
|
-
} catch (_$2) {}
|
|
5336
|
-
const input = payload.value;
|
|
5337
|
-
if (typeof input === "boolean") return payload;
|
|
5338
|
-
payload.issues.push({
|
|
5339
|
-
expected: "boolean",
|
|
5340
|
-
code: "invalid_type",
|
|
5341
|
-
input,
|
|
5342
|
-
inst
|
|
5343
|
-
});
|
|
5344
|
-
return payload;
|
|
5345
|
-
};
|
|
5346
|
-
});
|
|
5347
5328
|
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
5348
5329
|
$ZodType.init(inst, def);
|
|
5349
5330
|
inst._zod.parse = (payload) => payload;
|
|
@@ -6398,13 +6379,6 @@ function _int(Class, params) {
|
|
|
6398
6379
|
});
|
|
6399
6380
|
}
|
|
6400
6381
|
/* @__NO_SIDE_EFFECTS__ */
|
|
6401
|
-
function _boolean(Class, params) {
|
|
6402
|
-
return new Class({
|
|
6403
|
-
type: "boolean",
|
|
6404
|
-
...normalizeParams(params)
|
|
6405
|
-
});
|
|
6406
|
-
}
|
|
6407
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
6408
6382
|
function _unknown(Class) {
|
|
6409
6383
|
return new Class({ type: "unknown" });
|
|
6410
6384
|
}
|
|
@@ -6975,9 +6949,6 @@ const numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
6975
6949
|
}
|
|
6976
6950
|
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
6977
6951
|
};
|
|
6978
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
6979
|
-
json.type = "boolean";
|
|
6980
|
-
};
|
|
6981
6952
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
6982
6953
|
json.not = {};
|
|
6983
6954
|
};
|
|
@@ -7501,14 +7472,6 @@ const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, d
|
|
|
7501
7472
|
function int(params) {
|
|
7502
7473
|
return _int(ZodNumberFormat, params);
|
|
7503
7474
|
}
|
|
7504
|
-
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
7505
|
-
$ZodBoolean.init(inst, def);
|
|
7506
|
-
ZodType.init(inst, def);
|
|
7507
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
7508
|
-
});
|
|
7509
|
-
function boolean(params) {
|
|
7510
|
-
return _boolean(ZodBoolean, params);
|
|
7511
|
-
}
|
|
7512
7475
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
7513
7476
|
$ZodUnknown.init(inst, def);
|
|
7514
7477
|
ZodType.init(inst, def);
|
|
@@ -16706,12 +16669,6 @@ const ProjectConfigSchema = object({
|
|
|
16706
16669
|
});
|
|
16707
16670
|
const AppConfigSchema = object({ id: string().min(1, "id cannot be empty") });
|
|
16708
16671
|
const CreateProjectResponseSchema = looseObject({ id: string() });
|
|
16709
|
-
const AppSchema = looseObject({
|
|
16710
|
-
id: string(),
|
|
16711
|
-
name: string(),
|
|
16712
|
-
has_source_code: boolean()
|
|
16713
|
-
});
|
|
16714
|
-
const AppsResponseSchema = array(AppSchema);
|
|
16715
16672
|
|
|
16716
16673
|
//#endregion
|
|
16717
16674
|
//#region src/core/project/config.ts
|
|
@@ -16796,13 +16753,6 @@ async function createProject(projectName, description) {
|
|
|
16796
16753
|
} });
|
|
16797
16754
|
return { projectId: CreateProjectResponseSchema.parse(await response.json()).id };
|
|
16798
16755
|
}
|
|
16799
|
-
async function fetchApps() {
|
|
16800
|
-
const response = await base44Client.get("api/apps");
|
|
16801
|
-
return AppsResponseSchema.parse(await response.json());
|
|
16802
|
-
}
|
|
16803
|
-
async function fetchLinkableApps() {
|
|
16804
|
-
return (await fetchApps()).filter((app) => !app.has_source_code);
|
|
16805
|
-
}
|
|
16806
16756
|
|
|
16807
16757
|
//#endregion
|
|
16808
16758
|
//#region node_modules/ejs/lib/utils.js
|
|
@@ -38756,33 +38706,20 @@ const deployCommand = new Command("deploy").description("Deploy all project reso
|
|
|
38756
38706
|
//#endregion
|
|
38757
38707
|
//#region src/cli/commands/project/link.ts
|
|
38758
38708
|
function validateNonInteractiveFlags(command) {
|
|
38759
|
-
const { create: create$1,
|
|
38760
|
-
if (create$1 && existing) command.error("--create and --existing cannot be used together");
|
|
38709
|
+
const { create: create$1, name: name$1 } = command.opts();
|
|
38761
38710
|
if (create$1 && !name$1) command.error("--name is required when using --create");
|
|
38762
38711
|
}
|
|
38763
|
-
async function
|
|
38712
|
+
async function promptForProjectDetails() {
|
|
38764
38713
|
const actionOptions = [{
|
|
38765
38714
|
value: "create",
|
|
38766
38715
|
label: "Create a new project",
|
|
38767
38716
|
hint: "Create a new Base44 project and link it"
|
|
38768
38717
|
}];
|
|
38769
|
-
if (linkableApps.length > 0) actionOptions.push({
|
|
38770
|
-
value: "choose",
|
|
38771
|
-
label: "Link an existing project",
|
|
38772
|
-
hint: `Choose from ${linkableApps.length} available project${linkableApps.length === 1 ? "" : "s"}`
|
|
38773
|
-
});
|
|
38774
|
-
const action = await ve({
|
|
38775
|
-
message: "How would you like to link this project?",
|
|
38776
|
-
options: actionOptions
|
|
38777
|
-
});
|
|
38778
|
-
if (pD(action)) {
|
|
38779
|
-
xe("Operation cancelled.");
|
|
38780
|
-
process.exit(0);
|
|
38781
|
-
}
|
|
38782
|
-
return action;
|
|
38783
|
-
}
|
|
38784
|
-
async function promptForNewProjectDetails() {
|
|
38785
38718
|
const result = await Ce({
|
|
38719
|
+
action: () => ve({
|
|
38720
|
+
message: "How would you like to link this project?",
|
|
38721
|
+
options: actionOptions
|
|
38722
|
+
}),
|
|
38786
38723
|
name: () => {
|
|
38787
38724
|
return he({
|
|
38788
38725
|
message: "What is the name of your project?",
|
|
@@ -38802,63 +38739,14 @@ async function promptForNewProjectDetails() {
|
|
|
38802
38739
|
description: result.description ? result.description.trim() : void 0
|
|
38803
38740
|
};
|
|
38804
38741
|
}
|
|
38805
|
-
async function promptForExistingApp(linkableApps) {
|
|
38806
|
-
const selectedApp = await ve({
|
|
38807
|
-
message: "Choose a project to link",
|
|
38808
|
-
options: linkableApps.map((app) => ({
|
|
38809
|
-
value: app,
|
|
38810
|
-
label: app.name
|
|
38811
|
-
}))
|
|
38812
|
-
});
|
|
38813
|
-
if (pD(selectedApp)) {
|
|
38814
|
-
xe("Operation cancelled.");
|
|
38815
|
-
process.exit(0);
|
|
38816
|
-
}
|
|
38817
|
-
return selectedApp;
|
|
38818
|
-
}
|
|
38819
38742
|
async function link(options) {
|
|
38820
38743
|
const projectRoot = await findProjectRoot();
|
|
38821
38744
|
if (!projectRoot) throw new Error("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
|
|
38822
38745
|
if (await appConfigExists(projectRoot.root)) throw new Error("Project is already linked. An .app.jsonc file with the appId already exists.");
|
|
38823
|
-
|
|
38824
|
-
|
|
38825
|
-
|
|
38826
|
-
|
|
38827
|
-
projectRoot: projectRoot.root
|
|
38828
|
-
});
|
|
38829
|
-
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(options.existing))}`);
|
|
38830
|
-
return { outroMessage: "Project linked" };
|
|
38831
|
-
}
|
|
38832
|
-
if (options.create) {
|
|
38833
|
-
const { projectId: projectId$1 } = await runTask("Creating project on Base44...", async () => {
|
|
38834
|
-
return await createProject(options.name.trim(), options.description?.trim());
|
|
38835
|
-
}, {
|
|
38836
|
-
successMessage: "Project created successfully",
|
|
38837
|
-
errorMessage: "Failed to create project"
|
|
38838
|
-
});
|
|
38839
|
-
await writeAppConfig(projectRoot.root, projectId$1);
|
|
38840
|
-
setAppConfig({
|
|
38841
|
-
id: projectId$1,
|
|
38842
|
-
projectRoot: projectRoot.root
|
|
38843
|
-
});
|
|
38844
|
-
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId$1))}`);
|
|
38845
|
-
return { outroMessage: "Project linked" };
|
|
38846
|
-
}
|
|
38847
|
-
const linkableApps = await runTask("Fetching your projects...", async () => fetchLinkableApps(), {
|
|
38848
|
-
successMessage: `Found ${theme.colors.base44Orange("projects")} available for linking`,
|
|
38849
|
-
errorMessage: "Failed to fetch projects"
|
|
38850
|
-
});
|
|
38851
|
-
if (await promptForLinkAction(linkableApps) === "choose") {
|
|
38852
|
-
const selectedApp = await promptForExistingApp(linkableApps);
|
|
38853
|
-
await writeAppConfig(projectRoot.root, selectedApp.id);
|
|
38854
|
-
setAppConfig({
|
|
38855
|
-
id: selectedApp.id,
|
|
38856
|
-
projectRoot: projectRoot.root
|
|
38857
|
-
});
|
|
38858
|
-
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(selectedApp.id))}`);
|
|
38859
|
-
return { outroMessage: "Project linked" };
|
|
38860
|
-
}
|
|
38861
|
-
const { name: name$1, description } = await promptForNewProjectDetails();
|
|
38746
|
+
const { name: name$1, description } = options.create ? {
|
|
38747
|
+
name: options.name.trim(),
|
|
38748
|
+
description: options.description?.trim()
|
|
38749
|
+
} : await promptForProjectDetails();
|
|
38862
38750
|
const { projectId } = await runTask("Creating project on Base44...", async () => {
|
|
38863
38751
|
return await createProject(name$1, description);
|
|
38864
38752
|
}, {
|
|
@@ -38873,7 +38761,7 @@ async function link(options) {
|
|
|
38873
38761
|
M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
|
|
38874
38762
|
return { outroMessage: "Project linked" };
|
|
38875
38763
|
}
|
|
38876
|
-
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("-
|
|
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) => {
|
|
38877
38765
|
await runCommand(() => link(options), {
|
|
38878
38766
|
requireAuth: true,
|
|
38879
38767
|
requireAppConfig: false
|
package/package.json
CHANGED