@base44-preview/cli 0.0.55-pr.545.7bded43 → 0.0.55-pr.545.c43f7fc
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 +20 -33
- 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:
|
|
257336
|
+
command: serveCommand,
|
|
257339
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,46 +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
257365
|
function localServerUrl(port) {
|
|
257365
257366
|
return `http://localhost:${port}`;
|
|
257366
257367
|
}
|
|
257367
|
-
async function writeEnvLocal(projectRoot, port, appId, log) {
|
|
257368
|
-
const envLocalPath = join28(projectRoot, ".env.local");
|
|
257369
|
-
await writeFile(envLocalPath, `VITE_BASE44_APP_ID=${appId}
|
|
257370
|
-
VITE_BASE44_APP_BASE_URL=${localServerUrl(port)}
|
|
257371
|
-
`);
|
|
257372
|
-
log.info("Wrote .env.local with app ID and dev server URL");
|
|
257373
|
-
}
|
|
257374
257368
|
async function devAction({ log }, options8) {
|
|
257375
257369
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257376
|
-
const
|
|
257377
|
-
|
|
257378
|
-
const appId = serveEnabled || options8.writeEnv ? (await initAppContext()).id : undefined;
|
|
257379
|
-
const { port: resolvedPort } = await createDevServer({
|
|
257370
|
+
const appId = (await initAppContext()).id;
|
|
257371
|
+
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
257380
257372
|
log,
|
|
257381
257373
|
port,
|
|
257374
|
+
appId,
|
|
257382
257375
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257383
|
-
serve: serveEnabled && appId ? { appId } : undefined,
|
|
257384
257376
|
loadResources: async () => {
|
|
257385
257377
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257386
|
-
projectRoot = project2.root;
|
|
257387
257378
|
return { functions, entities, project: project2 };
|
|
257388
257379
|
}
|
|
257389
257380
|
});
|
|
257390
|
-
|
|
257391
|
-
|
|
257392
|
-
}
|
|
257393
|
-
return {
|
|
257394
|
-
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257395
|
-
};
|
|
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 };
|
|
257396
257383
|
}
|
|
257397
257384
|
function getDevCommand() {
|
|
257398
|
-
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);
|
|
257399
257386
|
}
|
|
257400
257387
|
|
|
257401
257388
|
// src/core/exec/run-script.ts
|
|
@@ -261824,7 +261811,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
261824
261811
|
// src/cli/index.ts
|
|
261825
261812
|
var __dirname4 = dirname23(fileURLToPath6(import.meta.url));
|
|
261826
261813
|
async function runCLI(options8) {
|
|
261827
|
-
ensureNpmAssets(
|
|
261814
|
+
ensureNpmAssets(join28(__dirname4, "../assets"));
|
|
261828
261815
|
const errorReporter = new ErrorReporter;
|
|
261829
261816
|
errorReporter.registerProcessErrorHandlers();
|
|
261830
261817
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -261861,4 +261848,4 @@ export {
|
|
|
261861
261848
|
CLIExitError
|
|
261862
261849
|
};
|
|
261863
261850
|
|
|
261864
|
-
//# debugId=
|
|
261851
|
+
//# debugId=2CFE57D6B66EFC5C64756E2164756E21
|