@base44-preview/cli 0.1.14-pr.626.28bcbc7 → 0.1.14-pr.626.999301d
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 +52 -48
- package/dist/cli/index.js.map +11 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -249480,12 +249480,6 @@ async function collectResources(configDir, dirs) {
|
|
|
249480
249480
|
]);
|
|
249481
249481
|
return { entities, agents };
|
|
249482
249482
|
}
|
|
249483
|
-
// src/core/version/gate.ts
|
|
249484
|
-
var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
|
|
249485
|
-
function versionsApiEnabled(env = process.env) {
|
|
249486
|
-
const value = env[VERSIONS_API_ENV];
|
|
249487
|
-
return value === "1" || value === "true";
|
|
249488
|
-
}
|
|
249489
249483
|
// src/core/version/project.ts
|
|
249490
249484
|
import { dirname as dirname19, join as join27, resolve as resolve10 } from "node:path";
|
|
249491
249485
|
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
@@ -249530,20 +249524,33 @@ async function readSettingsIfPresent(projectRoot) {
|
|
|
249530
249524
|
}
|
|
249531
249525
|
}
|
|
249532
249526
|
// src/cli/commands/project/build.ts
|
|
249533
|
-
async function buildAction(ctx) {
|
|
249534
|
-
const { app } = ctx;
|
|
249535
|
-
const target = await resolvePublishTarget(app?.projectRoot
|
|
249527
|
+
async function buildAction(ctx, options) {
|
|
249528
|
+
const { app, jsonMode } = ctx;
|
|
249529
|
+
const target = await resolvePublishTarget(app?.projectRoot, {
|
|
249530
|
+
outputDir: options.outputDir
|
|
249531
|
+
});
|
|
249536
249532
|
await runSiteBuild(ctx, {
|
|
249537
249533
|
root: target.root,
|
|
249538
249534
|
buildCommand: target.buildCommand,
|
|
249539
249535
|
appId: app?.id ?? ""
|
|
249540
249536
|
});
|
|
249537
|
+
const files = await collectBuildOutput(requireOutputDir(target));
|
|
249538
|
+
const totalBytes = files.reduce((sum, file) => sum + file.size, 0);
|
|
249541
249539
|
return {
|
|
249542
|
-
outroMessage: `
|
|
249540
|
+
outroMessage: `Built ${files.length} files (${totalBytes} bytes) with app id ${theme.styles.bold(app?.id ?? "")}`,
|
|
249541
|
+
stdout: jsonMode ? `${JSON.stringify({
|
|
249542
|
+
outputDir: target.outputDir,
|
|
249543
|
+
files: files.map(({ path, size, digest }) => ({
|
|
249544
|
+
path,
|
|
249545
|
+
size,
|
|
249546
|
+
digest
|
|
249547
|
+
}))
|
|
249548
|
+
}, null, 2)}
|
|
249549
|
+
` : undefined
|
|
249543
249550
|
};
|
|
249544
249551
|
}
|
|
249545
249552
|
function getBuildCommand() {
|
|
249546
|
-
return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249553
|
+
return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").action(buildAction);
|
|
249547
249554
|
}
|
|
249548
249555
|
|
|
249549
249556
|
// src/cli/commands/project/create.ts
|
|
@@ -250450,31 +250457,6 @@ function getVisibilityCommand() {
|
|
|
250450
250457
|
])).action(setVisibility);
|
|
250451
250458
|
}
|
|
250452
250459
|
|
|
250453
|
-
// src/cli/commands/versions/options.ts
|
|
250454
|
-
function outputDirOption() {
|
|
250455
|
-
return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
|
|
250456
|
-
}
|
|
250457
|
-
function targetOption() {
|
|
250458
|
-
return new Option2("--target <name>", "Environment to serve the version at");
|
|
250459
|
-
}
|
|
250460
|
-
function gitHashOption() {
|
|
250461
|
-
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
|
|
250462
|
-
if (!isGitCommitHash(value)) {
|
|
250463
|
-
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
250464
|
-
}
|
|
250465
|
-
return value;
|
|
250466
|
-
});
|
|
250467
|
-
}
|
|
250468
|
-
function concurrencyOption() {
|
|
250469
|
-
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
250470
|
-
const parsed = Number(value);
|
|
250471
|
-
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
250472
|
-
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
250473
|
-
}
|
|
250474
|
-
return parsed;
|
|
250475
|
-
});
|
|
250476
|
-
}
|
|
250477
|
-
|
|
250478
250460
|
// src/cli/commands/publish.ts
|
|
250479
250461
|
async function publishAction(ctx, options) {
|
|
250480
250462
|
const { runTask, log, jsonMode, app } = ctx;
|
|
@@ -250515,7 +250497,20 @@ async function publishAction(ctx, options) {
|
|
|
250515
250497
|
};
|
|
250516
250498
|
}
|
|
250517
250499
|
function getPublishCommand() {
|
|
250518
|
-
return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").
|
|
250500
|
+
return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").option("--target <name>", "Environment to serve the version at").addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(publishAction);
|
|
250501
|
+
}
|
|
250502
|
+
function parseGitHash(value) {
|
|
250503
|
+
if (!isGitCommitHash(value)) {
|
|
250504
|
+
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
250505
|
+
}
|
|
250506
|
+
return value;
|
|
250507
|
+
}
|
|
250508
|
+
function parseConcurrency(value) {
|
|
250509
|
+
const parsed = Number(value);
|
|
250510
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
250511
|
+
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
250512
|
+
}
|
|
250513
|
+
return parsed;
|
|
250519
250514
|
}
|
|
250520
250515
|
|
|
250521
250516
|
// src/core/resources/sandbox/schema.ts
|
|
@@ -251030,18 +251025,18 @@ function siteOutputDir(project) {
|
|
|
251030
251025
|
function getSiteDeployCommand() {
|
|
251031
251026
|
const command = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
|
|
251032
251027
|
if (deploymentsApiEnabled()) {
|
|
251033
|
-
command.addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(
|
|
251034
|
-
command.addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(
|
|
251028
|
+
command.addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash2));
|
|
251029
|
+
command.addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency2));
|
|
251035
251030
|
}
|
|
251036
251031
|
return command.action(deployAction2);
|
|
251037
251032
|
}
|
|
251038
|
-
function
|
|
251033
|
+
function parseGitHash2(value) {
|
|
251039
251034
|
if (!isGitCommitHash(value)) {
|
|
251040
251035
|
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
251041
251036
|
}
|
|
251042
251037
|
return value;
|
|
251043
251038
|
}
|
|
251044
|
-
function
|
|
251039
|
+
function parseConcurrency2(value) {
|
|
251045
251040
|
const parsed = Number(value);
|
|
251046
251041
|
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
|
|
251047
251042
|
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
|
|
@@ -251231,7 +251226,18 @@ async function createAction2({ runTask, jsonMode, app }, options) {
|
|
|
251231
251226
|
};
|
|
251232
251227
|
}
|
|
251233
251228
|
function getVersionCreateCommand() {
|
|
251234
|
-
return new Base44Command("create").description("Record the built output as a version, without deploying it").
|
|
251229
|
+
return new Base44Command("create").description("Record the built output as a version, without deploying it").option("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)").addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
|
|
251230
|
+
if (!isGitCommitHash(value)) {
|
|
251231
|
+
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
251232
|
+
}
|
|
251233
|
+
return value;
|
|
251234
|
+
})).addOption(new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
251235
|
+
const parsed = Number(value);
|
|
251236
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
251237
|
+
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
251238
|
+
}
|
|
251239
|
+
return parsed;
|
|
251240
|
+
})).action(createAction2);
|
|
251235
251241
|
}
|
|
251236
251242
|
|
|
251237
251243
|
// src/cli/commands/versions/deploy.ts
|
|
@@ -251248,7 +251254,7 @@ async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
|
251248
251254
|
};
|
|
251249
251255
|
}
|
|
251250
251256
|
function getVersionDeployCommand() {
|
|
251251
|
-
return new Base44Command("deploy").description("Serve an already-recorded version (also how a rollback is done)").argument("<version-id>", "The version to serve").
|
|
251257
|
+
return new Base44Command("deploy").description("Serve an already-recorded version (also how a rollback is done)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to serve the version at").action(deployAction3);
|
|
251252
251258
|
}
|
|
251253
251259
|
|
|
251254
251260
|
// src/cli/commands/versions/index.ts
|
|
@@ -255911,10 +255917,8 @@ function createProgram(context) {
|
|
|
255911
255917
|
program.addCommand(getBranchesCommand());
|
|
255912
255918
|
program.addCommand(getAuthCommand());
|
|
255913
255919
|
program.addCommand(getSiteCommand());
|
|
255914
|
-
|
|
255915
|
-
|
|
255916
|
-
program.addCommand(getVersionsCommand());
|
|
255917
|
-
}
|
|
255920
|
+
program.addCommand(getPublishCommand());
|
|
255921
|
+
program.addCommand(getVersionsCommand());
|
|
255918
255922
|
program.addCommand(getTypesCommand());
|
|
255919
255923
|
program.addCommand(getExecCommand());
|
|
255920
255924
|
program.addCommand(getDevCommand());
|
|
@@ -259966,4 +259970,4 @@ export {
|
|
|
259966
259970
|
runCLI
|
|
259967
259971
|
};
|
|
259968
259972
|
|
|
259969
|
-
//# debugId=
|
|
259973
|
+
//# debugId=8ACC6798F4A12B0564756E2164756E21
|