@base44-preview/cli 0.0.55-pr.545.63956fa → 0.0.55-pr.545.cb11f3a
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 +12 -44
- 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);
|
|
@@ -257356,66 +257353,37 @@ async function createDevServer(options8) {
|
|
|
257356
257353
|
serveRunner?.onExit(() => {
|
|
257357
257354
|
shutdown().finally(() => process.exit(1));
|
|
257358
257355
|
});
|
|
257359
|
-
serveRunner
|
|
257356
|
+
if (serveRunner) {
|
|
257357
|
+
devLogger.log(`Backend running on ${baseUrl}`);
|
|
257358
|
+
serveRunner.start();
|
|
257359
|
+
}
|
|
257360
257360
|
return { port, server };
|
|
257361
257361
|
}
|
|
257362
257362
|
|
|
257363
257363
|
// 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
257364
|
function localServerUrl(port) {
|
|
257367
257365
|
return `http://localhost:${port}`;
|
|
257368
257366
|
}
|
|
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
257367
|
async function devAction({ log }, options8) {
|
|
257395
257368
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257396
|
-
const serveEnabled = options8.serve !== false;
|
|
257397
257369
|
const { project: project2 } = await readProjectConfig();
|
|
257398
257370
|
const serveCommand = project2.site?.serveCommand;
|
|
257399
|
-
const appId =
|
|
257371
|
+
const appId = serveCommand ? (await initAppContext()).id : undefined;
|
|
257400
257372
|
const { port: resolvedPort } = await createDevServer({
|
|
257401
257373
|
log,
|
|
257402
257374
|
port,
|
|
257403
257375
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257404
|
-
serve:
|
|
257376
|
+
serve: serveCommand && appId ? { command: serveCommand, cwd: project2.root, appId } : undefined,
|
|
257405
257377
|
loadResources: async () => {
|
|
257406
257378
|
const { functions, entities, project: project3 } = await readProjectConfig();
|
|
257407
257379
|
return { functions, entities, project: project3 };
|
|
257408
257380
|
}
|
|
257409
257381
|
});
|
|
257410
|
-
|
|
257411
|
-
|
|
257412
|
-
}
|
|
257413
|
-
return {
|
|
257414
|
-
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257415
|
-
};
|
|
257382
|
+
const outroMessage = serveCommand ? "Open your app at the URL printed by the frontend dev server (tagged [frontend] above)." : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
257383
|
+
return { outroMessage };
|
|
257416
257384
|
}
|
|
257417
257385
|
function getDevCommand() {
|
|
257418
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").
|
|
257386
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(devAction);
|
|
257419
257387
|
}
|
|
257420
257388
|
|
|
257421
257389
|
// src/core/exec/run-script.ts
|
|
@@ -261844,7 +261812,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
261844
261812
|
// src/cli/index.ts
|
|
261845
261813
|
var __dirname4 = dirname23(fileURLToPath6(import.meta.url));
|
|
261846
261814
|
async function runCLI(options8) {
|
|
261847
|
-
ensureNpmAssets(
|
|
261815
|
+
ensureNpmAssets(join28(__dirname4, "../assets"));
|
|
261848
261816
|
const errorReporter = new ErrorReporter;
|
|
261849
261817
|
errorReporter.registerProcessErrorHandlers();
|
|
261850
261818
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -261881,4 +261849,4 @@ export {
|
|
|
261881
261849
|
CLIExitError
|
|
261882
261850
|
};
|
|
261883
261851
|
|
|
261884
|
-
//# debugId=
|
|
261852
|
+
//# debugId=C52B3632157F5F1264756E2164756E21
|