@base44-preview/cli 0.0.33-pr.331.8d14c8e → 0.0.33-pr.331.c0ae606
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 +3 -8
- package/dist/cli/index.js +109 -127
- package/dist/cli/index.js.map +10 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,24 +46,19 @@ The CLI will guide you through project setup. For step-by-step tutorials, see th
|
|
|
46
46
|
| [`create`](https://docs.base44.com/developers/references/cli/commands/create) | Create a new Base44 project from a template |
|
|
47
47
|
| [`deploy`](https://docs.base44.com/developers/references/cli/commands/deploy) | Deploy resources and site to Base44 |
|
|
48
48
|
| [`link`](https://docs.base44.com/developers/references/cli/commands/link) | Link a local project to a project on Base44 |
|
|
49
|
-
| [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Download the code for an existing Base44 project |
|
|
50
49
|
| [`dashboard open`](https://docs.base44.com/developers/references/cli/commands/dashboard) | Open the app dashboard in your browser |
|
|
51
50
|
| [`login`](https://docs.base44.com/developers/references/cli/commands/login) | Authenticate with Base44 |
|
|
52
51
|
| [`logout`](https://docs.base44.com/developers/references/cli/commands/logout) | Sign out and clear stored credentials |
|
|
53
52
|
| [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
|
|
54
53
|
| [`agents pull`](https://docs.base44.com/developers/references/cli/commands/agents-pull) | Pull agents from Base44 to local files |
|
|
55
54
|
| [`agents push`](https://docs.base44.com/developers/references/cli/commands/agents-push) | Push local agents to Base44 |
|
|
56
|
-
| [`connectors pull`](https://docs.base44.com/developers/references/cli/commands/connectors-pull) | Pull connectors from Base44 to local files |
|
|
57
|
-
| [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
|
|
58
55
|
| [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entity schemas to Base44 |
|
|
59
|
-
| [`functions new`](https://docs.base44.com/developers/references/cli/commands/functions-new) | Create a new backend function from template |
|
|
60
56
|
| [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
|
|
61
|
-
| [`functions pull`](https://docs.base44.com/developers/references/cli/commands/functions-pull) | Pull deployed functions from Base44 to local files |
|
|
62
|
-
| [`functions list`](https://docs.base44.com/developers/references/cli/commands/functions-list) | List deployed backend functions |
|
|
63
|
-
| [`functions delete`](https://docs.base44.com/developers/references/cli/commands/functions-delete) | Delete a deployed backend function |
|
|
64
57
|
| [`site deploy`](https://docs.base44.com/developers/references/cli/commands/site-deploy) | Deploy built site files to Base44 hosting |
|
|
65
58
|
| [`site open`](https://docs.base44.com/developers/references/cli/commands/site-open) | Open the published site in your browser |
|
|
66
|
-
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<!--| [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Create a Base44 backend project from an existing Base44 app | -->
|
|
67
62
|
|
|
68
63
|
## AI agent skills
|
|
69
64
|
|
package/dist/cli/index.js
CHANGED
|
@@ -17446,7 +17446,7 @@ var require_lodash2 = __commonJS((exports, module) => {
|
|
|
17446
17446
|
}
|
|
17447
17447
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
17448
17448
|
});
|
|
17449
|
-
function
|
|
17449
|
+
function join14(array2, separator) {
|
|
17450
17450
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
17451
17451
|
}
|
|
17452
17452
|
function last(array2) {
|
|
@@ -19378,7 +19378,7 @@ __p += '`;
|
|
|
19378
19378
|
lodash.isUndefined = isUndefined;
|
|
19379
19379
|
lodash.isWeakMap = isWeakMap;
|
|
19380
19380
|
lodash.isWeakSet = isWeakSet;
|
|
19381
|
-
lodash.join =
|
|
19381
|
+
lodash.join = join14;
|
|
19382
19382
|
lodash.kebabCase = kebabCase2;
|
|
19383
19383
|
lodash.last = last;
|
|
19384
19384
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20007,7 +20007,7 @@ function cleanDoc(doc2) {
|
|
|
20007
20007
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20008
20008
|
}
|
|
20009
20009
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20010
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20010
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
20011
20011
|
`)) : currentDoc);
|
|
20012
20012
|
}
|
|
20013
20013
|
function canBreakFn(doc2) {
|
|
@@ -20087,7 +20087,7 @@ function indentIfBreak(contents, options) {
|
|
|
20087
20087
|
negate: options.negate
|
|
20088
20088
|
};
|
|
20089
20089
|
}
|
|
20090
|
-
function
|
|
20090
|
+
function join14(separator, docs) {
|
|
20091
20091
|
assertDoc(separator);
|
|
20092
20092
|
assertDocArray(docs);
|
|
20093
20093
|
const parts = [];
|
|
@@ -20798,7 +20798,7 @@ var init_doc = __esm(() => {
|
|
|
20798
20798
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
20799
20799
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
20800
20800
|
builders = {
|
|
20801
|
-
join:
|
|
20801
|
+
join: join14,
|
|
20802
20802
|
line,
|
|
20803
20803
|
softline,
|
|
20804
20804
|
hardline,
|
|
@@ -125712,7 +125712,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125712
125712
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
125713
125713
|
}
|
|
125714
125714
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
125715
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
125715
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join16(replacement, currentDoc.split(`
|
|
125716
125716
|
`)) : currentDoc);
|
|
125717
125717
|
}
|
|
125718
125718
|
function canBreakFn2(doc2) {
|
|
@@ -125798,7 +125798,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125798
125798
|
negate: options8.negate
|
|
125799
125799
|
};
|
|
125800
125800
|
}
|
|
125801
|
-
function
|
|
125801
|
+
function join16(separator, docs) {
|
|
125802
125802
|
assertDoc2(separator);
|
|
125803
125803
|
assertDocArray2(docs);
|
|
125804
125804
|
const parts = [];
|
|
@@ -126463,7 +126463,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126463
126463
|
}
|
|
126464
126464
|
}
|
|
126465
126465
|
var builders2 = {
|
|
126466
|
-
join:
|
|
126466
|
+
join: join16,
|
|
126467
126467
|
line: line3,
|
|
126468
126468
|
softline: softline2,
|
|
126469
126469
|
hardline: hardline4,
|
|
@@ -155678,10 +155678,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155678
155678
|
var debug = require_src4()("express:view");
|
|
155679
155679
|
var path18 = __require("node:path");
|
|
155680
155680
|
var fs28 = __require("node:fs");
|
|
155681
|
-
var
|
|
155681
|
+
var dirname12 = path18.dirname;
|
|
155682
155682
|
var basename4 = path18.basename;
|
|
155683
155683
|
var extname2 = path18.extname;
|
|
155684
|
-
var
|
|
155684
|
+
var join17 = path18.join;
|
|
155685
155685
|
var resolve5 = path18.resolve;
|
|
155686
155686
|
module.exports = View;
|
|
155687
155687
|
function View(name2, options8) {
|
|
@@ -155717,7 +155717,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155717
155717
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
155718
155718
|
var root2 = roots[i5];
|
|
155719
155719
|
var loc = resolve5(root2, name2);
|
|
155720
|
-
var dir =
|
|
155720
|
+
var dir = dirname12(loc);
|
|
155721
155721
|
var file2 = basename4(loc);
|
|
155722
155722
|
path19 = this.resolve(dir, file2);
|
|
155723
155723
|
}
|
|
@@ -155743,12 +155743,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155743
155743
|
};
|
|
155744
155744
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
155745
155745
|
var ext = this.ext;
|
|
155746
|
-
var path19 =
|
|
155746
|
+
var path19 = join17(dir, file2);
|
|
155747
155747
|
var stat2 = tryStat(path19);
|
|
155748
155748
|
if (stat2 && stat2.isFile()) {
|
|
155749
155749
|
return path19;
|
|
155750
155750
|
}
|
|
155751
|
-
path19 =
|
|
155751
|
+
path19 = join17(dir, basename4(file2, ext), "index" + ext);
|
|
155752
155752
|
stat2 = tryStat(path19);
|
|
155753
155753
|
if (stat2 && stat2.isFile()) {
|
|
155754
155754
|
return path19;
|
|
@@ -159443,7 +159443,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159443
159443
|
var Stream2 = __require("stream");
|
|
159444
159444
|
var util2 = __require("util");
|
|
159445
159445
|
var extname2 = path18.extname;
|
|
159446
|
-
var
|
|
159446
|
+
var join17 = path18.join;
|
|
159447
159447
|
var normalize = path18.normalize;
|
|
159448
159448
|
var resolve5 = path18.resolve;
|
|
159449
159449
|
var sep = path18.sep;
|
|
@@ -159615,7 +159615,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159615
159615
|
return res;
|
|
159616
159616
|
}
|
|
159617
159617
|
parts = path19.split(sep);
|
|
159618
|
-
path19 = normalize(
|
|
159618
|
+
path19 = normalize(join17(root2, path19));
|
|
159619
159619
|
} else {
|
|
159620
159620
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
159621
159621
|
debug('malicious path "%s"', path19);
|
|
@@ -159755,7 +159755,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159755
159755
|
return self2.onStatError(err);
|
|
159756
159756
|
return self2.error(404);
|
|
159757
159757
|
}
|
|
159758
|
-
var p4 =
|
|
159758
|
+
var p4 = join17(path19, self2._index[i5]);
|
|
159759
159759
|
debug('stat "%s"', p4);
|
|
159760
159760
|
fs28.stat(p4, function(err2, stat2) {
|
|
159761
159761
|
if (err2)
|
|
@@ -186013,8 +186013,7 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
186013
186013
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
186014
186014
|
});
|
|
186015
186015
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
|
-
status: exports_external.enum(["deployed", "unchanged"
|
|
186017
|
-
error: exports_external.string().optional().nullable(),
|
|
186016
|
+
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186018
186017
|
duration_ms: exports_external.number().optional().nullable()
|
|
186019
186018
|
});
|
|
186020
186019
|
var FunctionAutomationInfoSchema = exports_external.object({
|
|
@@ -186176,26 +186175,12 @@ async function deployOne(fn) {
|
|
|
186176
186175
|
async function pushFunctionsSingle(functions, options) {
|
|
186177
186176
|
if (functions.length === 0)
|
|
186178
186177
|
return [];
|
|
186179
|
-
const concurrency = options?.concurrency ?? 1;
|
|
186180
|
-
if (concurrency <= 1) {
|
|
186181
|
-
const results2 = [];
|
|
186182
|
-
for (const fn of functions) {
|
|
186183
|
-
options?.onStart?.([fn.name]);
|
|
186184
|
-
const result = await deployOne(fn);
|
|
186185
|
-
results2.push(result);
|
|
186186
|
-
options?.onResult?.(result);
|
|
186187
|
-
}
|
|
186188
|
-
return results2;
|
|
186189
|
-
}
|
|
186190
186178
|
const results = [];
|
|
186191
|
-
for (
|
|
186192
|
-
|
|
186193
|
-
|
|
186194
|
-
|
|
186195
|
-
|
|
186196
|
-
results.push(result);
|
|
186197
|
-
options?.onResult?.(result);
|
|
186198
|
-
}
|
|
186179
|
+
for (const fn of functions) {
|
|
186180
|
+
options?.onStart?.([fn.name]);
|
|
186181
|
+
const result = await deployOne(fn);
|
|
186182
|
+
results.push(result);
|
|
186183
|
+
options?.onResult?.(result);
|
|
186199
186184
|
}
|
|
186200
186185
|
return results;
|
|
186201
186186
|
}
|
|
@@ -195183,22 +195168,53 @@ function getEntitiesPushCommand(context) {
|
|
|
195183
195168
|
}
|
|
195184
195169
|
|
|
195185
195170
|
// src/cli/commands/functions/delete.ts
|
|
195186
|
-
|
|
195187
|
-
|
|
195188
|
-
|
|
195189
|
-
|
|
195190
|
-
|
|
195191
|
-
|
|
195192
|
-
|
|
195193
|
-
|
|
195194
|
-
|
|
195171
|
+
function parseNames(args) {
|
|
195172
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195173
|
+
}
|
|
195174
|
+
async function deleteFunctionsAction(names) {
|
|
195175
|
+
let deleted = 0;
|
|
195176
|
+
let notFound = 0;
|
|
195177
|
+
let errors4 = 0;
|
|
195178
|
+
for (const name2 of names) {
|
|
195179
|
+
try {
|
|
195180
|
+
await deleteSingleFunction(name2);
|
|
195181
|
+
R2.success(`${name2} deleted`);
|
|
195182
|
+
deleted++;
|
|
195183
|
+
} catch (error48) {
|
|
195184
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
195185
|
+
R2.warn(`Function "${name2}" not found on remote`);
|
|
195186
|
+
notFound++;
|
|
195187
|
+
} else {
|
|
195188
|
+
R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
195189
|
+
errors4++;
|
|
195190
|
+
}
|
|
195195
195191
|
}
|
|
195196
|
-
throw error48;
|
|
195197
195192
|
}
|
|
195193
|
+
if (names.length === 1) {
|
|
195194
|
+
if (deleted)
|
|
195195
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
195196
|
+
if (notFound)
|
|
195197
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
195198
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
195199
|
+
}
|
|
195200
|
+
const parts = [];
|
|
195201
|
+
if (deleted > 0)
|
|
195202
|
+
parts.push(`${deleted} deleted`);
|
|
195203
|
+
if (notFound > 0)
|
|
195204
|
+
parts.push(`${notFound} not found`);
|
|
195205
|
+
if (errors4 > 0)
|
|
195206
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
195207
|
+
return { outroMessage: parts.join(", ") };
|
|
195198
195208
|
}
|
|
195199
195209
|
function getDeleteCommand(context) {
|
|
195200
|
-
return new Command("delete").description("Delete
|
|
195201
|
-
await runCommand(() =>
|
|
195210
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
195211
|
+
await runCommand(() => {
|
|
195212
|
+
const names = parseNames(rawNames);
|
|
195213
|
+
if (names.length === 0) {
|
|
195214
|
+
throw new InvalidInputError("At least one function name is required");
|
|
195215
|
+
}
|
|
195216
|
+
return deleteFunctionsAction(names);
|
|
195217
|
+
}, { requireAuth: true }, context);
|
|
195202
195218
|
});
|
|
195203
195219
|
}
|
|
195204
195220
|
|
|
@@ -195217,13 +195233,25 @@ function formatResult(r) {
|
|
|
195217
195233
|
R2.error(`${label} error: ${r.error}`);
|
|
195218
195234
|
}
|
|
195219
195235
|
}
|
|
195220
|
-
|
|
195236
|
+
function parseNames2(args) {
|
|
195237
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195238
|
+
}
|
|
195239
|
+
async function deployFunctionsAction(names, options) {
|
|
195240
|
+
if (options.force && names.length > 0) {
|
|
195241
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195242
|
+
}
|
|
195221
195243
|
const { functions } = await readProjectConfig();
|
|
195222
|
-
|
|
195223
|
-
if (
|
|
195224
|
-
|
|
195225
|
-
|
|
195244
|
+
let toDeploy;
|
|
195245
|
+
if (names.length > 0) {
|
|
195246
|
+
const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
|
|
195247
|
+
if (notFound.length > 0) {
|
|
195248
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195226
195249
|
}
|
|
195250
|
+
toDeploy = functions.filter((f) => names.includes(f.name));
|
|
195251
|
+
} else {
|
|
195252
|
+
toDeploy = functions;
|
|
195253
|
+
}
|
|
195254
|
+
if (toDeploy.length === 0) {
|
|
195227
195255
|
return {
|
|
195228
195256
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
195229
195257
|
};
|
|
@@ -195232,9 +195260,8 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195232
195260
|
let completed = 0;
|
|
195233
195261
|
const total = toDeploy.length;
|
|
195234
195262
|
const results = await pushFunctionsSingle(toDeploy, {
|
|
195235
|
-
|
|
195236
|
-
|
|
195237
|
-
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195263
|
+
onStart: (startNames) => {
|
|
195264
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195238
195265
|
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195239
195266
|
},
|
|
195240
195267
|
onResult: (r) => {
|
|
@@ -195244,8 +195271,8 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195244
195271
|
});
|
|
195245
195272
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195246
195273
|
const failed = results.filter((r) => r.status === "error").length;
|
|
195247
|
-
if (options.
|
|
195248
|
-
R2.info("
|
|
195274
|
+
if (options.force) {
|
|
195275
|
+
R2.info("Removing remote functions not found locally...");
|
|
195249
195276
|
const allLocalNames = functions.map((f) => f.name);
|
|
195250
195277
|
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
195251
195278
|
for (const pr of pruneResults) {
|
|
@@ -195257,7 +195284,7 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195257
195284
|
}
|
|
195258
195285
|
if (pruneResults.length > 0) {
|
|
195259
195286
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195260
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""}
|
|
195287
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195261
195288
|
}
|
|
195262
195289
|
}
|
|
195263
195290
|
const parts = [];
|
|
@@ -195269,17 +195296,10 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195269
195296
|
return { outroMessage: summary };
|
|
195270
195297
|
}
|
|
195271
195298
|
function getDeployCommand(context) {
|
|
195272
|
-
return new Command("deploy").description("Deploy
|
|
195299
|
+
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
195273
195300
|
await runCommand(() => {
|
|
195274
|
-
|
|
195275
|
-
|
|
195276
|
-
const n2 = parseInt(options.concurrency, 10);
|
|
195277
|
-
if (Number.isNaN(n2) || n2 < 1) {
|
|
195278
|
-
throw new InvalidInputError("--concurrency must be a positive integer");
|
|
195279
|
-
}
|
|
195280
|
-
concurrency = n2;
|
|
195281
|
-
}
|
|
195282
|
-
return deployFunctionsAction(name2, { prune: options.prune, concurrency });
|
|
195301
|
+
const names = parseNames2(rawNames);
|
|
195302
|
+
return deployFunctionsAction(names, options);
|
|
195283
195303
|
}, { requireAuth: true }, context);
|
|
195284
195304
|
});
|
|
195285
195305
|
}
|
|
@@ -195300,55 +195320,17 @@ async function listFunctionsAction() {
|
|
|
195300
195320
|
};
|
|
195301
195321
|
}
|
|
195302
195322
|
function getListCommand(context) {
|
|
195303
|
-
return new Command("list").description("List deployed
|
|
195323
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
195304
195324
|
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
195305
195325
|
});
|
|
195306
195326
|
}
|
|
195307
195327
|
|
|
195308
|
-
// src/cli/commands/functions/new.ts
|
|
195309
|
-
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195310
|
-
var FUNCTION_TEMPLATE = `Deno.serve(async (req: Request) => {
|
|
195311
|
-
return new Response(JSON.stringify({ message: "Hello from {{name}}!" }), {
|
|
195312
|
-
headers: { "Content-Type": "application/json" },
|
|
195313
|
-
});
|
|
195314
|
-
});
|
|
195315
|
-
`;
|
|
195316
|
-
async function newFunctionAction(name2) {
|
|
195317
|
-
if (name2.includes(".")) {
|
|
195318
|
-
throw new InvalidInputError("Function name cannot contain dots");
|
|
195319
|
-
}
|
|
195320
|
-
const { project: project2, functions } = await readProjectConfig();
|
|
195321
|
-
if (functions.some((f) => f.name === name2)) {
|
|
195322
|
-
throw new InvalidInputError(`Function "${name2}" already exists in this project`);
|
|
195323
|
-
}
|
|
195324
|
-
const configDir = dirname9(project2.configPath);
|
|
195325
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195326
|
-
const functionDir = join12(functionsDir, name2);
|
|
195327
|
-
if (await pathExists(functionDir)) {
|
|
195328
|
-
throw new InvalidInputError(`Directory "${functionDir}" already exists`);
|
|
195329
|
-
}
|
|
195330
|
-
const configPath = join12(functionDir, "function.jsonc");
|
|
195331
|
-
const entryPath = join12(functionDir, "index.ts");
|
|
195332
|
-
await writeJsonFile(configPath, { name: name2, entry: "index.ts" });
|
|
195333
|
-
await writeFile(entryPath, FUNCTION_TEMPLATE.replace("{{name}}", name2));
|
|
195334
|
-
R2.success(`Created ${configPath}`);
|
|
195335
|
-
R2.success(`Created ${entryPath}`);
|
|
195336
|
-
return {
|
|
195337
|
-
outroMessage: `Function "${name2}" created. Deploy with: base44 functions deploy ${name2}`
|
|
195338
|
-
};
|
|
195339
|
-
}
|
|
195340
|
-
function getNewCommand(context) {
|
|
195341
|
-
return new Command("new").description("Create a new backend function from template").argument("<name>", "Name for the new function").action(async (name2) => {
|
|
195342
|
-
await runCommand(() => newFunctionAction(name2), { requireAuth: false }, context);
|
|
195343
|
-
});
|
|
195344
|
-
}
|
|
195345
|
-
|
|
195346
195328
|
// src/cli/commands/functions/pull.ts
|
|
195347
|
-
import { dirname as
|
|
195329
|
+
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195348
195330
|
async function pullFunctionsAction(name2) {
|
|
195349
195331
|
const { project: project2 } = await readProjectConfig();
|
|
195350
|
-
const configDir =
|
|
195351
|
-
const functionsDir =
|
|
195332
|
+
const configDir = dirname9(project2.configPath);
|
|
195333
|
+
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195352
195334
|
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
195353
195335
|
const { functions } = await listDeployedFunctions();
|
|
195354
195336
|
return functions;
|
|
@@ -195382,18 +195364,18 @@ async function pullFunctionsAction(name2) {
|
|
|
195382
195364
|
};
|
|
195383
195365
|
}
|
|
195384
195366
|
function getPullCommand(context) {
|
|
195385
|
-
return new Command("pull").description("Pull deployed functions from Base44
|
|
195367
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
195386
195368
|
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
195387
195369
|
});
|
|
195388
195370
|
}
|
|
195389
195371
|
|
|
195390
195372
|
// src/cli/commands/functions/index.ts
|
|
195391
195373
|
function getFunctionsCommand(context) {
|
|
195392
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
195374
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
195393
195375
|
}
|
|
195394
195376
|
|
|
195395
195377
|
// src/cli/commands/project/create.ts
|
|
195396
|
-
import { basename as basename3, join as
|
|
195378
|
+
import { basename as basename3, join as join13, resolve as resolve2 } from "node:path";
|
|
195397
195379
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
195398
195380
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
195399
195381
|
async function getTemplateById(templateId) {
|
|
@@ -195529,7 +195511,7 @@ async function executeCreate({
|
|
|
195529
195511
|
updateMessage("Building project...");
|
|
195530
195512
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
195531
195513
|
updateMessage("Deploying site...");
|
|
195532
|
-
return await deploySite(
|
|
195514
|
+
return await deploySite(join13(resolvedPath, outputDirectory));
|
|
195533
195515
|
}, {
|
|
195534
195516
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
195535
195517
|
errorMessage: "Failed to deploy site"
|
|
@@ -195930,10 +195912,10 @@ function toPascalCase(name2) {
|
|
|
195930
195912
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
195931
195913
|
}
|
|
195932
195914
|
// src/core/types/update-project.ts
|
|
195933
|
-
import { join as
|
|
195915
|
+
import { join as join16 } from "node:path";
|
|
195934
195916
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
195935
195917
|
async function updateProjectConfig(projectRoot) {
|
|
195936
|
-
const tsconfigPath =
|
|
195918
|
+
const tsconfigPath = join16(projectRoot, "tsconfig.json");
|
|
195937
195919
|
if (!await pathExists(tsconfigPath)) {
|
|
195938
195920
|
return false;
|
|
195939
195921
|
}
|
|
@@ -195976,7 +195958,7 @@ function getTypesCommand(context) {
|
|
|
195976
195958
|
}
|
|
195977
195959
|
|
|
195978
195960
|
// src/cli/commands/dev.ts
|
|
195979
|
-
import { dirname as
|
|
195961
|
+
import { dirname as dirname13, join as join18 } from "node:path";
|
|
195980
195962
|
|
|
195981
195963
|
// src/cli/dev/dev-server/main.ts
|
|
195982
195964
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -196124,10 +196106,10 @@ function createDevLogger() {
|
|
|
196124
196106
|
|
|
196125
196107
|
// src/cli/dev/dev-server/function-manager.ts
|
|
196126
196108
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
196127
|
-
import { dirname as
|
|
196109
|
+
import { dirname as dirname12, join as join17 } from "node:path";
|
|
196128
196110
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
196129
|
-
var __dirname5 =
|
|
196130
|
-
var WRAPPER_PATH =
|
|
196111
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
196112
|
+
var WRAPPER_PATH = join17(__dirname5, "../deno-runtime/main.js");
|
|
196131
196113
|
var READY_TIMEOUT = 30000;
|
|
196132
196114
|
|
|
196133
196115
|
class FunctionManager {
|
|
@@ -196379,8 +196361,8 @@ async function devAction(options8) {
|
|
|
196379
196361
|
port,
|
|
196380
196362
|
loadResources: async () => {
|
|
196381
196363
|
const { project: project2 } = await readProjectConfig();
|
|
196382
|
-
const configDir =
|
|
196383
|
-
const functions = await functionResource.readAll(
|
|
196364
|
+
const configDir = dirname13(project2.configPath);
|
|
196365
|
+
const functions = await functionResource.readAll(join18(configDir, project2.functionsDir));
|
|
196384
196366
|
return { functions };
|
|
196385
196367
|
}
|
|
196386
196368
|
});
|
|
@@ -196545,7 +196527,7 @@ function nanoid3(size = 21) {
|
|
|
196545
196527
|
}
|
|
196546
196528
|
|
|
196547
196529
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196548
|
-
import { dirname as
|
|
196530
|
+
import { dirname as dirname14, posix, sep } from "path";
|
|
196549
196531
|
function createModulerModifier() {
|
|
196550
196532
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196551
196533
|
return async (frames) => {
|
|
@@ -196554,7 +196536,7 @@ function createModulerModifier() {
|
|
|
196554
196536
|
return frames;
|
|
196555
196537
|
};
|
|
196556
196538
|
}
|
|
196557
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196539
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196558
196540
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196559
196541
|
return (filename) => {
|
|
196560
196542
|
if (!filename)
|
|
@@ -200771,4 +200753,4 @@ export {
|
|
|
200771
200753
|
CLIExitError
|
|
200772
200754
|
};
|
|
200773
200755
|
|
|
200774
|
-
//# debugId=
|
|
200756
|
+
//# debugId=B41FE485BE98CA0764756E2164756E21
|