@base44-preview/cli 0.0.55-pr.545.63956fa → 0.0.55-pr.545.a5700a7
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 +23 -56
- package/dist/cli/index.js.map +5 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -234017,7 +234017,7 @@ function normalizeBase44Env() {
|
|
|
234017
234017
|
loadProjectEnvFiles();
|
|
234018
234018
|
|
|
234019
234019
|
// src/cli/index.ts
|
|
234020
|
-
import { dirname as dirname23, join as
|
|
234020
|
+
import { dirname as dirname23, join as join28 } from "node:path";
|
|
234021
234021
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
234022
234022
|
|
|
234023
234023
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -253896,9 +253896,6 @@ function getTypesCommand() {
|
|
|
253896
253896
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
253897
253897
|
}
|
|
253898
253898
|
|
|
253899
|
-
// src/cli/commands/dev.ts
|
|
253900
|
-
import { join as join28 } from "node:path";
|
|
253901
|
-
|
|
253902
253899
|
// src/cli/dev/dev-server/main.ts
|
|
253903
253900
|
var import_cors = __toESM(require_lib4(), 1);
|
|
253904
253901
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -257239,12 +257236,12 @@ async function createDevServer(options8) {
|
|
|
257239
257236
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
257240
257237
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
257241
257238
|
if (functionManager.getFunctionNames().length > 0) {
|
|
257242
|
-
|
|
257239
|
+
devLogger.log(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
|
|
257243
257240
|
}
|
|
257244
257241
|
const db2 = new Database;
|
|
257245
257242
|
await db2.load(entities);
|
|
257246
257243
|
if (db2.getCollectionNames().length > 0) {
|
|
257247
|
-
|
|
257244
|
+
devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
257248
257245
|
}
|
|
257249
257246
|
let emitEntityEvent = () => {};
|
|
257250
257247
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
@@ -257332,13 +257329,14 @@ async function createDevServer(options8) {
|
|
|
257332
257329
|
}
|
|
257333
257330
|
});
|
|
257334
257331
|
await base44ConfigWatcher.start();
|
|
257332
|
+
const serveCommand = project2.site?.serveCommand;
|
|
257335
257333
|
let serveRunner;
|
|
257336
|
-
if (options8.
|
|
257334
|
+
if (options8.appId && serveCommand) {
|
|
257337
257335
|
serveRunner = new ServeRunner({
|
|
257338
|
-
command:
|
|
257339
|
-
cwd:
|
|
257336
|
+
command: serveCommand,
|
|
257337
|
+
cwd: project2.root,
|
|
257340
257338
|
env: {
|
|
257341
|
-
VITE_BASE44_APP_ID: options8.
|
|
257339
|
+
VITE_BASE44_APP_ID: options8.appId,
|
|
257342
257340
|
VITE_BASE44_APP_BASE_URL: baseUrl
|
|
257343
257341
|
},
|
|
257344
257342
|
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
@@ -257356,66 +257354,35 @@ async function createDevServer(options8) {
|
|
|
257356
257354
|
serveRunner?.onExit(() => {
|
|
257357
257355
|
shutdown().finally(() => process.exit(1));
|
|
257358
257356
|
});
|
|
257359
|
-
serveRunner
|
|
257360
|
-
|
|
257357
|
+
if (serveRunner) {
|
|
257358
|
+
devLogger.log(`Backend running on ${baseUrl}`);
|
|
257359
|
+
serveRunner.start();
|
|
257360
|
+
}
|
|
257361
|
+
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
257361
257362
|
}
|
|
257362
257363
|
|
|
257363
257364
|
// src/cli/commands/dev.ts
|
|
257364
|
-
var ENV_HEADER = "# Edited by the base44 dev process";
|
|
257365
|
-
var MANAGED_ENV_KEYS = ["VITE_BASE44_APP_ID", "VITE_BASE44_APP_BASE_URL"];
|
|
257366
257365
|
function localServerUrl(port) {
|
|
257367
257366
|
return `http://localhost:${port}`;
|
|
257368
257367
|
}
|
|
257369
|
-
async function writeEnvLocal(projectRoot, port, appId, log) {
|
|
257370
|
-
const envLocalPath = join28(projectRoot, ".env.local");
|
|
257371
|
-
const managed = [
|
|
257372
|
-
`VITE_BASE44_APP_ID=${appId}`,
|
|
257373
|
-
`VITE_BASE44_APP_BASE_URL=${localServerUrl(port)}`
|
|
257374
|
-
];
|
|
257375
|
-
let preserved = "";
|
|
257376
|
-
if (await pathExists(envLocalPath)) {
|
|
257377
|
-
const existing = await readTextFile(envLocalPath);
|
|
257378
|
-
preserved = existing.split(`
|
|
257379
|
-
`).map((line3) => {
|
|
257380
|
-
const key2 = line3.match(/^\s*(\w+)\s*=/)?.[1];
|
|
257381
|
-
return key2 && MANAGED_ENV_KEYS.includes(key2) ? `# ${line3}` : line3;
|
|
257382
|
-
}).join(`
|
|
257383
|
-
`).trimEnd();
|
|
257384
|
-
}
|
|
257385
|
-
const block = `${ENV_HEADER}
|
|
257386
|
-
${managed.join(`
|
|
257387
|
-
`)}
|
|
257388
|
-
`;
|
|
257389
|
-
await writeFile(envLocalPath, preserved ? `${preserved}
|
|
257390
|
-
|
|
257391
|
-
${block}` : block);
|
|
257392
|
-
log.info("Wrote .env.local with app ID and dev server URL");
|
|
257393
|
-
}
|
|
257394
257368
|
async function devAction({ log }, options8) {
|
|
257395
257369
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257396
|
-
const
|
|
257397
|
-
const {
|
|
257398
|
-
const serveCommand = project2.site?.serveCommand;
|
|
257399
|
-
const appId = serveEnabled || options8.writeEnv ? (await initAppContext()).id : undefined;
|
|
257400
|
-
const { port: resolvedPort } = await createDevServer({
|
|
257370
|
+
const appId = (await initAppContext()).id;
|
|
257371
|
+
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
257401
257372
|
log,
|
|
257402
257373
|
port,
|
|
257374
|
+
appId,
|
|
257403
257375
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257404
|
-
serve: serveEnabled && serveCommand && appId ? { command: serveCommand, cwd: project2.root, appId } : undefined,
|
|
257405
257376
|
loadResources: async () => {
|
|
257406
|
-
const { functions, entities, project:
|
|
257407
|
-
return { functions, entities, project:
|
|
257377
|
+
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257378
|
+
return { functions, entities, project: project2 };
|
|
257408
257379
|
}
|
|
257409
257380
|
});
|
|
257410
|
-
|
|
257411
|
-
|
|
257412
|
-
}
|
|
257413
|
-
return {
|
|
257414
|
-
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257415
|
-
};
|
|
257381
|
+
const outroMessage = isServingFrontend ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
257382
|
+
return { outroMessage };
|
|
257416
257383
|
}
|
|
257417
257384
|
function getDevCommand() {
|
|
257418
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").
|
|
257385
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(devAction);
|
|
257419
257386
|
}
|
|
257420
257387
|
|
|
257421
257388
|
// src/core/exec/run-script.ts
|
|
@@ -261844,7 +261811,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
261844
261811
|
// src/cli/index.ts
|
|
261845
261812
|
var __dirname4 = dirname23(fileURLToPath6(import.meta.url));
|
|
261846
261813
|
async function runCLI(options8) {
|
|
261847
|
-
ensureNpmAssets(
|
|
261814
|
+
ensureNpmAssets(join28(__dirname4, "../assets"));
|
|
261848
261815
|
const errorReporter = new ErrorReporter;
|
|
261849
261816
|
errorReporter.registerProcessErrorHandlers();
|
|
261850
261817
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -261881,4 +261848,4 @@ export {
|
|
|
261881
261848
|
CLIExitError
|
|
261882
261849
|
};
|
|
261883
261850
|
|
|
261884
|
-
//# debugId=
|
|
261851
|
+
//# debugId=2CFE57D6B66EFC5C64756E2164756E21
|