@base44-preview/cli 0.1.14-pr.626.6952180 → 0.1.15-pr.626.2b403ee
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 +353 -296
- package/dist/cli/index.js.map +22 -21
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -239236,7 +239236,7 @@ import { join as join13 } from "node:path";
|
|
|
239236
239236
|
// package.json
|
|
239237
239237
|
var package_default = {
|
|
239238
239238
|
name: "base44",
|
|
239239
|
-
version: "0.1.
|
|
239239
|
+
version: "0.1.15",
|
|
239240
239240
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239241
239241
|
type: "module",
|
|
239242
239242
|
bin: {
|
|
@@ -239590,91 +239590,8 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
239590
239590
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
239591
239591
|
import { join as join18 } from "node:path";
|
|
239592
239592
|
|
|
239593
|
-
// src/core/site/manifest.ts
|
|
239594
|
-
import { createHash } from "node:crypto";
|
|
239595
|
-
import { createReadStream } from "node:fs";
|
|
239596
|
-
import { stat } from "node:fs/promises";
|
|
239597
|
-
import { basename as basename5, extname, join as join16 } from "node:path";
|
|
239598
|
-
var MAX_ASSET_COUNT = 1e5;
|
|
239599
|
-
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239600
|
-
var ALWAYS_IGNORED = new Set([
|
|
239601
|
-
ASSETS_IGNORE_FILE,
|
|
239602
|
-
"wrangler.json",
|
|
239603
|
-
".dev.vars"
|
|
239604
|
-
]);
|
|
239605
|
-
var MIME_TYPES = {
|
|
239606
|
-
".html": "text/html",
|
|
239607
|
-
".htm": "text/html",
|
|
239608
|
-
".css": "text/css",
|
|
239609
|
-
".js": "text/javascript",
|
|
239610
|
-
".mjs": "text/javascript",
|
|
239611
|
-
".json": "application/json",
|
|
239612
|
-
".map": "application/json",
|
|
239613
|
-
".txt": "text/plain",
|
|
239614
|
-
".xml": "application/xml",
|
|
239615
|
-
".svg": "image/svg+xml",
|
|
239616
|
-
".png": "image/png",
|
|
239617
|
-
".jpg": "image/jpeg",
|
|
239618
|
-
".jpeg": "image/jpeg",
|
|
239619
|
-
".gif": "image/gif",
|
|
239620
|
-
".webp": "image/webp",
|
|
239621
|
-
".avif": "image/avif",
|
|
239622
|
-
".ico": "image/x-icon",
|
|
239623
|
-
".woff": "font/woff",
|
|
239624
|
-
".woff2": "font/woff2",
|
|
239625
|
-
".ttf": "font/ttf",
|
|
239626
|
-
".otf": "font/otf",
|
|
239627
|
-
".eot": "application/vnd.ms-fontobject",
|
|
239628
|
-
".mp3": "audio/mpeg",
|
|
239629
|
-
".mp4": "video/mp4",
|
|
239630
|
-
".webm": "video/webm",
|
|
239631
|
-
".pdf": "application/pdf",
|
|
239632
|
-
".wasm": "application/wasm",
|
|
239633
|
-
".webmanifest": "application/manifest+json"
|
|
239634
|
-
};
|
|
239635
|
-
function getAssetContentType(filePath) {
|
|
239636
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239637
|
-
}
|
|
239638
|
-
async function hashAssetFile(appId, absolutePath) {
|
|
239639
|
-
const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
|
|
239640
|
-
for await (const chunk of createReadStream(absolutePath)) {
|
|
239641
|
-
hash.update(chunk);
|
|
239642
|
-
}
|
|
239643
|
-
return hash.digest("hex").slice(0, 32);
|
|
239644
|
-
}
|
|
239645
|
-
async function buildAssetManifest(assetsDir, appId) {
|
|
239646
|
-
const manifest = {};
|
|
239647
|
-
const filesByHash = new Map;
|
|
239648
|
-
const found = await globby("**/*", {
|
|
239649
|
-
cwd: assetsDir,
|
|
239650
|
-
dot: true,
|
|
239651
|
-
onlyFiles: true,
|
|
239652
|
-
followSymbolicLinks: false,
|
|
239653
|
-
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239654
|
-
});
|
|
239655
|
-
const relativeFilePaths = found.filter((path) => !ALWAYS_IGNORED.has(basename5(path)));
|
|
239656
|
-
if (relativeFilePaths.length > MAX_ASSET_COUNT) {
|
|
239657
|
-
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239658
|
-
}
|
|
239659
|
-
for (const relativePath of relativeFilePaths.sort()) {
|
|
239660
|
-
const absolutePath = join16(assetsDir, ...relativePath.split("/"));
|
|
239661
|
-
const { size } = await stat(absolutePath);
|
|
239662
|
-
const hash = await hashAssetFile(appId, absolutePath);
|
|
239663
|
-
manifest[`/${relativePath}`] = { hash, size };
|
|
239664
|
-
if (!filesByHash.has(hash)) {
|
|
239665
|
-
filesByHash.set(hash, {
|
|
239666
|
-
absolutePath,
|
|
239667
|
-
hash,
|
|
239668
|
-
size,
|
|
239669
|
-
contentType: getAssetContentType(absolutePath)
|
|
239670
|
-
});
|
|
239671
|
-
}
|
|
239672
|
-
}
|
|
239673
|
-
return { manifest, filesByHash };
|
|
239674
|
-
}
|
|
239675
|
-
|
|
239676
239593
|
// src/core/site/modules.ts
|
|
239677
|
-
import { stat
|
|
239594
|
+
import { stat } from "node:fs/promises";
|
|
239678
239595
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239679
239596
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239680
239597
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239749,7 +239666,7 @@ async function collectModules(config) {
|
|
|
239749
239666
|
const modules = [...modulesByName.values()];
|
|
239750
239667
|
let totalBytes = 0;
|
|
239751
239668
|
for (const module of modules) {
|
|
239752
|
-
module.size = (await
|
|
239669
|
+
module.size = (await stat(module.absolutePath)).size;
|
|
239753
239670
|
totalBytes += module.size;
|
|
239754
239671
|
}
|
|
239755
239672
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239768,8 +239685,104 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239768
239685
|
});
|
|
239769
239686
|
}
|
|
239770
239687
|
|
|
239771
|
-
// src/core/site/
|
|
239772
|
-
import {
|
|
239688
|
+
// src/core/site/wrangler-config.ts
|
|
239689
|
+
import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
|
|
239690
|
+
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
239691
|
+
var RedirectConfigSchema = looseObject({
|
|
239692
|
+
configPath: string2().min(1)
|
|
239693
|
+
});
|
|
239694
|
+
var WranglerConfigSchema = looseObject({
|
|
239695
|
+
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
239696
|
+
no_bundle: boolean2().optional(),
|
|
239697
|
+
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
239698
|
+
assets: looseObject({
|
|
239699
|
+
directory: string2().optional(),
|
|
239700
|
+
html_handling: string2().optional(),
|
|
239701
|
+
not_found_handling: string2().optional(),
|
|
239702
|
+
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
239703
|
+
headers: string2().optional(),
|
|
239704
|
+
redirects: string2().optional()
|
|
239705
|
+
}).optional(),
|
|
239706
|
+
compatibility_date: string2().optional(),
|
|
239707
|
+
compatibility_flags: array(string2()).optional(),
|
|
239708
|
+
vars: record(string2(), unknown()).optional(),
|
|
239709
|
+
upload_source_maps: boolean2().optional()
|
|
239710
|
+
});
|
|
239711
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
239712
|
+
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
239713
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
239714
|
+
}
|
|
239715
|
+
async function resolveWranglerConfig(redirectPath) {
|
|
239716
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
239717
|
+
const parsed = await readJsonFile(configPath);
|
|
239718
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
239719
|
+
if (!result.success) {
|
|
239720
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
239721
|
+
}
|
|
239722
|
+
const config = result.data;
|
|
239723
|
+
if (config.no_bundle !== true) {
|
|
239724
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
239725
|
+
}
|
|
239726
|
+
const configDir = dirname12(configPath);
|
|
239727
|
+
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
239728
|
+
return {
|
|
239729
|
+
configPath,
|
|
239730
|
+
configDir,
|
|
239731
|
+
main: config.main,
|
|
239732
|
+
assetsDirectory,
|
|
239733
|
+
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
239734
|
+
compatibilityDate: config.compatibility_date ?? null,
|
|
239735
|
+
compatibilityFlags: config.compatibility_flags ?? [],
|
|
239736
|
+
rules: (config.rules ?? []).map((rule) => ({
|
|
239737
|
+
type: rule.type,
|
|
239738
|
+
globs: rule.globs
|
|
239739
|
+
})),
|
|
239740
|
+
uploadSourceMaps: config.upload_source_maps ?? false
|
|
239741
|
+
};
|
|
239742
|
+
}
|
|
239743
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
239744
|
+
const parsed = await readJsonFile(redirectPath);
|
|
239745
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
239746
|
+
if (!result.success) {
|
|
239747
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
239748
|
+
}
|
|
239749
|
+
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
239750
|
+
if (!await pathExists(configPath)) {
|
|
239751
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
239752
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
239753
|
+
});
|
|
239754
|
+
}
|
|
239755
|
+
return configPath;
|
|
239756
|
+
}
|
|
239757
|
+
function toResolvedAssetsConfig(assets) {
|
|
239758
|
+
return {
|
|
239759
|
+
htmlHandling: assets.html_handling,
|
|
239760
|
+
notFoundHandling: assets.not_found_handling,
|
|
239761
|
+
runWorkerFirst: assets.run_worker_first,
|
|
239762
|
+
headers: assets.headers,
|
|
239763
|
+
redirects: assets.redirects
|
|
239764
|
+
};
|
|
239765
|
+
}
|
|
239766
|
+
|
|
239767
|
+
// src/core/site/full-stack.ts
|
|
239768
|
+
async function resolveFullStackBuild(projectRoot) {
|
|
239769
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
239770
|
+
if (!redirectPath) {
|
|
239771
|
+
return null;
|
|
239772
|
+
}
|
|
239773
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
239774
|
+
return {
|
|
239775
|
+
config,
|
|
239776
|
+
modules: await collectModules(config),
|
|
239777
|
+
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
239778
|
+
};
|
|
239779
|
+
}
|
|
239780
|
+
|
|
239781
|
+
// src/core/site/manifest.ts
|
|
239782
|
+
import { createHash } from "node:crypto";
|
|
239783
|
+
import { createReadStream } from "node:fs";
|
|
239784
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
239785
|
+
import { basename as basename5, extname, join as join17 } from "node:path";
|
|
239773
239786
|
|
|
239774
239787
|
// ../../node_modules/p-map/index.js
|
|
239775
239788
|
async function pMap(iterable, mapper, {
|
|
@@ -239895,7 +239908,99 @@ async function pMap(iterable, mapper, {
|
|
|
239895
239908
|
}
|
|
239896
239909
|
var pMapSkip = Symbol("skip");
|
|
239897
239910
|
|
|
239911
|
+
// src/core/site/manifest.ts
|
|
239912
|
+
var MAX_ASSET_COUNT = 1e5;
|
|
239913
|
+
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239914
|
+
var ALWAYS_IGNORED = new Set([
|
|
239915
|
+
ASSETS_IGNORE_FILE,
|
|
239916
|
+
"wrangler.json",
|
|
239917
|
+
".dev.vars"
|
|
239918
|
+
]);
|
|
239919
|
+
var MIME_TYPES = {
|
|
239920
|
+
".html": "text/html",
|
|
239921
|
+
".htm": "text/html",
|
|
239922
|
+
".css": "text/css",
|
|
239923
|
+
".js": "text/javascript",
|
|
239924
|
+
".mjs": "text/javascript",
|
|
239925
|
+
".json": "application/json",
|
|
239926
|
+
".map": "application/json",
|
|
239927
|
+
".txt": "text/plain",
|
|
239928
|
+
".xml": "application/xml",
|
|
239929
|
+
".svg": "image/svg+xml",
|
|
239930
|
+
".png": "image/png",
|
|
239931
|
+
".jpg": "image/jpeg",
|
|
239932
|
+
".jpeg": "image/jpeg",
|
|
239933
|
+
".gif": "image/gif",
|
|
239934
|
+
".webp": "image/webp",
|
|
239935
|
+
".avif": "image/avif",
|
|
239936
|
+
".ico": "image/x-icon",
|
|
239937
|
+
".woff": "font/woff",
|
|
239938
|
+
".woff2": "font/woff2",
|
|
239939
|
+
".ttf": "font/ttf",
|
|
239940
|
+
".otf": "font/otf",
|
|
239941
|
+
".eot": "application/vnd.ms-fontobject",
|
|
239942
|
+
".mp3": "audio/mpeg",
|
|
239943
|
+
".mp4": "video/mp4",
|
|
239944
|
+
".webm": "video/webm",
|
|
239945
|
+
".pdf": "application/pdf",
|
|
239946
|
+
".wasm": "application/wasm",
|
|
239947
|
+
".webmanifest": "application/manifest+json"
|
|
239948
|
+
};
|
|
239949
|
+
function getAssetContentType(filePath) {
|
|
239950
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239951
|
+
}
|
|
239952
|
+
async function walkBuildOutput(outputDir) {
|
|
239953
|
+
const found = await globby("**/*", {
|
|
239954
|
+
cwd: outputDir,
|
|
239955
|
+
dot: true,
|
|
239956
|
+
onlyFiles: true,
|
|
239957
|
+
followSymbolicLinks: false,
|
|
239958
|
+
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239959
|
+
});
|
|
239960
|
+
return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
|
|
239961
|
+
}
|
|
239962
|
+
var STAT_CONCURRENCY = 32;
|
|
239963
|
+
async function describeBuildOutput(outputDir) {
|
|
239964
|
+
const relativePaths = await walkBuildOutput(outputDir);
|
|
239965
|
+
return await pMap(relativePaths, async (path) => {
|
|
239966
|
+
const absolutePath = join17(outputDir, ...path.split("/"));
|
|
239967
|
+
return { path, absolutePath, size: (await stat2(absolutePath)).size };
|
|
239968
|
+
}, { concurrency: STAT_CONCURRENCY });
|
|
239969
|
+
}
|
|
239970
|
+
async function hashFileInto(hash, absolutePath) {
|
|
239971
|
+
for await (const chunk of createReadStream(absolutePath)) {
|
|
239972
|
+
hash.update(chunk);
|
|
239973
|
+
}
|
|
239974
|
+
return hash;
|
|
239975
|
+
}
|
|
239976
|
+
async function hashAssetFile(appId, absolutePath) {
|
|
239977
|
+
const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
|
|
239978
|
+
return hash.digest("hex").slice(0, 32);
|
|
239979
|
+
}
|
|
239980
|
+
async function buildAssetManifest(assetsDir, appId) {
|
|
239981
|
+
const manifest = {};
|
|
239982
|
+
const filesByHash = new Map;
|
|
239983
|
+
const files = await describeBuildOutput(assetsDir);
|
|
239984
|
+
if (files.length > MAX_ASSET_COUNT) {
|
|
239985
|
+
throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239986
|
+
}
|
|
239987
|
+
for (const { path: relativePath, absolutePath, size } of files) {
|
|
239988
|
+
const hash = await hashAssetFile(appId, absolutePath);
|
|
239989
|
+
manifest[`/${relativePath}`] = { hash, size };
|
|
239990
|
+
if (!filesByHash.has(hash)) {
|
|
239991
|
+
filesByHash.set(hash, {
|
|
239992
|
+
absolutePath,
|
|
239993
|
+
hash,
|
|
239994
|
+
size,
|
|
239995
|
+
contentType: getAssetContentType(absolutePath)
|
|
239996
|
+
});
|
|
239997
|
+
}
|
|
239998
|
+
}
|
|
239999
|
+
return { manifest, filesByHash };
|
|
240000
|
+
}
|
|
240001
|
+
|
|
239898
240002
|
// src/core/site/upload.ts
|
|
240003
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239899
240004
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
239900
240005
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
239901
240006
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -239994,7 +240099,10 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
239994
240099
|
if (!file) {
|
|
239995
240100
|
throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
|
|
239996
240101
|
}
|
|
239997
|
-
|
|
240102
|
+
await putPresigned(upload, file.absolutePath);
|
|
240103
|
+
}
|
|
240104
|
+
async function putPresigned(upload, absolutePath) {
|
|
240105
|
+
const content = await readFile2(absolutePath);
|
|
239998
240106
|
try {
|
|
239999
240107
|
await distribution_default.put(upload.url, {
|
|
240000
240108
|
body: new Uint8Array(content),
|
|
@@ -240010,85 +240118,6 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240010
240118
|
}
|
|
240011
240119
|
}
|
|
240012
240120
|
|
|
240013
|
-
// src/core/site/wrangler-config.ts
|
|
240014
|
-
import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
|
|
240015
|
-
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
240016
|
-
var RedirectConfigSchema = looseObject({
|
|
240017
|
-
configPath: string2().min(1)
|
|
240018
|
-
});
|
|
240019
|
-
var WranglerConfigSchema = looseObject({
|
|
240020
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
240021
|
-
no_bundle: boolean2().optional(),
|
|
240022
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
240023
|
-
assets: looseObject({
|
|
240024
|
-
directory: string2().optional(),
|
|
240025
|
-
html_handling: string2().optional(),
|
|
240026
|
-
not_found_handling: string2().optional(),
|
|
240027
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
240028
|
-
headers: string2().optional(),
|
|
240029
|
-
redirects: string2().optional()
|
|
240030
|
-
}).optional(),
|
|
240031
|
-
compatibility_date: string2().optional(),
|
|
240032
|
-
compatibility_flags: array(string2()).optional(),
|
|
240033
|
-
vars: record(string2(), unknown()).optional(),
|
|
240034
|
-
upload_source_maps: boolean2().optional()
|
|
240035
|
-
});
|
|
240036
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
240037
|
-
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
240038
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
240039
|
-
}
|
|
240040
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
240041
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
240042
|
-
const parsed = await readJsonFile(configPath);
|
|
240043
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
240044
|
-
if (!result.success) {
|
|
240045
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
240046
|
-
}
|
|
240047
|
-
const config = result.data;
|
|
240048
|
-
if (config.no_bundle !== true) {
|
|
240049
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
240050
|
-
}
|
|
240051
|
-
const configDir = dirname12(configPath);
|
|
240052
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
240053
|
-
return {
|
|
240054
|
-
configPath,
|
|
240055
|
-
configDir,
|
|
240056
|
-
main: config.main,
|
|
240057
|
-
assetsDirectory,
|
|
240058
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
240059
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
240060
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
240061
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
240062
|
-
type: rule.type,
|
|
240063
|
-
globs: rule.globs
|
|
240064
|
-
})),
|
|
240065
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
240066
|
-
};
|
|
240067
|
-
}
|
|
240068
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
240069
|
-
const parsed = await readJsonFile(redirectPath);
|
|
240070
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
240071
|
-
if (!result.success) {
|
|
240072
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
240073
|
-
}
|
|
240074
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
240075
|
-
if (!await pathExists(configPath)) {
|
|
240076
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
240077
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
240078
|
-
});
|
|
240079
|
-
}
|
|
240080
|
-
return configPath;
|
|
240081
|
-
}
|
|
240082
|
-
function toResolvedAssetsConfig(assets) {
|
|
240083
|
-
return {
|
|
240084
|
-
htmlHandling: assets.html_handling,
|
|
240085
|
-
notFoundHandling: assets.not_found_handling,
|
|
240086
|
-
runWorkerFirst: assets.run_worker_first,
|
|
240087
|
-
headers: assets.headers,
|
|
240088
|
-
redirects: assets.redirects
|
|
240089
|
-
};
|
|
240090
|
-
}
|
|
240091
|
-
|
|
240092
240121
|
// src/core/site/deployment.ts
|
|
240093
240122
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240094
240123
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240115,12 +240144,11 @@ async function deployToDeployments(options) {
|
|
|
240115
240144
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240116
240145
|
}
|
|
240117
240146
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240118
|
-
const
|
|
240119
|
-
if (!
|
|
240147
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
240148
|
+
if (!built) {
|
|
240120
240149
|
return null;
|
|
240121
240150
|
}
|
|
240122
|
-
const config =
|
|
240123
|
-
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240151
|
+
const { config, modules, assetsDir } = built;
|
|
240124
240152
|
return {
|
|
240125
240153
|
config: {
|
|
240126
240154
|
main: config.main,
|
|
@@ -240128,7 +240156,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240128
240156
|
compatibility_flags: config.compatibilityFlags,
|
|
240129
240157
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240130
240158
|
},
|
|
240131
|
-
modules
|
|
240159
|
+
modules,
|
|
240132
240160
|
assetsDir
|
|
240133
240161
|
};
|
|
240134
240162
|
}
|
|
@@ -247048,6 +247076,12 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247048
247076
|
ctx.app = appContext;
|
|
247049
247077
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247050
247078
|
}
|
|
247079
|
+
function requireApp(ctx) {
|
|
247080
|
+
if (!ctx.app) {
|
|
247081
|
+
throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
|
|
247082
|
+
}
|
|
247083
|
+
return ctx.app;
|
|
247084
|
+
}
|
|
247051
247085
|
|
|
247052
247086
|
// src/cli/utils/version-check.ts
|
|
247053
247087
|
async function checkForUpgrade() {
|
|
@@ -247239,26 +247273,29 @@ var DeclareVersionResponseSchema = object({
|
|
|
247239
247273
|
}));
|
|
247240
247274
|
var CreateVersionResponseSchema = object({
|
|
247241
247275
|
version_id: string2(),
|
|
247242
|
-
manifest_hash: string2()
|
|
247243
|
-
deduplicated: boolean2()
|
|
247276
|
+
manifest_hash: string2()
|
|
247244
247277
|
}).transform((data) => ({
|
|
247245
247278
|
versionId: data.version_id,
|
|
247246
|
-
manifestHash: data.manifest_hash
|
|
247247
|
-
deduplicated: data.deduplicated
|
|
247279
|
+
manifestHash: data.manifest_hash
|
|
247248
247280
|
}));
|
|
247249
|
-
var
|
|
247250
|
-
|
|
247281
|
+
var EnvironmentResponseSchema = object({
|
|
247282
|
+
name: string2(),
|
|
247283
|
+
version_id: string2(),
|
|
247251
247284
|
manifest_hash: string2(),
|
|
247252
|
-
|
|
247285
|
+
deployment_id: string2()
|
|
247253
247286
|
}).transform((data) => ({
|
|
247254
|
-
|
|
247287
|
+
name: data.name,
|
|
247288
|
+
versionId: data.version_id,
|
|
247255
247289
|
manifestHash: data.manifest_hash,
|
|
247256
|
-
|
|
247290
|
+
deploymentId: data.deployment_id
|
|
247257
247291
|
}));
|
|
247258
247292
|
|
|
247259
247293
|
// src/core/version/api.ts
|
|
247260
247294
|
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
247261
247295
|
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
247296
|
+
function declaredFile({ path, size, digest }) {
|
|
247297
|
+
return { path, size, digest };
|
|
247298
|
+
}
|
|
247262
247299
|
async function post(path, json, doing) {
|
|
247263
247300
|
try {
|
|
247264
247301
|
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
@@ -247266,6 +247303,13 @@ async function post(path, json, doing) {
|
|
|
247266
247303
|
throw await ApiError.fromHttpError(error, doing);
|
|
247267
247304
|
}
|
|
247268
247305
|
}
|
|
247306
|
+
async function patch(path, json, doing) {
|
|
247307
|
+
try {
|
|
247308
|
+
return await getAppClient().patch(path, { json, timeout: 180000 });
|
|
247309
|
+
} catch (error) {
|
|
247310
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
247311
|
+
}
|
|
247312
|
+
}
|
|
247269
247313
|
function parse10(schema, body, what) {
|
|
247270
247314
|
const result = schema.safeParse(body);
|
|
247271
247315
|
if (!result.success) {
|
|
@@ -247275,49 +247319,53 @@ function parse10(schema, body, what) {
|
|
|
247275
247319
|
}
|
|
247276
247320
|
async function createVersion(artifacts, options = {}) {
|
|
247277
247321
|
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
247278
|
-
static_bundle: artifacts.files.map(
|
|
247279
|
-
|
|
247280
|
-
|
|
247281
|
-
|
|
247282
|
-
|
|
247322
|
+
static_bundle: artifacts.files.map(declaredFile),
|
|
247323
|
+
...artifacts.siteWorker ? {
|
|
247324
|
+
site_worker: {
|
|
247325
|
+
main: artifacts.siteWorker.main,
|
|
247326
|
+
modules: artifacts.siteWorker.modules.map(declaredFile),
|
|
247327
|
+
assets: artifacts.siteWorker.assets.map(declaredFile),
|
|
247328
|
+
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
247329
|
+
compatibility_flags: artifacts.siteWorker.compatibilityFlags
|
|
247330
|
+
}
|
|
247331
|
+
} : {},
|
|
247283
247332
|
entities: artifacts.entities,
|
|
247284
247333
|
agents: artifacts.agents,
|
|
247285
|
-
source_commit: options.sourceCommit
|
|
247286
|
-
frontend_commit: options.sourceCommit
|
|
247334
|
+
source_commit: options.sourceCommit
|
|
247287
247335
|
}, "declaring a version")).json(), "declare");
|
|
247336
|
+
const declaredFiles = [
|
|
247337
|
+
...artifacts.files,
|
|
247338
|
+
...artifacts.siteWorker?.modules ?? [],
|
|
247339
|
+
...artifacts.siteWorker?.assets ?? []
|
|
247340
|
+
];
|
|
247288
247341
|
options.progress?.onDeclared?.({
|
|
247289
|
-
fileCount:
|
|
247342
|
+
fileCount: declaredFiles.length,
|
|
247290
247343
|
owedFiles: declared.uploads.length
|
|
247291
247344
|
});
|
|
247292
|
-
|
|
247293
|
-
|
|
247294
|
-
|
|
247295
|
-
|
|
247296
|
-
|
|
247297
|
-
|
|
247298
|
-
|
|
247299
|
-
|
|
247300
|
-
|
|
247301
|
-
|
|
247302
|
-
|
|
247303
|
-
|
|
247304
|
-
}
|
|
247305
|
-
]))
|
|
247306
|
-
}, {
|
|
247307
|
-
concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY,
|
|
247308
|
-
onProgress: options.progress?.onUpload
|
|
247309
|
-
});
|
|
247345
|
+
if (declared.uploads.length !== declaredFiles.length) {
|
|
247346
|
+
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
247347
|
+
}
|
|
247348
|
+
let uploadedFiles = 0;
|
|
247349
|
+
await pMap(declared.uploads, async (upload, index) => {
|
|
247350
|
+
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
247351
|
+
uploadedFiles++;
|
|
247352
|
+
options.progress?.onUpload?.({
|
|
247353
|
+
uploadedFiles,
|
|
247354
|
+
totalFiles: declared.uploads.length
|
|
247355
|
+
});
|
|
247356
|
+
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
247310
247357
|
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
247311
247358
|
}
|
|
247312
|
-
async function
|
|
247313
|
-
return parse10(
|
|
247314
|
-
|
|
247359
|
+
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
247360
|
+
return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
|
|
247361
|
+
version_id: versionId,
|
|
247315
247362
|
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
247316
|
-
}, "
|
|
247363
|
+
}, "setting the environment's version")).json(), "environment");
|
|
247317
247364
|
}
|
|
247318
247365
|
|
|
247319
247366
|
// src/core/version/publish.ts
|
|
247320
247367
|
var STEP = Symbol.for("base44.publishStep");
|
|
247368
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
247321
247369
|
async function tagStep(step, run) {
|
|
247322
247370
|
try {
|
|
247323
247371
|
return await run();
|
|
@@ -247337,11 +247385,15 @@ async function publishVersion(artifacts, options = {}) {
|
|
|
247337
247385
|
concurrency: options.concurrency,
|
|
247338
247386
|
progress: options.progress
|
|
247339
247387
|
}));
|
|
247340
|
-
const
|
|
247341
|
-
target: options.target,
|
|
247388
|
+
const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
|
|
247342
247389
|
idempotencyKey: randomUUID4()
|
|
247343
247390
|
}));
|
|
247344
|
-
return {
|
|
247391
|
+
return {
|
|
247392
|
+
environment: environment.name,
|
|
247393
|
+
versionId: environment.versionId,
|
|
247394
|
+
manifestHash: environment.manifestHash,
|
|
247395
|
+
deploymentId: environment.deploymentId
|
|
247396
|
+
};
|
|
247345
247397
|
}
|
|
247346
247398
|
|
|
247347
247399
|
// src/cli/utils/command/Base44Command.ts
|
|
@@ -249709,56 +249761,54 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249709
249761
|
}
|
|
249710
249762
|
// src/core/version/artifacts.ts
|
|
249711
249763
|
import { createHash as createHash2 } from "node:crypto";
|
|
249712
|
-
import {
|
|
249713
|
-
|
|
249714
|
-
|
|
249715
|
-
var MAX_FILE_COUNT = 1e5;
|
|
249716
|
-
var ASSETS_IGNORE_FILE2 = ".assetsignore";
|
|
249717
|
-
var ALWAYS_IGNORED2 = new Set([
|
|
249718
|
-
ASSETS_IGNORE_FILE2,
|
|
249719
|
-
"wrangler.json",
|
|
249720
|
-
".dev.vars"
|
|
249721
|
-
]);
|
|
249764
|
+
import { join as join27, resolve as resolve10 } from "node:path";
|
|
249765
|
+
var MAX_FILE_COUNT = 50000;
|
|
249766
|
+
var HASH_CONCURRENCY = 32;
|
|
249722
249767
|
var ENTRY2 = "index.html";
|
|
249723
249768
|
async function digestFile(absolutePath) {
|
|
249724
|
-
const hash = createHash2("sha256");
|
|
249725
|
-
for await (const chunk of createReadStream3(absolutePath)) {
|
|
249726
|
-
hash.update(chunk);
|
|
249727
|
-
}
|
|
249769
|
+
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
249728
249770
|
return `sha256:${hash.digest("hex")}`;
|
|
249729
249771
|
}
|
|
249730
|
-
async function collectBuildOutput(outputDir) {
|
|
249731
|
-
const found = await
|
|
249732
|
-
|
|
249733
|
-
dot: true,
|
|
249734
|
-
onlyFiles: true,
|
|
249735
|
-
followSymbolicLinks: false,
|
|
249736
|
-
ignoreFiles: [ASSETS_IGNORE_FILE2]
|
|
249737
|
-
});
|
|
249738
|
-
const relativePaths = found.filter((path) => !ALWAYS_IGNORED2.has(basename6(path))).sort();
|
|
249739
|
-
if (relativePaths.length === 0) {
|
|
249772
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
249773
|
+
const found = await describeBuildOutput(outputDir);
|
|
249774
|
+
if (found.length === 0) {
|
|
249740
249775
|
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
249741
249776
|
hints: [
|
|
249742
249777
|
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
249743
249778
|
]
|
|
249744
249779
|
});
|
|
249745
249780
|
}
|
|
249746
|
-
if (
|
|
249747
|
-
throw new InvalidInputError(`Too many files: found ${
|
|
249781
|
+
if (found.length > MAX_FILE_COUNT) {
|
|
249782
|
+
throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
249748
249783
|
}
|
|
249749
|
-
if (!
|
|
249784
|
+
if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
|
|
249750
249785
|
throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
|
|
249751
249786
|
}
|
|
249752
|
-
return await
|
|
249753
|
-
|
|
249754
|
-
|
|
249755
|
-
|
|
249756
|
-
|
|
249787
|
+
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
249788
|
+
}
|
|
249789
|
+
async function collectSiteWorker(projectRoot) {
|
|
249790
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
249791
|
+
if (!built) {
|
|
249792
|
+
return null;
|
|
249793
|
+
}
|
|
249794
|
+
const { config, modules, assetsDir } = built;
|
|
249795
|
+
const entry = resolve10(config.configDir, config.main);
|
|
249796
|
+
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249797
|
+
if (!main) {
|
|
249798
|
+
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
249799
|
+
}
|
|
249800
|
+
return {
|
|
249801
|
+
main,
|
|
249802
|
+
modules: await pMap(modules, async ({ name, absolutePath, size }) => ({
|
|
249803
|
+
path: name,
|
|
249757
249804
|
absolutePath,
|
|
249758
249805
|
size,
|
|
249759
249806
|
digest: await digestFile(absolutePath)
|
|
249760
|
-
}
|
|
249761
|
-
|
|
249807
|
+
}), { concurrency: HASH_CONCURRENCY }),
|
|
249808
|
+
assets: assetsDir ? await collectBuildOutput(assetsDir, { requireEntry: false }) : [],
|
|
249809
|
+
compatibilityDate: config.compatibilityDate,
|
|
249810
|
+
compatibilityFlags: config.compatibilityFlags
|
|
249811
|
+
};
|
|
249762
249812
|
}
|
|
249763
249813
|
async function readRawResources(dir) {
|
|
249764
249814
|
if (!await pathExists(dir)) {
|
|
@@ -249790,7 +249840,7 @@ function versionsApiEnabled(env = process.env) {
|
|
|
249790
249840
|
return value === "1" || value === "true";
|
|
249791
249841
|
}
|
|
249792
249842
|
// src/core/version/project.ts
|
|
249793
|
-
import { dirname as dirname21, join as join28, resolve as
|
|
249843
|
+
import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
|
|
249794
249844
|
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249795
249845
|
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249796
249846
|
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
@@ -249807,7 +249857,7 @@ async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
|
249807
249857
|
}
|
|
249808
249858
|
function outputDirectory(project, root, override) {
|
|
249809
249859
|
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249810
|
-
return configured ?
|
|
249860
|
+
return configured ? resolve11(root, configured) : null;
|
|
249811
249861
|
}
|
|
249812
249862
|
function requireOutputDir(target) {
|
|
249813
249863
|
if (target.outputDir === null) {
|
|
@@ -249834,15 +249884,15 @@ async function readSettingsIfPresent(projectRoot) {
|
|
|
249834
249884
|
}
|
|
249835
249885
|
// src/cli/commands/project/build.ts
|
|
249836
249886
|
async function buildAction(ctx) {
|
|
249837
|
-
const
|
|
249838
|
-
const target = await resolvePublishTarget(app
|
|
249887
|
+
const app = requireApp(ctx);
|
|
249888
|
+
const target = await resolvePublishTarget(app.projectRoot);
|
|
249839
249889
|
await runSiteBuild(ctx, {
|
|
249840
249890
|
root: target.root,
|
|
249841
249891
|
buildCommand: target.buildCommand,
|
|
249842
|
-
appId: app
|
|
249892
|
+
appId: app.id
|
|
249843
249893
|
});
|
|
249844
249894
|
return {
|
|
249845
|
-
outroMessage: `Site built with app id ${theme.styles.bold(app
|
|
249895
|
+
outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
|
|
249846
249896
|
};
|
|
249847
249897
|
}
|
|
249848
249898
|
function getBuildCommand() {
|
|
@@ -249850,7 +249900,7 @@ function getBuildCommand() {
|
|
|
249850
249900
|
}
|
|
249851
249901
|
|
|
249852
249902
|
// src/cli/commands/project/create.ts
|
|
249853
|
-
import { basename as
|
|
249903
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
249854
249904
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249855
249905
|
|
|
249856
249906
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -250015,8 +250065,8 @@ async function createInteractive(options, ctx) {
|
|
|
250015
250065
|
name: () => {
|
|
250016
250066
|
return options.name ? Promise.resolve(options.name) : Ze({
|
|
250017
250067
|
message: "What is the name of your project?",
|
|
250018
|
-
placeholder:
|
|
250019
|
-
initialValue:
|
|
250068
|
+
placeholder: basename6(process.cwd()),
|
|
250069
|
+
initialValue: basename6(process.cwd()),
|
|
250020
250070
|
validate: (value) => {
|
|
250021
250071
|
if (!value || value.trim().length === 0) {
|
|
250022
250072
|
return "Every project deserves a name";
|
|
@@ -250046,7 +250096,7 @@ async function createInteractive(options, ctx) {
|
|
|
250046
250096
|
}, ctx);
|
|
250047
250097
|
}
|
|
250048
250098
|
async function createNonInteractive(options, ctx) {
|
|
250049
|
-
ctx.log.info(`Creating a new project at ${
|
|
250099
|
+
ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
|
|
250050
250100
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
250051
250101
|
return await executeCreate({
|
|
250052
250102
|
template,
|
|
@@ -250070,7 +250120,7 @@ async function executeCreate({
|
|
|
250070
250120
|
}, ctx) {
|
|
250071
250121
|
const { log, runTask } = ctx;
|
|
250072
250122
|
const name = rawName.trim();
|
|
250073
|
-
const resolvedPath =
|
|
250123
|
+
const resolvedPath = resolve12(projectPath);
|
|
250074
250124
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
250075
250125
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
250076
250126
|
return await createProjectFiles({
|
|
@@ -250707,11 +250757,11 @@ async function logsAction(ctx, options) {
|
|
|
250707
250757
|
function getLogsCommand() {
|
|
250708
250758
|
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all deployed functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option2("--level <level>", "Filter by log level").choices([
|
|
250709
250759
|
...LogLevelSchema.options
|
|
250710
|
-
])).option("-n, --limit <n>", "Results per page (1-1000; the server returns at most 500)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option2("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option2("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published).
|
|
250760
|
+
])).option("-n, --limit <n>", "Results per page (1-1000; the server returns at most 500)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option2("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option2("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Omit to read both.").choices([...LogEnvSchema.options])).action(logsAction);
|
|
250711
250761
|
}
|
|
250712
250762
|
|
|
250713
250763
|
// src/cli/commands/project/scaffold.ts
|
|
250714
|
-
import { basename as
|
|
250764
|
+
import { basename as basename7, resolve as resolve13 } from "node:path";
|
|
250715
250765
|
function resolveAppId(options) {
|
|
250716
250766
|
const appId = options.appId;
|
|
250717
250767
|
if (!appId) {
|
|
@@ -250727,8 +250777,8 @@ function resolveAppId(options) {
|
|
|
250727
250777
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250728
250778
|
const { log, runTask } = ctx;
|
|
250729
250779
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250730
|
-
const resolvedPath =
|
|
250731
|
-
const projectName = (name ??
|
|
250780
|
+
const resolvedPath = resolve13("./");
|
|
250781
|
+
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250732
250782
|
const template = await getTemplateById("backend-only");
|
|
250733
250783
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
250734
250784
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -250802,24 +250852,28 @@ function concurrencyOption() {
|
|
|
250802
250852
|
|
|
250803
250853
|
// src/cli/commands/publish.ts
|
|
250804
250854
|
async function publishAction(ctx, options) {
|
|
250805
|
-
const { runTask, log, jsonMode
|
|
250806
|
-
const
|
|
250855
|
+
const { runTask, log, jsonMode } = ctx;
|
|
250856
|
+
const app = requireApp(ctx);
|
|
250857
|
+
const target = await resolvePublishTarget(app.projectRoot, {
|
|
250807
250858
|
outputDir: options.outputDir
|
|
250808
250859
|
});
|
|
250809
250860
|
if (options.build !== false) {
|
|
250810
250861
|
await tagStep("build", () => runSiteBuild(ctx, {
|
|
250811
250862
|
root: target.root,
|
|
250812
250863
|
buildCommand: target.buildCommand,
|
|
250813
|
-
appId: app
|
|
250864
|
+
appId: app.id
|
|
250814
250865
|
}));
|
|
250815
250866
|
}
|
|
250816
|
-
const outputDir = requireOutputDir(target);
|
|
250817
250867
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250818
250868
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250819
|
-
const artifacts = {
|
|
250820
|
-
|
|
250821
|
-
|
|
250822
|
-
|
|
250869
|
+
const artifacts = await tagStep("create_version", async () => {
|
|
250870
|
+
const siteWorker = await collectSiteWorker(target.root);
|
|
250871
|
+
return {
|
|
250872
|
+
files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target)),
|
|
250873
|
+
...siteWorker ? { siteWorker } : {},
|
|
250874
|
+
...await collectResources(target.configDir, target)
|
|
250875
|
+
};
|
|
250876
|
+
});
|
|
250823
250877
|
return await publishVersion(artifacts, {
|
|
250824
250878
|
sourceCommit: gitHash,
|
|
250825
250879
|
target: options.target,
|
|
@@ -250831,10 +250885,10 @@ async function publishAction(ctx, options) {
|
|
|
250831
250885
|
});
|
|
250832
250886
|
}, { successMessage: "Published", errorMessage: "Publish failed" });
|
|
250833
250887
|
if (!jsonMode) {
|
|
250834
|
-
log.message(theme.styles.dim(`version ${result.versionId}
|
|
250888
|
+
log.message(theme.styles.dim(`version ${result.versionId}`));
|
|
250835
250889
|
}
|
|
250836
250890
|
return {
|
|
250837
|
-
outroMessage:
|
|
250891
|
+
outroMessage: `${result.environment} now serves ${result.versionId}`,
|
|
250838
250892
|
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
250839
250893
|
` : undefined
|
|
250840
250894
|
};
|
|
@@ -251212,7 +251266,7 @@ function getSecretsListCommand() {
|
|
|
251212
251266
|
}
|
|
251213
251267
|
|
|
251214
251268
|
// src/cli/commands/secrets/set.ts
|
|
251215
|
-
import { resolve as
|
|
251269
|
+
import { resolve as resolve14 } from "node:path";
|
|
251216
251270
|
function parseEntries(entries) {
|
|
251217
251271
|
const secrets = {};
|
|
251218
251272
|
for (const entry of entries) {
|
|
@@ -251243,7 +251297,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
251243
251297
|
validateInput(entries, options);
|
|
251244
251298
|
let secrets;
|
|
251245
251299
|
if (options.envFile) {
|
|
251246
|
-
secrets = await parseEnvFile(
|
|
251300
|
+
secrets = await parseEnvFile(resolve14(options.envFile));
|
|
251247
251301
|
if (Object.keys(secrets).length === 0) {
|
|
251248
251302
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
251249
251303
|
}
|
|
@@ -251272,7 +251326,7 @@ function getSecretsCommand() {
|
|
|
251272
251326
|
}
|
|
251273
251327
|
|
|
251274
251328
|
// src/cli/commands/site/deploy.ts
|
|
251275
|
-
import { resolve as
|
|
251329
|
+
import { resolve as resolve15 } from "node:path";
|
|
251276
251330
|
async function deployAction2(ctx, options) {
|
|
251277
251331
|
const { isNonInteractive } = ctx;
|
|
251278
251332
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251350,7 +251404,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251350
251404
|
}
|
|
251351
251405
|
function siteOutputDir(project) {
|
|
251352
251406
|
const outputDirectory = project.site?.outputDirectory;
|
|
251353
|
-
return outputDirectory ?
|
|
251407
|
+
return outputDirectory ? resolve15(project.root, outputDirectory) : null;
|
|
251354
251408
|
}
|
|
251355
251409
|
function getSiteDeployCommand() {
|
|
251356
251410
|
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)");
|
|
@@ -251567,18 +251621,21 @@ function getVersionCreateCommand() {
|
|
|
251567
251621
|
// src/cli/commands/versions/deploy.ts
|
|
251568
251622
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
251569
251623
|
async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
251570
|
-
const
|
|
251571
|
-
|
|
251624
|
+
const environment = options.target ?? DEFAULT_ENVIRONMENT;
|
|
251625
|
+
const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
|
|
251572
251626
|
idempotencyKey: randomUUID5()
|
|
251573
|
-
}), {
|
|
251627
|
+
}), {
|
|
251628
|
+
successMessage: "Environment updated",
|
|
251629
|
+
errorMessage: "Could not update the environment"
|
|
251630
|
+
});
|
|
251574
251631
|
return {
|
|
251575
|
-
outroMessage:
|
|
251576
|
-
stdout: jsonMode ? `${JSON.stringify(
|
|
251632
|
+
outroMessage: `${result.name} now serves ${result.versionId}`,
|
|
251633
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
251577
251634
|
` : undefined
|
|
251578
251635
|
};
|
|
251579
251636
|
}
|
|
251580
251637
|
function getVersionDeployCommand() {
|
|
251581
|
-
return new Base44Command("deploy").description("
|
|
251638
|
+
return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to point at it").action(deployAction3);
|
|
251582
251639
|
}
|
|
251583
251640
|
|
|
251584
251641
|
// src/cli/commands/versions/index.ts
|
|
@@ -253909,11 +253966,11 @@ import { relative as relative9 } from "node:path";
|
|
|
253909
253966
|
// ../../node_modules/chokidar/index.js
|
|
253910
253967
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
253911
253968
|
import { stat as statcb, Stats } from "node:fs";
|
|
253912
|
-
import { readdir as readdir3, stat as
|
|
253969
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
253913
253970
|
import * as sp3 from "node:path";
|
|
253914
253971
|
|
|
253915
253972
|
// ../../node_modules/readdirp/index.js
|
|
253916
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
253973
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
|
|
253917
253974
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
253918
253975
|
import { Readable as Readable6 } from "node:stream";
|
|
253919
253976
|
var EntryTypes = {
|
|
@@ -253995,7 +254052,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
253995
254052
|
const { root, type } = opts;
|
|
253996
254053
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
253997
254054
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
253998
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
254055
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
253999
254056
|
if (wantBigintFsStats) {
|
|
254000
254057
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
254001
254058
|
} else {
|
|
@@ -254148,7 +254205,7 @@ function readdirp(root, options = {}) {
|
|
|
254148
254205
|
|
|
254149
254206
|
// ../../node_modules/chokidar/handler.js
|
|
254150
254207
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
254151
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
254208
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
|
|
254152
254209
|
import { type as osType } from "node:os";
|
|
254153
254210
|
import * as sp2 from "node:path";
|
|
254154
254211
|
var STR_DATA = "data";
|
|
@@ -254174,7 +254231,7 @@ var EVENTS = {
|
|
|
254174
254231
|
};
|
|
254175
254232
|
var EV = EVENTS;
|
|
254176
254233
|
var THROTTLE_MODE_WATCH = "watch";
|
|
254177
|
-
var statMethods = { lstat: lstat3, stat:
|
|
254234
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
254178
254235
|
var KEY_LISTENERS = "listeners";
|
|
254179
254236
|
var KEY_ERR = "errHandlers";
|
|
254180
254237
|
var KEY_RAW = "rawEmitters";
|
|
@@ -254645,7 +254702,7 @@ class NodeFsHandler {
|
|
|
254645
254702
|
return;
|
|
254646
254703
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
254647
254704
|
try {
|
|
254648
|
-
const newStats = await
|
|
254705
|
+
const newStats = await stat5(file);
|
|
254649
254706
|
if (this.fsw.closed)
|
|
254650
254707
|
return;
|
|
254651
254708
|
const at = newStats.atimeMs;
|
|
@@ -255317,7 +255374,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
255317
255374
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
255318
255375
|
let stats;
|
|
255319
255376
|
try {
|
|
255320
|
-
stats = await
|
|
255377
|
+
stats = await stat6(fullPath);
|
|
255321
255378
|
} catch (err) {}
|
|
255322
255379
|
if (!stats || this.closed)
|
|
255323
255380
|
return;
|
|
@@ -256099,7 +256156,7 @@ Examples:
|
|
|
256099
256156
|
}
|
|
256100
256157
|
|
|
256101
256158
|
// src/cli/commands/project/eject.ts
|
|
256102
|
-
import { resolve as
|
|
256159
|
+
import { resolve as resolve19 } from "node:path";
|
|
256103
256160
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256104
256161
|
async function eject(ctx, options, command) {
|
|
256105
256162
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -256163,7 +256220,7 @@ async function eject(ctx, options, command) {
|
|
|
256163
256220
|
Ne("Operation cancelled.");
|
|
256164
256221
|
throw new CLIExitError(0);
|
|
256165
256222
|
}
|
|
256166
|
-
const resolvedPath =
|
|
256223
|
+
const resolvedPath = resolve19(selectedPath);
|
|
256167
256224
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
256168
256225
|
await createProjectFilesForExistingProject({
|
|
256169
256226
|
projectId,
|
|
@@ -258307,7 +258364,7 @@ class ReduceableCache {
|
|
|
258307
258364
|
}
|
|
258308
258365
|
}
|
|
258309
258366
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
258310
|
-
import { createReadStream as
|
|
258367
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
258311
258368
|
import { createInterface as createInterface2 } from "node:readline";
|
|
258312
258369
|
var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
|
|
258313
258370
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
|
|
@@ -258351,7 +258408,7 @@ async function addSourceContext(frames) {
|
|
|
258351
258408
|
}
|
|
258352
258409
|
function getContextLinesFromFile(path, ranges, output) {
|
|
258353
258410
|
return new Promise((resolve) => {
|
|
258354
|
-
const stream =
|
|
258411
|
+
const stream = createReadStream3(path);
|
|
258355
258412
|
const lineReaded = createInterface2({
|
|
258356
258413
|
input: stream
|
|
258357
258414
|
});
|
|
@@ -260302,4 +260359,4 @@ export {
|
|
|
260302
260359
|
runCLI
|
|
260303
260360
|
};
|
|
260304
260361
|
|
|
260305
|
-
//# debugId=
|
|
260362
|
+
//# debugId=A3CC3878ECA39CF664756E2164756E21
|