@base44-preview/cli 0.1.15-pr.626.2df644b → 0.1.15-pr.626.6cd5550
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 +86 -45
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -239997,7 +239997,10 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
239997
239997
|
if (!file) {
|
|
239998
239998
|
throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
|
|
239999
239999
|
}
|
|
240000
|
-
|
|
240000
|
+
await putPresigned(upload, file.absolutePath);
|
|
240001
|
+
}
|
|
240002
|
+
async function putPresigned(upload, absolutePath) {
|
|
240003
|
+
const content = await readFile2(absolutePath);
|
|
240001
240004
|
try {
|
|
240002
240005
|
await distribution_default.put(upload.url, {
|
|
240003
240006
|
body: new Uint8Array(content),
|
|
@@ -247262,6 +247265,9 @@ var EnvironmentResponseSchema = object({
|
|
|
247262
247265
|
// src/core/version/api.ts
|
|
247263
247266
|
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
247264
247267
|
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
247268
|
+
function declaredFile({ path, size, digest }) {
|
|
247269
|
+
return { path, size, digest };
|
|
247270
|
+
}
|
|
247265
247271
|
async function post(path, json, doing) {
|
|
247266
247272
|
try {
|
|
247267
247273
|
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
@@ -247285,36 +247291,39 @@ function parse10(schema, body, what) {
|
|
|
247285
247291
|
}
|
|
247286
247292
|
async function createVersion(artifacts, options = {}) {
|
|
247287
247293
|
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
247288
|
-
static_bundle: artifacts.files.map(
|
|
247289
|
-
|
|
247290
|
-
|
|
247291
|
-
|
|
247292
|
-
|
|
247294
|
+
static_bundle: artifacts.files.map(declaredFile),
|
|
247295
|
+
...artifacts.siteWorker ? {
|
|
247296
|
+
site_worker: {
|
|
247297
|
+
main: artifacts.siteWorker.main,
|
|
247298
|
+
modules: artifacts.siteWorker.modules.map(declaredFile),
|
|
247299
|
+
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
247300
|
+
compatibility_flags: artifacts.siteWorker.compatibilityFlags
|
|
247301
|
+
}
|
|
247302
|
+
} : {},
|
|
247293
247303
|
entities: artifacts.entities,
|
|
247294
247304
|
agents: artifacts.agents,
|
|
247295
247305
|
source_commit: options.sourceCommit
|
|
247296
247306
|
}, "declaring a version")).json(), "declare");
|
|
247307
|
+
const declaredFiles = [
|
|
247308
|
+
...artifacts.files,
|
|
247309
|
+
...artifacts.siteWorker?.modules ?? []
|
|
247310
|
+
];
|
|
247297
247311
|
options.progress?.onDeclared?.({
|
|
247298
|
-
fileCount:
|
|
247312
|
+
fileCount: declaredFiles.length,
|
|
247299
247313
|
owedFiles: declared.uploads.length
|
|
247300
247314
|
});
|
|
247301
|
-
|
|
247302
|
-
|
|
247303
|
-
|
|
247304
|
-
|
|
247305
|
-
|
|
247306
|
-
|
|
247307
|
-
|
|
247308
|
-
|
|
247309
|
-
|
|
247310
|
-
|
|
247311
|
-
|
|
247312
|
-
|
|
247313
|
-
]))
|
|
247314
|
-
}, {
|
|
247315
|
-
concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY,
|
|
247316
|
-
onProgress: options.progress?.onUpload
|
|
247317
|
-
});
|
|
247315
|
+
if (declared.uploads.length !== declaredFiles.length) {
|
|
247316
|
+
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
247317
|
+
}
|
|
247318
|
+
let uploadedFiles = 0;
|
|
247319
|
+
await pMap(declared.uploads, async (upload, index) => {
|
|
247320
|
+
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
247321
|
+
uploadedFiles++;
|
|
247322
|
+
options.progress?.onUpload?.({
|
|
247323
|
+
uploadedFiles,
|
|
247324
|
+
totalFiles: declared.uploads.length
|
|
247325
|
+
});
|
|
247326
|
+
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
247318
247327
|
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
247319
247328
|
}
|
|
247320
247329
|
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
@@ -249724,7 +249733,7 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249724
249733
|
import { createHash as createHash2 } from "node:crypto";
|
|
249725
249734
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
249726
249735
|
import { stat as stat3 } from "node:fs/promises";
|
|
249727
|
-
import { join as join27 } from "node:path";
|
|
249736
|
+
import { join as join27, resolve as resolve10 } from "node:path";
|
|
249728
249737
|
var MAX_FILE_COUNT = 50000;
|
|
249729
249738
|
var HASH_CONCURRENCY = 32;
|
|
249730
249739
|
var ENTRY2 = "index.html";
|
|
@@ -249735,7 +249744,7 @@ async function digestFile(absolutePath) {
|
|
|
249735
249744
|
}
|
|
249736
249745
|
return `sha256:${hash.digest("hex")}`;
|
|
249737
249746
|
}
|
|
249738
|
-
async function collectBuildOutput(outputDir) {
|
|
249747
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
249739
249748
|
const relativePaths = await walkBuildOutput(outputDir);
|
|
249740
249749
|
if (relativePaths.length === 0) {
|
|
249741
249750
|
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
@@ -249747,7 +249756,7 @@ async function collectBuildOutput(outputDir) {
|
|
|
249747
249756
|
if (relativePaths.length > MAX_FILE_COUNT) {
|
|
249748
249757
|
throw new InvalidInputError(`Too many files: found ${relativePaths.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
249749
249758
|
}
|
|
249750
|
-
if (!relativePaths.includes(ENTRY2)) {
|
|
249759
|
+
if (options.requireEntry !== false && !relativePaths.includes(ENTRY2)) {
|
|
249751
249760
|
throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
|
|
249752
249761
|
}
|
|
249753
249762
|
return await pMap(relativePaths, async (path) => {
|
|
@@ -249761,6 +249770,31 @@ async function collectBuildOutput(outputDir) {
|
|
|
249761
249770
|
};
|
|
249762
249771
|
}, { concurrency: HASH_CONCURRENCY });
|
|
249763
249772
|
}
|
|
249773
|
+
async function collectSiteWorker(projectRoot) {
|
|
249774
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
249775
|
+
if (!redirectPath) {
|
|
249776
|
+
return null;
|
|
249777
|
+
}
|
|
249778
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
249779
|
+
const modules = await collectModules(config);
|
|
249780
|
+
const entry = resolve10(config.configDir, config.main);
|
|
249781
|
+
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249782
|
+
if (!main) {
|
|
249783
|
+
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
249784
|
+
}
|
|
249785
|
+
return {
|
|
249786
|
+
main,
|
|
249787
|
+
modules: await pMap(modules, async ({ name, absolutePath, size }) => ({
|
|
249788
|
+
path: name,
|
|
249789
|
+
absolutePath,
|
|
249790
|
+
size,
|
|
249791
|
+
digest: await digestFile(absolutePath)
|
|
249792
|
+
}), { concurrency: HASH_CONCURRENCY }),
|
|
249793
|
+
compatibilityDate: config.compatibilityDate,
|
|
249794
|
+
compatibilityFlags: config.compatibilityFlags,
|
|
249795
|
+
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
249796
|
+
};
|
|
249797
|
+
}
|
|
249764
249798
|
async function readRawResources(dir) {
|
|
249765
249799
|
if (!await pathExists(dir)) {
|
|
249766
249800
|
return {};
|
|
@@ -249791,7 +249825,7 @@ function versionsApiEnabled(env = process.env) {
|
|
|
249791
249825
|
return value === "1" || value === "true";
|
|
249792
249826
|
}
|
|
249793
249827
|
// src/core/version/project.ts
|
|
249794
|
-
import { dirname as dirname21, join as join28, resolve as
|
|
249828
|
+
import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
|
|
249795
249829
|
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249796
249830
|
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249797
249831
|
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
@@ -249808,7 +249842,7 @@ async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
|
249808
249842
|
}
|
|
249809
249843
|
function outputDirectory(project, root, override) {
|
|
249810
249844
|
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249811
|
-
return configured ?
|
|
249845
|
+
return configured ? resolve11(root, configured) : null;
|
|
249812
249846
|
}
|
|
249813
249847
|
function requireOutputDir(target) {
|
|
249814
249848
|
if (target.outputDir === null) {
|
|
@@ -249851,7 +249885,7 @@ function getBuildCommand() {
|
|
|
249851
249885
|
}
|
|
249852
249886
|
|
|
249853
249887
|
// src/cli/commands/project/create.ts
|
|
249854
|
-
import { basename as basename6, resolve as
|
|
249888
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
249855
249889
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249856
249890
|
|
|
249857
249891
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -250047,7 +250081,7 @@ async function createInteractive(options, ctx) {
|
|
|
250047
250081
|
}, ctx);
|
|
250048
250082
|
}
|
|
250049
250083
|
async function createNonInteractive(options, ctx) {
|
|
250050
|
-
ctx.log.info(`Creating a new project at ${
|
|
250084
|
+
ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
|
|
250051
250085
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
250052
250086
|
return await executeCreate({
|
|
250053
250087
|
template,
|
|
@@ -250071,7 +250105,7 @@ async function executeCreate({
|
|
|
250071
250105
|
}, ctx) {
|
|
250072
250106
|
const { log, runTask } = ctx;
|
|
250073
250107
|
const name = rawName.trim();
|
|
250074
|
-
const resolvedPath =
|
|
250108
|
+
const resolvedPath = resolve12(projectPath);
|
|
250075
250109
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
250076
250110
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
250077
250111
|
return await createProjectFiles({
|
|
@@ -250712,7 +250746,7 @@ function getLogsCommand() {
|
|
|
250712
250746
|
}
|
|
250713
250747
|
|
|
250714
250748
|
// src/cli/commands/project/scaffold.ts
|
|
250715
|
-
import { basename as basename7, resolve as
|
|
250749
|
+
import { basename as basename7, resolve as resolve13 } from "node:path";
|
|
250716
250750
|
function resolveAppId(options) {
|
|
250717
250751
|
const appId = options.appId;
|
|
250718
250752
|
if (!appId) {
|
|
@@ -250728,7 +250762,7 @@ function resolveAppId(options) {
|
|
|
250728
250762
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250729
250763
|
const { log, runTask } = ctx;
|
|
250730
250764
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250731
|
-
const resolvedPath =
|
|
250765
|
+
const resolvedPath = resolve13("./");
|
|
250732
250766
|
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250733
250767
|
const template = await getTemplateById("backend-only");
|
|
250734
250768
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -250816,10 +250850,17 @@ async function publishAction(ctx, options) {
|
|
|
250816
250850
|
}
|
|
250817
250851
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250818
250852
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250819
|
-
const artifacts = await tagStep("create_version", async () =>
|
|
250820
|
-
|
|
250821
|
-
|
|
250822
|
-
|
|
250853
|
+
const artifacts = await tagStep("create_version", async () => {
|
|
250854
|
+
const siteWorker = await collectSiteWorker(target.root);
|
|
250855
|
+
const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
|
|
250856
|
+
return {
|
|
250857
|
+
files: assetsDir ? await collectBuildOutput(assetsDir, {
|
|
250858
|
+
requireEntry: siteWorker === null
|
|
250859
|
+
}) : [],
|
|
250860
|
+
...siteWorker ? { siteWorker } : {},
|
|
250861
|
+
...await collectResources(target.configDir, target)
|
|
250862
|
+
};
|
|
250863
|
+
});
|
|
250823
250864
|
return await publishVersion(artifacts, {
|
|
250824
250865
|
sourceCommit: gitHash,
|
|
250825
250866
|
target: options.target,
|
|
@@ -251212,7 +251253,7 @@ function getSecretsListCommand() {
|
|
|
251212
251253
|
}
|
|
251213
251254
|
|
|
251214
251255
|
// src/cli/commands/secrets/set.ts
|
|
251215
|
-
import { resolve as
|
|
251256
|
+
import { resolve as resolve14 } from "node:path";
|
|
251216
251257
|
function parseEntries(entries) {
|
|
251217
251258
|
const secrets = {};
|
|
251218
251259
|
for (const entry of entries) {
|
|
@@ -251243,7 +251284,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
251243
251284
|
validateInput(entries, options);
|
|
251244
251285
|
let secrets;
|
|
251245
251286
|
if (options.envFile) {
|
|
251246
|
-
secrets = await parseEnvFile(
|
|
251287
|
+
secrets = await parseEnvFile(resolve14(options.envFile));
|
|
251247
251288
|
if (Object.keys(secrets).length === 0) {
|
|
251248
251289
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
251249
251290
|
}
|
|
@@ -251272,7 +251313,7 @@ function getSecretsCommand() {
|
|
|
251272
251313
|
}
|
|
251273
251314
|
|
|
251274
251315
|
// src/cli/commands/site/deploy.ts
|
|
251275
|
-
import { resolve as
|
|
251316
|
+
import { resolve as resolve15 } from "node:path";
|
|
251276
251317
|
async function deployAction2(ctx, options) {
|
|
251277
251318
|
const { isNonInteractive } = ctx;
|
|
251278
251319
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251350,7 +251391,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251350
251391
|
}
|
|
251351
251392
|
function siteOutputDir(project) {
|
|
251352
251393
|
const outputDirectory = project.site?.outputDirectory;
|
|
251353
|
-
return outputDirectory ?
|
|
251394
|
+
return outputDirectory ? resolve15(project.root, outputDirectory) : null;
|
|
251354
251395
|
}
|
|
251355
251396
|
function getSiteDeployCommand() {
|
|
251356
251397
|
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)");
|
|
@@ -256102,7 +256143,7 @@ Examples:
|
|
|
256102
256143
|
}
|
|
256103
256144
|
|
|
256104
256145
|
// src/cli/commands/project/eject.ts
|
|
256105
|
-
import { resolve as
|
|
256146
|
+
import { resolve as resolve19 } from "node:path";
|
|
256106
256147
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256107
256148
|
async function eject(ctx, options, command) {
|
|
256108
256149
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -256166,7 +256207,7 @@ async function eject(ctx, options, command) {
|
|
|
256166
256207
|
Ne("Operation cancelled.");
|
|
256167
256208
|
throw new CLIExitError(0);
|
|
256168
256209
|
}
|
|
256169
|
-
const resolvedPath =
|
|
256210
|
+
const resolvedPath = resolve19(selectedPath);
|
|
256170
256211
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
256171
256212
|
await createProjectFilesForExistingProject({
|
|
256172
256213
|
projectId,
|
|
@@ -260305,4 +260346,4 @@ export {
|
|
|
260305
260346
|
runCLI
|
|
260306
260347
|
};
|
|
260307
260348
|
|
|
260308
|
-
//# debugId=
|
|
260349
|
+
//# debugId=6F5FA046DBD3D8D164756E2164756E21
|