@base44-preview/cli 0.0.55-pr.541.4fb2c55 → 0.0.55-pr.541.978e800
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 +15 -10
- package/dist/cli/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -257320,20 +257320,28 @@ async function createDevServer(options8) {
|
|
|
257320
257320
|
function localServerUrl(port) {
|
|
257321
257321
|
return `http://localhost:${port}`;
|
|
257322
257322
|
}
|
|
257323
|
-
async function writeEnvLocalIfMissing(projectRoot, port, log) {
|
|
257323
|
+
async function writeEnvLocalIfMissing(projectRoot, appId, port, log) {
|
|
257324
257324
|
const envLocalPath = join28(projectRoot, ".env.local");
|
|
257325
257325
|
if (await pathExists(envLocalPath)) {
|
|
257326
257326
|
return;
|
|
257327
257327
|
}
|
|
257328
|
-
const { id: appId } = await initAppContext();
|
|
257329
257328
|
await writeFile(envLocalPath, `VITE_BASE44_APP_ID=${appId}
|
|
257330
257329
|
VITE_BASE44_APP_BASE_URL=${localServerUrl(port)}
|
|
257331
257330
|
`);
|
|
257332
257331
|
log.info("Created .env.local with app ID and dev server URL");
|
|
257333
257332
|
}
|
|
257334
|
-
|
|
257333
|
+
function validateDevOptions(command2) {
|
|
257334
|
+
const { appId } = command2.optsWithGlobals();
|
|
257335
|
+
if (appId !== undefined) {
|
|
257336
|
+
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
257337
|
+
}
|
|
257338
|
+
}
|
|
257339
|
+
async function devAction(ctx, options8) {
|
|
257340
|
+
const { log, app } = ctx;
|
|
257341
|
+
if (!app?.projectRoot) {
|
|
257342
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
257343
|
+
}
|
|
257335
257344
|
const port = options8.port ? Number(options8.port) : undefined;
|
|
257336
|
-
let projectRoot;
|
|
257337
257345
|
const { port: resolvedPort } = await createDevServer({
|
|
257338
257346
|
log,
|
|
257339
257347
|
port,
|
|
@@ -257341,19 +257349,16 @@ async function devAction({ log }, options8) {
|
|
|
257341
257349
|
denoWrapperPath: getDenoWrapperPath(),
|
|
257342
257350
|
loadResources: async () => {
|
|
257343
257351
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
257344
|
-
projectRoot = project2.root;
|
|
257345
257352
|
return { functions, entities, project: project2 };
|
|
257346
257353
|
}
|
|
257347
257354
|
});
|
|
257348
|
-
|
|
257349
|
-
await writeEnvLocalIfMissing(projectRoot, resolvedPort, log);
|
|
257350
|
-
}
|
|
257355
|
+
await writeEnvLocalIfMissing(app.projectRoot, app.id, resolvedPort, log);
|
|
257351
257356
|
return {
|
|
257352
257357
|
outroMessage: `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`
|
|
257353
257358
|
};
|
|
257354
257359
|
}
|
|
257355
257360
|
function getDevCommand() {
|
|
257356
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(devAction);
|
|
257361
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
257357
257362
|
}
|
|
257358
257363
|
|
|
257359
257364
|
// src/core/exec/run-script.ts
|
|
@@ -261832,4 +261837,4 @@ export {
|
|
|
261832
261837
|
CLIExitError
|
|
261833
261838
|
};
|
|
261834
261839
|
|
|
261835
|
-
//# debugId=
|
|
261840
|
+
//# debugId=B0FEAA93C496D63064756E2164756E21
|