@base44-preview/cli 0.1.16-pr.635.0ca7e05 → 0.1.16-pr.635.6b1b04b
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 +37 -68
- package/dist/cli/index.js.map +9 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -230705,11 +230705,11 @@ var TemplatesConfigSchema = object({
|
|
|
230705
230705
|
templates: array(TemplateSchema)
|
|
230706
230706
|
});
|
|
230707
230707
|
var SiteConfigSchema = object({
|
|
230708
|
-
buildCommand: string2().default("npm run build"),
|
|
230708
|
+
buildCommand: string2().optional().default("npm run build"),
|
|
230709
230709
|
serveCommand: string2().optional(),
|
|
230710
|
-
outputDirectory: string2().optional(),
|
|
230711
|
-
installCommand: string2().default("npm install"),
|
|
230712
|
-
devHostFlag: string2().optional()
|
|
230710
|
+
outputDirectory: string2().optional().default("./dist"),
|
|
230711
|
+
installCommand: string2().optional().default("npm install"),
|
|
230712
|
+
devHostFlag: string2().optional().default("--host")
|
|
230713
230713
|
});
|
|
230714
230714
|
var PluginMetadataSchema = object({
|
|
230715
230715
|
namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
@@ -246682,39 +246682,19 @@ async function gitHead(projectRoot) {
|
|
|
246682
246682
|
}
|
|
246683
246683
|
// src/core/site/serve-command.ts
|
|
246684
246684
|
var DEFAULT_SERVE_COMMAND = "npm run dev";
|
|
246685
|
-
var
|
|
246686
|
-
var SCRIPT = "[A-Za-z0-9:_.-]+";
|
|
246687
|
-
var PREFIX2 = "[A-Za-z0-9._/-]+";
|
|
246688
|
-
var SCRIPT_RUNNERS = [
|
|
246689
|
-
{
|
|
246690
|
-
pattern: new RegExp(String.raw`^npm(\s+--prefix\s+${PREFIX2})?\s+run\s+${SCRIPT}$`),
|
|
246691
|
-
separator: " -- "
|
|
246692
|
-
},
|
|
246693
|
-
{
|
|
246694
|
-
pattern: new RegExp(String.raw`^(?:pnpm|yarn|bun)(\s+run)?\s+${SCRIPT}$`),
|
|
246695
|
-
separator: " "
|
|
246696
|
-
}
|
|
246697
|
-
];
|
|
246698
|
-
function runnerFor(serveCommand) {
|
|
246699
|
-
return SCRIPT_RUNNERS.find((runner) => runner.pattern.test(serveCommand));
|
|
246700
|
-
}
|
|
246685
|
+
var NPM_RUN_COMMAND = /^npm(\s+--prefix\s+\S+)?\s+run\s+\S+$/;
|
|
246701
246686
|
function withServeAddress(serveCommand, { host, port, hostFlag }) {
|
|
246702
|
-
const command = serveCommand.trim();
|
|
246703
246687
|
const args = [
|
|
246704
|
-
...host ? [hostFlag
|
|
246688
|
+
...host ? [hostFlag, host] : [],
|
|
246705
246689
|
...port === undefined ? [] : ["--port", String(port)]
|
|
246706
246690
|
];
|
|
246707
|
-
if (args.length === 0) {
|
|
246708
|
-
return
|
|
246691
|
+
if (args.length === 0 || !NPM_RUN_COMMAND.test(serveCommand.trim())) {
|
|
246692
|
+
return serveCommand;
|
|
246709
246693
|
}
|
|
246710
|
-
|
|
246711
|
-
|
|
246712
|
-
|
|
246713
|
-
|
|
246714
|
-
return {
|
|
246715
|
-
command: `${command}${runner.separator}${args.join(" ")}`,
|
|
246716
|
-
droppedAddress: false
|
|
246717
|
-
};
|
|
246694
|
+
return `${serveCommand} -- ${args.join(" ")}`;
|
|
246695
|
+
}
|
|
246696
|
+
function forwardsServeAddress(serveCommand) {
|
|
246697
|
+
return NPM_RUN_COMMAND.test(serveCommand.trim());
|
|
246718
246698
|
}
|
|
246719
246699
|
// src/core/project/deploy.ts
|
|
246720
246700
|
function hasResourcesToDeploy(projectData) {
|
|
@@ -246728,7 +246708,7 @@ function hasResourcesToDeploy(projectData) {
|
|
|
246728
246708
|
connectors,
|
|
246729
246709
|
authConfig
|
|
246730
246710
|
} = projectData;
|
|
246731
|
-
const hasSite =
|
|
246711
|
+
const hasSite = project.site !== undefined;
|
|
246732
246712
|
const hasEntities = entities.length > 0;
|
|
246733
246713
|
const hasFunctions = functions.length > 0;
|
|
246734
246714
|
const hasActors = actors.length > 0;
|
|
@@ -251087,7 +251067,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251087
251067
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
251088
251068
|
hints: [
|
|
251089
251069
|
{
|
|
251090
|
-
message: `Add 'site
|
|
251070
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "outputDirectory": "dist" }). Inside one, outputDirectory defaults to "./dist".`
|
|
251091
251071
|
}
|
|
251092
251072
|
]
|
|
251093
251073
|
});
|
|
@@ -251276,7 +251256,7 @@ function createServeCommandRunner({
|
|
|
251276
251256
|
cwd: projectRoot,
|
|
251277
251257
|
env: {
|
|
251278
251258
|
VITE_BASE44_APP_ID: appId,
|
|
251279
|
-
|
|
251259
|
+
VITE_BASE44_APP_BASE_URL: appBaseUrl
|
|
251280
251260
|
},
|
|
251281
251261
|
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
251282
251262
|
});
|
|
@@ -251291,34 +251271,28 @@ function stopRunnerOnProcessSignals(runner) {
|
|
|
251291
251271
|
}
|
|
251292
251272
|
|
|
251293
251273
|
// src/cli/commands/site/dev.ts
|
|
251294
|
-
function parsePort(value) {
|
|
251295
|
-
if (!/^\d+$/.test(value)) {
|
|
251296
|
-
throw new InvalidArgumentError2("must be a whole number");
|
|
251297
|
-
}
|
|
251298
|
-
const port = Number(value);
|
|
251299
|
-
if (port < 1 || port > 65535) {
|
|
251300
|
-
throw new InvalidArgumentError2("must be between 1 and 65535");
|
|
251301
|
-
}
|
|
251302
|
-
return port;
|
|
251303
|
-
}
|
|
251304
251274
|
async function siteDevAction(ctx, options) {
|
|
251305
|
-
const { app } = ctx;
|
|
251306
|
-
if (!app
|
|
251307
|
-
throw new
|
|
251275
|
+
const { app, log } = ctx;
|
|
251276
|
+
if (!app) {
|
|
251277
|
+
throw new InvalidInputError("No app id resolved for this project.");
|
|
251278
|
+
}
|
|
251279
|
+
const port = options.port === undefined ? undefined : Number(options.port);
|
|
251280
|
+
if (port !== undefined && !Number.isInteger(port)) {
|
|
251281
|
+
throw new InvalidInputError(`--port must be a whole number: ${options.port}`);
|
|
251308
251282
|
}
|
|
251309
251283
|
const { project } = await readProjectConfig(app.projectRoot);
|
|
251310
251284
|
const site = project.site;
|
|
251311
251285
|
if (!site) {
|
|
251312
|
-
throw new InvalidInputError(`This project has no 'site' block in base44/config.jsonc, so there is no frontend to serve. Add one
|
|
251286
|
+
throw new InvalidInputError(`This project has no 'site' block in base44/config.jsonc, so there is no frontend to serve. Add one; inside it serveCommand defaults to "npm run dev".`);
|
|
251313
251287
|
}
|
|
251314
251288
|
const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
|
|
251315
|
-
const
|
|
251289
|
+
const command = withServeAddress(serveCommand, {
|
|
251316
251290
|
host: options.host,
|
|
251317
|
-
port
|
|
251291
|
+
port,
|
|
251318
251292
|
hostFlag: site.devHostFlag
|
|
251319
251293
|
});
|
|
251320
|
-
if (
|
|
251321
|
-
|
|
251294
|
+
if ((options.host || port !== undefined) && !forwardsServeAddress(serveCommand)) {
|
|
251295
|
+
log.warn(`serveCommand '${serveCommand}' is not an 'npm run' invocation, so --host/--port were not passed to it. Put the address in serveCommand itself.`);
|
|
251322
251296
|
}
|
|
251323
251297
|
const runner = createServeCommandRunner({
|
|
251324
251298
|
serveCommand: command,
|
|
@@ -251330,11 +251304,11 @@ async function siteDevAction(ctx, options) {
|
|
|
251330
251304
|
runner.onExit((code) => process.exit(code ?? 1));
|
|
251331
251305
|
runner.start();
|
|
251332
251306
|
return {
|
|
251333
|
-
outroMessage:
|
|
251307
|
+
outroMessage: `Frontend dev server running '${command}' against ${theme.styles.bold(options.backendUrl)}`
|
|
251334
251308
|
};
|
|
251335
251309
|
}
|
|
251336
251310
|
function getSiteDevCommand() {
|
|
251337
|
-
return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").
|
|
251311
|
+
return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").requiredOption("--backend-url <url>", "Backend the frontend should call, injected as VITE_BASE44_APP_BASE_URL").option("--host <address>", "Address to bind, e.g. 0.0.0.0").option("--port <number>", "Port to bind").action(siteDevAction);
|
|
251338
251312
|
}
|
|
251339
251313
|
|
|
251340
251314
|
// src/cli/commands/site/open.ts
|
|
@@ -255780,7 +255754,7 @@ function readStdin2() {
|
|
|
255780
255754
|
process.stdin.on("error", reject);
|
|
255781
255755
|
});
|
|
255782
255756
|
}
|
|
255783
|
-
function
|
|
255757
|
+
function parsePort(value) {
|
|
255784
255758
|
const port = Number(value);
|
|
255785
255759
|
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
255786
255760
|
throw new InvalidInputError(`Invalid --port value: "${value}".`, {
|
|
@@ -255817,7 +255791,7 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
255817
255791
|
if (!code.trim()) {
|
|
255818
255792
|
throw noInputError;
|
|
255819
255793
|
}
|
|
255820
|
-
const local = options.local ? await resolveLocalTarget(options.port !== undefined ?
|
|
255794
|
+
const local = options.local ? await resolveLocalTarget(options.port !== undefined ? parsePort(options.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
|
|
255821
255795
|
const { exitCode } = await runScript({
|
|
255822
255796
|
appId: app.id,
|
|
255823
255797
|
code,
|
|
@@ -255929,22 +255903,17 @@ async function eject(ctx, options, command) {
|
|
|
255929
255903
|
errorMessage: "Failed to pull project"
|
|
255930
255904
|
});
|
|
255931
255905
|
const { project } = await readProjectConfig(resolvedPath);
|
|
255932
|
-
const
|
|
255933
|
-
|
|
255906
|
+
const installCommand = project.site?.installCommand;
|
|
255907
|
+
const buildCommand = project.site?.buildCommand;
|
|
255908
|
+
if (installCommand && buildCommand) {
|
|
255934
255909
|
const shouldDeploy = options.yes ? true : await Re({
|
|
255935
255910
|
message: "Would you like to deploy your project now?"
|
|
255936
255911
|
});
|
|
255937
255912
|
if (!Ct(shouldDeploy) && shouldDeploy) {
|
|
255938
255913
|
await runTask("Installing dependencies...", async (updateMessage) => {
|
|
255939
|
-
await execa({
|
|
255940
|
-
cwd: resolvedPath,
|
|
255941
|
-
shell: true
|
|
255942
|
-
})`${site.installCommand}`;
|
|
255914
|
+
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
255943
255915
|
updateMessage("Building project...");
|
|
255944
|
-
await execa({
|
|
255945
|
-
cwd: resolvedPath,
|
|
255946
|
-
shell: true
|
|
255947
|
-
})`${site.buildCommand}`;
|
|
255916
|
+
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
255948
255917
|
}, {
|
|
255949
255918
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
255950
255919
|
errorMessage: "Failed to build project"
|
|
@@ -260052,4 +260021,4 @@ export {
|
|
|
260052
260021
|
runCLI
|
|
260053
260022
|
};
|
|
260054
260023
|
|
|
260055
|
-
//# debugId=
|
|
260024
|
+
//# debugId=03FA5EAAD08DEC4B64756E2164756E21
|