@base44-preview/cli 0.1.18-pr.635.c3a4ce4 → 0.1.18-pr.635.dff0e6d
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 +748 -320
- package/dist/cli/index.js.map +30 -19
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -31177,7 +31177,7 @@ function cleanDoc(doc) {
|
|
|
31177
31177
|
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
31178
31178
|
}
|
|
31179
31179
|
function replaceEndOfLine(doc, replacement = literalline) {
|
|
31180
|
-
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ?
|
|
31180
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join30(replacement, currentDoc.split(`
|
|
31181
31181
|
`)) : currentDoc);
|
|
31182
31182
|
}
|
|
31183
31183
|
function canBreakFn(doc) {
|
|
@@ -31257,7 +31257,7 @@ function indentIfBreak(contents, options) {
|
|
|
31257
31257
|
negate: options.negate
|
|
31258
31258
|
};
|
|
31259
31259
|
}
|
|
31260
|
-
function
|
|
31260
|
+
function join30(separator, docs) {
|
|
31261
31261
|
assertDoc(separator);
|
|
31262
31262
|
assertDocArray(docs);
|
|
31263
31263
|
const parts = [];
|
|
@@ -31968,7 +31968,7 @@ var init_doc = __esm(() => {
|
|
|
31968
31968
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31969
31969
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31970
31970
|
builders = {
|
|
31971
|
-
join:
|
|
31971
|
+
join: join30,
|
|
31972
31972
|
line,
|
|
31973
31973
|
softline,
|
|
31974
31974
|
hardline,
|
|
@@ -228670,6 +228670,20 @@ function isCLIError(error) {
|
|
|
228670
228670
|
function isUserError(error) {
|
|
228671
228671
|
return error instanceof UserError;
|
|
228672
228672
|
}
|
|
228673
|
+
var STEP = Symbol.for("base44.commandStep");
|
|
228674
|
+
async function tagStep(step, run) {
|
|
228675
|
+
try {
|
|
228676
|
+
return await run();
|
|
228677
|
+
} catch (error) {
|
|
228678
|
+
if (error !== null && typeof error === "object" && !(STEP in error) && Object.isExtensible(error)) {
|
|
228679
|
+
Object.defineProperty(error, STEP, { value: step, enumerable: false });
|
|
228680
|
+
}
|
|
228681
|
+
throw error;
|
|
228682
|
+
}
|
|
228683
|
+
}
|
|
228684
|
+
function stepOf(error) {
|
|
228685
|
+
return error !== null && typeof error === "object" && STEP in error ? error[STEP] : undefined;
|
|
228686
|
+
}
|
|
228673
228687
|
|
|
228674
228688
|
// src/core/utils/fs.ts
|
|
228675
228689
|
async function pathExists(path) {
|
|
@@ -228796,7 +228810,7 @@ function normalizeBase44Env() {
|
|
|
228796
228810
|
loadProjectEnvFiles();
|
|
228797
228811
|
|
|
228798
228812
|
// src/cli/index.ts
|
|
228799
|
-
import { dirname as
|
|
228813
|
+
import { dirname as dirname29, join as join39 } from "node:path";
|
|
228800
228814
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
228801
228815
|
|
|
228802
228816
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -230721,10 +230735,7 @@ var SiteConfigSchema = object({
|
|
|
230721
230735
|
buildCommand: string2().default("npm run build"),
|
|
230722
230736
|
serveCommand: string2().optional(),
|
|
230723
230737
|
outputDirectory: string2().optional(),
|
|
230724
|
-
installCommand: string2().default("npm install")
|
|
230725
|
-
devHostFlag: string2().default("--host"),
|
|
230726
|
-
devHost: string2().default("0.0.0.0"),
|
|
230727
|
-
devPort: number2().int().min(1).max(65535).default(5173)
|
|
230738
|
+
installCommand: string2().default("npm install")
|
|
230728
230739
|
});
|
|
230729
230740
|
var PluginMetadataSchema = object({
|
|
230730
230741
|
namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
@@ -239608,91 +239619,8 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
239608
239619
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
239609
239620
|
import { join as join18 } from "node:path";
|
|
239610
239621
|
|
|
239611
|
-
// src/core/site/manifest.ts
|
|
239612
|
-
import { createHash } from "node:crypto";
|
|
239613
|
-
import { createReadStream } from "node:fs";
|
|
239614
|
-
import { stat } from "node:fs/promises";
|
|
239615
|
-
import { basename as basename5, extname, join as join16 } from "node:path";
|
|
239616
|
-
var MAX_ASSET_COUNT = 1e5;
|
|
239617
|
-
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239618
|
-
var ALWAYS_IGNORED = new Set([
|
|
239619
|
-
ASSETS_IGNORE_FILE,
|
|
239620
|
-
"wrangler.json",
|
|
239621
|
-
".dev.vars"
|
|
239622
|
-
]);
|
|
239623
|
-
var MIME_TYPES = {
|
|
239624
|
-
".html": "text/html",
|
|
239625
|
-
".htm": "text/html",
|
|
239626
|
-
".css": "text/css",
|
|
239627
|
-
".js": "text/javascript",
|
|
239628
|
-
".mjs": "text/javascript",
|
|
239629
|
-
".json": "application/json",
|
|
239630
|
-
".map": "application/json",
|
|
239631
|
-
".txt": "text/plain",
|
|
239632
|
-
".xml": "application/xml",
|
|
239633
|
-
".svg": "image/svg+xml",
|
|
239634
|
-
".png": "image/png",
|
|
239635
|
-
".jpg": "image/jpeg",
|
|
239636
|
-
".jpeg": "image/jpeg",
|
|
239637
|
-
".gif": "image/gif",
|
|
239638
|
-
".webp": "image/webp",
|
|
239639
|
-
".avif": "image/avif",
|
|
239640
|
-
".ico": "image/x-icon",
|
|
239641
|
-
".woff": "font/woff",
|
|
239642
|
-
".woff2": "font/woff2",
|
|
239643
|
-
".ttf": "font/ttf",
|
|
239644
|
-
".otf": "font/otf",
|
|
239645
|
-
".eot": "application/vnd.ms-fontobject",
|
|
239646
|
-
".mp3": "audio/mpeg",
|
|
239647
|
-
".mp4": "video/mp4",
|
|
239648
|
-
".webm": "video/webm",
|
|
239649
|
-
".pdf": "application/pdf",
|
|
239650
|
-
".wasm": "application/wasm",
|
|
239651
|
-
".webmanifest": "application/manifest+json"
|
|
239652
|
-
};
|
|
239653
|
-
function getAssetContentType(filePath) {
|
|
239654
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239655
|
-
}
|
|
239656
|
-
async function hashAssetFile(appId, absolutePath) {
|
|
239657
|
-
const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
|
|
239658
|
-
for await (const chunk of createReadStream(absolutePath)) {
|
|
239659
|
-
hash.update(chunk);
|
|
239660
|
-
}
|
|
239661
|
-
return hash.digest("hex").slice(0, 32);
|
|
239662
|
-
}
|
|
239663
|
-
async function buildAssetManifest(assetsDir, appId) {
|
|
239664
|
-
const manifest = {};
|
|
239665
|
-
const filesByHash = new Map;
|
|
239666
|
-
const found = await globby("**/*", {
|
|
239667
|
-
cwd: assetsDir,
|
|
239668
|
-
dot: true,
|
|
239669
|
-
onlyFiles: true,
|
|
239670
|
-
followSymbolicLinks: false,
|
|
239671
|
-
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239672
|
-
});
|
|
239673
|
-
const relativeFilePaths = found.filter((path) => !ALWAYS_IGNORED.has(basename5(path)));
|
|
239674
|
-
if (relativeFilePaths.length > MAX_ASSET_COUNT) {
|
|
239675
|
-
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239676
|
-
}
|
|
239677
|
-
for (const relativePath of relativeFilePaths.sort()) {
|
|
239678
|
-
const absolutePath = join16(assetsDir, ...relativePath.split("/"));
|
|
239679
|
-
const { size } = await stat(absolutePath);
|
|
239680
|
-
const hash = await hashAssetFile(appId, absolutePath);
|
|
239681
|
-
manifest[`/${relativePath}`] = { hash, size };
|
|
239682
|
-
if (!filesByHash.has(hash)) {
|
|
239683
|
-
filesByHash.set(hash, {
|
|
239684
|
-
absolutePath,
|
|
239685
|
-
hash,
|
|
239686
|
-
size,
|
|
239687
|
-
contentType: getAssetContentType(absolutePath)
|
|
239688
|
-
});
|
|
239689
|
-
}
|
|
239690
|
-
}
|
|
239691
|
-
return { manifest, filesByHash };
|
|
239692
|
-
}
|
|
239693
|
-
|
|
239694
239622
|
// src/core/site/modules.ts
|
|
239695
|
-
import { stat
|
|
239623
|
+
import { stat } from "node:fs/promises";
|
|
239696
239624
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239697
239625
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239698
239626
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239767,7 +239695,7 @@ async function collectModules(config) {
|
|
|
239767
239695
|
const modules = [...modulesByName.values()];
|
|
239768
239696
|
let totalBytes = 0;
|
|
239769
239697
|
for (const module of modules) {
|
|
239770
|
-
module.size = (await
|
|
239698
|
+
module.size = (await stat(module.absolutePath)).size;
|
|
239771
239699
|
totalBytes += module.size;
|
|
239772
239700
|
}
|
|
239773
239701
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239786,8 +239714,104 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239786
239714
|
});
|
|
239787
239715
|
}
|
|
239788
239716
|
|
|
239789
|
-
// src/core/site/
|
|
239790
|
-
import {
|
|
239717
|
+
// src/core/site/wrangler-config.ts
|
|
239718
|
+
import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
|
|
239719
|
+
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
239720
|
+
var RedirectConfigSchema = looseObject({
|
|
239721
|
+
configPath: string2().min(1)
|
|
239722
|
+
});
|
|
239723
|
+
var WranglerConfigSchema = looseObject({
|
|
239724
|
+
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
239725
|
+
no_bundle: boolean2().optional(),
|
|
239726
|
+
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
239727
|
+
assets: looseObject({
|
|
239728
|
+
directory: string2().optional(),
|
|
239729
|
+
html_handling: string2().optional(),
|
|
239730
|
+
not_found_handling: string2().optional(),
|
|
239731
|
+
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
239732
|
+
headers: string2().optional(),
|
|
239733
|
+
redirects: string2().optional()
|
|
239734
|
+
}).optional(),
|
|
239735
|
+
compatibility_date: string2().optional(),
|
|
239736
|
+
compatibility_flags: array(string2()).optional(),
|
|
239737
|
+
vars: record(string2(), unknown()).optional(),
|
|
239738
|
+
upload_source_maps: boolean2().optional()
|
|
239739
|
+
});
|
|
239740
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
239741
|
+
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
239742
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
239743
|
+
}
|
|
239744
|
+
async function resolveWranglerConfig(redirectPath) {
|
|
239745
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
239746
|
+
const parsed = await readJsonFile(configPath);
|
|
239747
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
239748
|
+
if (!result.success) {
|
|
239749
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
239750
|
+
}
|
|
239751
|
+
const config = result.data;
|
|
239752
|
+
if (config.no_bundle !== true) {
|
|
239753
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
239754
|
+
}
|
|
239755
|
+
const configDir = dirname12(configPath);
|
|
239756
|
+
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
239757
|
+
return {
|
|
239758
|
+
configPath,
|
|
239759
|
+
configDir,
|
|
239760
|
+
main: config.main,
|
|
239761
|
+
assetsDirectory,
|
|
239762
|
+
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
239763
|
+
compatibilityDate: config.compatibility_date ?? null,
|
|
239764
|
+
compatibilityFlags: config.compatibility_flags ?? [],
|
|
239765
|
+
rules: (config.rules ?? []).map((rule) => ({
|
|
239766
|
+
type: rule.type,
|
|
239767
|
+
globs: rule.globs
|
|
239768
|
+
})),
|
|
239769
|
+
uploadSourceMaps: config.upload_source_maps ?? false
|
|
239770
|
+
};
|
|
239771
|
+
}
|
|
239772
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
239773
|
+
const parsed = await readJsonFile(redirectPath);
|
|
239774
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
239775
|
+
if (!result.success) {
|
|
239776
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
239777
|
+
}
|
|
239778
|
+
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
239779
|
+
if (!await pathExists(configPath)) {
|
|
239780
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
239781
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
239782
|
+
});
|
|
239783
|
+
}
|
|
239784
|
+
return configPath;
|
|
239785
|
+
}
|
|
239786
|
+
function toResolvedAssetsConfig(assets) {
|
|
239787
|
+
return {
|
|
239788
|
+
htmlHandling: assets.html_handling,
|
|
239789
|
+
notFoundHandling: assets.not_found_handling,
|
|
239790
|
+
runWorkerFirst: assets.run_worker_first,
|
|
239791
|
+
headers: assets.headers,
|
|
239792
|
+
redirects: assets.redirects
|
|
239793
|
+
};
|
|
239794
|
+
}
|
|
239795
|
+
|
|
239796
|
+
// src/core/site/full-stack.ts
|
|
239797
|
+
async function resolveFullStackBuild(projectRoot) {
|
|
239798
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
239799
|
+
if (!redirectPath) {
|
|
239800
|
+
return null;
|
|
239801
|
+
}
|
|
239802
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
239803
|
+
return {
|
|
239804
|
+
config,
|
|
239805
|
+
modules: await collectModules(config),
|
|
239806
|
+
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
239807
|
+
};
|
|
239808
|
+
}
|
|
239809
|
+
|
|
239810
|
+
// src/core/site/manifest.ts
|
|
239811
|
+
import { createHash } from "node:crypto";
|
|
239812
|
+
import { createReadStream } from "node:fs";
|
|
239813
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
239814
|
+
import { basename as basename5, extname, join as join17 } from "node:path";
|
|
239791
239815
|
|
|
239792
239816
|
// ../../node_modules/p-map/index.js
|
|
239793
239817
|
async function pMap(iterable, mapper, {
|
|
@@ -239913,7 +239937,99 @@ async function pMap(iterable, mapper, {
|
|
|
239913
239937
|
}
|
|
239914
239938
|
var pMapSkip = Symbol("skip");
|
|
239915
239939
|
|
|
239940
|
+
// src/core/site/manifest.ts
|
|
239941
|
+
var MAX_ASSET_COUNT = 1e5;
|
|
239942
|
+
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239943
|
+
var ALWAYS_IGNORED = new Set([
|
|
239944
|
+
ASSETS_IGNORE_FILE,
|
|
239945
|
+
"wrangler.json",
|
|
239946
|
+
".dev.vars"
|
|
239947
|
+
]);
|
|
239948
|
+
var MIME_TYPES = {
|
|
239949
|
+
".html": "text/html",
|
|
239950
|
+
".htm": "text/html",
|
|
239951
|
+
".css": "text/css",
|
|
239952
|
+
".js": "text/javascript",
|
|
239953
|
+
".mjs": "text/javascript",
|
|
239954
|
+
".json": "application/json",
|
|
239955
|
+
".map": "application/json",
|
|
239956
|
+
".txt": "text/plain",
|
|
239957
|
+
".xml": "application/xml",
|
|
239958
|
+
".svg": "image/svg+xml",
|
|
239959
|
+
".png": "image/png",
|
|
239960
|
+
".jpg": "image/jpeg",
|
|
239961
|
+
".jpeg": "image/jpeg",
|
|
239962
|
+
".gif": "image/gif",
|
|
239963
|
+
".webp": "image/webp",
|
|
239964
|
+
".avif": "image/avif",
|
|
239965
|
+
".ico": "image/x-icon",
|
|
239966
|
+
".woff": "font/woff",
|
|
239967
|
+
".woff2": "font/woff2",
|
|
239968
|
+
".ttf": "font/ttf",
|
|
239969
|
+
".otf": "font/otf",
|
|
239970
|
+
".eot": "application/vnd.ms-fontobject",
|
|
239971
|
+
".mp3": "audio/mpeg",
|
|
239972
|
+
".mp4": "video/mp4",
|
|
239973
|
+
".webm": "video/webm",
|
|
239974
|
+
".pdf": "application/pdf",
|
|
239975
|
+
".wasm": "application/wasm",
|
|
239976
|
+
".webmanifest": "application/manifest+json"
|
|
239977
|
+
};
|
|
239978
|
+
function getAssetContentType(filePath) {
|
|
239979
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239980
|
+
}
|
|
239981
|
+
async function walkBuildOutput(outputDir) {
|
|
239982
|
+
const found = await globby("**/*", {
|
|
239983
|
+
cwd: outputDir,
|
|
239984
|
+
dot: true,
|
|
239985
|
+
onlyFiles: true,
|
|
239986
|
+
followSymbolicLinks: false,
|
|
239987
|
+
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239988
|
+
});
|
|
239989
|
+
return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
|
|
239990
|
+
}
|
|
239991
|
+
var STAT_CONCURRENCY = 32;
|
|
239992
|
+
async function describeBuildOutput(outputDir) {
|
|
239993
|
+
const relativePaths = await walkBuildOutput(outputDir);
|
|
239994
|
+
return await pMap(relativePaths, async (path) => {
|
|
239995
|
+
const absolutePath = join17(outputDir, ...path.split("/"));
|
|
239996
|
+
return { path, absolutePath, size: (await stat2(absolutePath)).size };
|
|
239997
|
+
}, { concurrency: STAT_CONCURRENCY });
|
|
239998
|
+
}
|
|
239999
|
+
async function hashFileInto(hash, absolutePath) {
|
|
240000
|
+
for await (const chunk of createReadStream(absolutePath)) {
|
|
240001
|
+
hash.update(chunk);
|
|
240002
|
+
}
|
|
240003
|
+
return hash;
|
|
240004
|
+
}
|
|
240005
|
+
async function hashAssetFile(appId, absolutePath) {
|
|
240006
|
+
const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
|
|
240007
|
+
return hash.digest("hex").slice(0, 32);
|
|
240008
|
+
}
|
|
240009
|
+
async function buildAssetManifest(assetsDir, appId) {
|
|
240010
|
+
const manifest = {};
|
|
240011
|
+
const filesByHash = new Map;
|
|
240012
|
+
const files = await describeBuildOutput(assetsDir);
|
|
240013
|
+
if (files.length > MAX_ASSET_COUNT) {
|
|
240014
|
+
throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
240015
|
+
}
|
|
240016
|
+
for (const { path: relativePath, absolutePath, size } of files) {
|
|
240017
|
+
const hash = await hashAssetFile(appId, absolutePath);
|
|
240018
|
+
manifest[`/${relativePath}`] = { hash, size };
|
|
240019
|
+
if (!filesByHash.has(hash)) {
|
|
240020
|
+
filesByHash.set(hash, {
|
|
240021
|
+
absolutePath,
|
|
240022
|
+
hash,
|
|
240023
|
+
size,
|
|
240024
|
+
contentType: getAssetContentType(absolutePath)
|
|
240025
|
+
});
|
|
240026
|
+
}
|
|
240027
|
+
}
|
|
240028
|
+
return { manifest, filesByHash };
|
|
240029
|
+
}
|
|
240030
|
+
|
|
239916
240031
|
// src/core/site/upload.ts
|
|
240032
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239917
240033
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
239918
240034
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
239919
240035
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -240012,11 +240128,17 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240012
240128
|
if (!file) {
|
|
240013
240129
|
throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
|
|
240014
240130
|
}
|
|
240015
|
-
|
|
240131
|
+
await putPresigned(upload, file.absolutePath);
|
|
240132
|
+
}
|
|
240133
|
+
async function putPresigned(upload, absolutePath) {
|
|
240134
|
+
const content = await readFile2(absolutePath);
|
|
240016
240135
|
try {
|
|
240017
240136
|
await distribution_default.put(upload.url, {
|
|
240018
240137
|
body: new Uint8Array(content),
|
|
240019
|
-
headers: {
|
|
240138
|
+
headers: {
|
|
240139
|
+
"Content-Type": upload.contentType,
|
|
240140
|
+
...upload.checksumSha256 ? { "x-amz-checksum-sha256": upload.checksumSha256 } : {}
|
|
240141
|
+
},
|
|
240020
240142
|
timeout: 120000,
|
|
240021
240143
|
retry: UPLOAD_RETRY
|
|
240022
240144
|
});
|
|
@@ -240025,85 +240147,6 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240025
240147
|
}
|
|
240026
240148
|
}
|
|
240027
240149
|
|
|
240028
|
-
// src/core/site/wrangler-config.ts
|
|
240029
|
-
import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
|
|
240030
|
-
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
240031
|
-
var RedirectConfigSchema = looseObject({
|
|
240032
|
-
configPath: string2().min(1)
|
|
240033
|
-
});
|
|
240034
|
-
var WranglerConfigSchema = looseObject({
|
|
240035
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
240036
|
-
no_bundle: boolean2().optional(),
|
|
240037
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
240038
|
-
assets: looseObject({
|
|
240039
|
-
directory: string2().optional(),
|
|
240040
|
-
html_handling: string2().optional(),
|
|
240041
|
-
not_found_handling: string2().optional(),
|
|
240042
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
240043
|
-
headers: string2().optional(),
|
|
240044
|
-
redirects: string2().optional()
|
|
240045
|
-
}).optional(),
|
|
240046
|
-
compatibility_date: string2().optional(),
|
|
240047
|
-
compatibility_flags: array(string2()).optional(),
|
|
240048
|
-
vars: record(string2(), unknown()).optional(),
|
|
240049
|
-
upload_source_maps: boolean2().optional()
|
|
240050
|
-
});
|
|
240051
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
240052
|
-
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
240053
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
240054
|
-
}
|
|
240055
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
240056
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
240057
|
-
const parsed = await readJsonFile(configPath);
|
|
240058
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
240059
|
-
if (!result.success) {
|
|
240060
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
240061
|
-
}
|
|
240062
|
-
const config = result.data;
|
|
240063
|
-
if (config.no_bundle !== true) {
|
|
240064
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
240065
|
-
}
|
|
240066
|
-
const configDir = dirname12(configPath);
|
|
240067
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
240068
|
-
return {
|
|
240069
|
-
configPath,
|
|
240070
|
-
configDir,
|
|
240071
|
-
main: config.main,
|
|
240072
|
-
assetsDirectory,
|
|
240073
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
240074
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
240075
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
240076
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
240077
|
-
type: rule.type,
|
|
240078
|
-
globs: rule.globs
|
|
240079
|
-
})),
|
|
240080
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
240081
|
-
};
|
|
240082
|
-
}
|
|
240083
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
240084
|
-
const parsed = await readJsonFile(redirectPath);
|
|
240085
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
240086
|
-
if (!result.success) {
|
|
240087
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
240088
|
-
}
|
|
240089
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
240090
|
-
if (!await pathExists(configPath)) {
|
|
240091
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
240092
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
240093
|
-
});
|
|
240094
|
-
}
|
|
240095
|
-
return configPath;
|
|
240096
|
-
}
|
|
240097
|
-
function toResolvedAssetsConfig(assets) {
|
|
240098
|
-
return {
|
|
240099
|
-
htmlHandling: assets.html_handling,
|
|
240100
|
-
notFoundHandling: assets.not_found_handling,
|
|
240101
|
-
runWorkerFirst: assets.run_worker_first,
|
|
240102
|
-
headers: assets.headers,
|
|
240103
|
-
redirects: assets.redirects
|
|
240104
|
-
};
|
|
240105
|
-
}
|
|
240106
|
-
|
|
240107
240150
|
// src/core/site/deployment.ts
|
|
240108
240151
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240109
240152
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240133,12 +240176,11 @@ async function deployToDeployments(options) {
|
|
|
240133
240176
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240134
240177
|
}
|
|
240135
240178
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240136
|
-
const
|
|
240137
|
-
if (!
|
|
240179
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
240180
|
+
if (!built) {
|
|
240138
240181
|
return null;
|
|
240139
240182
|
}
|
|
240140
|
-
const config =
|
|
240141
|
-
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240183
|
+
const { config, modules, assetsDir } = built;
|
|
240142
240184
|
return {
|
|
240143
240185
|
config: {
|
|
240144
240186
|
main: config.main,
|
|
@@ -240146,7 +240188,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240146
240188
|
compatibility_flags: config.compatibilityFlags,
|
|
240147
240189
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240148
240190
|
},
|
|
240149
|
-
modules
|
|
240191
|
+
modules,
|
|
240150
240192
|
assetsDir
|
|
240151
240193
|
};
|
|
240152
240194
|
}
|
|
@@ -246699,6 +246741,13 @@ async function resolveGitHash(projectRoot, explicit) {
|
|
|
246699
246741
|
}
|
|
246700
246742
|
return hash;
|
|
246701
246743
|
}
|
|
246744
|
+
async function resolveProvenanceCommit(projectRoot, explicit) {
|
|
246745
|
+
if (explicit) {
|
|
246746
|
+
return await resolveGitHash(projectRoot, explicit);
|
|
246747
|
+
}
|
|
246748
|
+
const hash = await gitHead(projectRoot);
|
|
246749
|
+
return hash && isGitCommitHash(hash) ? hash : undefined;
|
|
246750
|
+
}
|
|
246702
246751
|
async function gitHead(projectRoot) {
|
|
246703
246752
|
try {
|
|
246704
246753
|
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
@@ -246709,35 +246758,6 @@ async function gitHead(projectRoot) {
|
|
|
246709
246758
|
return null;
|
|
246710
246759
|
}
|
|
246711
246760
|
}
|
|
246712
|
-
// src/core/site/serve-command.ts
|
|
246713
|
-
var DEFAULT_SERVE_COMMAND = "npm run dev";
|
|
246714
|
-
var SCRIPT = "[A-Za-z0-9:_.-]+";
|
|
246715
|
-
var PREFIX2 = "[A-Za-z0-9._/-]+";
|
|
246716
|
-
var SCRIPT_RUNNERS = [
|
|
246717
|
-
{
|
|
246718
|
-
pattern: new RegExp(String.raw`^npm(\s+--prefix\s+${PREFIX2})?\s+run\s+${SCRIPT}$`),
|
|
246719
|
-
separator: " -- "
|
|
246720
|
-
},
|
|
246721
|
-
{
|
|
246722
|
-
pattern: new RegExp(String.raw`^(?:pnpm|yarn|bun)(\s+run)?\s+${SCRIPT}$`),
|
|
246723
|
-
separator: " "
|
|
246724
|
-
}
|
|
246725
|
-
];
|
|
246726
|
-
function runnerFor(serveCommand) {
|
|
246727
|
-
return SCRIPT_RUNNERS.find((runner) => runner.pattern.test(serveCommand));
|
|
246728
|
-
}
|
|
246729
|
-
function withServeAddress(serveCommand, { host, port, hostFlag }) {
|
|
246730
|
-
const command = serveCommand.trim();
|
|
246731
|
-
const args = [hostFlag, host, "--port", String(port)];
|
|
246732
|
-
const runner = runnerFor(command);
|
|
246733
|
-
if (!runner) {
|
|
246734
|
-
return { command, droppedAddress: true };
|
|
246735
|
-
}
|
|
246736
|
-
return {
|
|
246737
|
-
command: `${command}${runner.separator}${args.join(" ")}`,
|
|
246738
|
-
droppedAddress: false
|
|
246739
|
-
};
|
|
246740
|
-
}
|
|
246741
246761
|
// src/core/project/deploy.ts
|
|
246742
246762
|
function hasResourcesToDeploy(projectData) {
|
|
246743
246763
|
const {
|
|
@@ -246816,6 +246836,49 @@ async function deployAll(projectData, options) {
|
|
|
246816
246836
|
}
|
|
246817
246837
|
return { connectorResults };
|
|
246818
246838
|
}
|
|
246839
|
+
// src/core/project/target.ts
|
|
246840
|
+
import { dirname as dirname13, join as join19, resolve as resolve6 } from "node:path";
|
|
246841
|
+
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
246842
|
+
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
246843
|
+
async function resolveBuildTarget(projectRoot, overrides = {}) {
|
|
246844
|
+
const project = await readSettingsIfPresent(projectRoot);
|
|
246845
|
+
const root = project?.root ?? projectRoot ?? process.cwd();
|
|
246846
|
+
return {
|
|
246847
|
+
root,
|
|
246848
|
+
configDir: project ? dirname13(project.configPath) : join19(root, PROJECT_SUBDIR),
|
|
246849
|
+
buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
|
|
246850
|
+
outputDir: outputDirectory(project, root, overrides.outputDir),
|
|
246851
|
+
entitiesDir: project?.entitiesDir ?? "entities",
|
|
246852
|
+
agentsDir: project?.agentsDir ?? "agents"
|
|
246853
|
+
};
|
|
246854
|
+
}
|
|
246855
|
+
function outputDirectory(project, root, override) {
|
|
246856
|
+
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
246857
|
+
return configured ? resolve6(root, configured) : null;
|
|
246858
|
+
}
|
|
246859
|
+
function requireOutputDir(target) {
|
|
246860
|
+
if (target.outputDir === null) {
|
|
246861
|
+
throw new ConfigNotFoundError("No site configuration found.", {
|
|
246862
|
+
hints: [
|
|
246863
|
+
{
|
|
246864
|
+
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
246865
|
+
},
|
|
246866
|
+
{ message: `Or pass --output-dir <dir>, relative to ${target.root}` }
|
|
246867
|
+
]
|
|
246868
|
+
});
|
|
246869
|
+
}
|
|
246870
|
+
return target.outputDir;
|
|
246871
|
+
}
|
|
246872
|
+
async function readSettingsIfPresent(projectRoot) {
|
|
246873
|
+
try {
|
|
246874
|
+
return await readProjectSettings(projectRoot);
|
|
246875
|
+
} catch (error) {
|
|
246876
|
+
if (error instanceof ConfigNotFoundError) {
|
|
246877
|
+
return null;
|
|
246878
|
+
}
|
|
246879
|
+
throw error;
|
|
246880
|
+
}
|
|
246881
|
+
}
|
|
246819
246882
|
// src/core/clients/base44-client.ts
|
|
246820
246883
|
var retriedRequests = new WeakSet;
|
|
246821
246884
|
async function captureRequestBody(request, options) {
|
|
@@ -247097,6 +247160,12 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247097
247160
|
ctx.app = appContext;
|
|
247098
247161
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247099
247162
|
}
|
|
247163
|
+
function requireApp(ctx) {
|
|
247164
|
+
if (!ctx.app) {
|
|
247165
|
+
throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
|
|
247166
|
+
}
|
|
247167
|
+
return ctx.app;
|
|
247168
|
+
}
|
|
247100
247169
|
|
|
247101
247170
|
// src/cli/utils/version-check.ts
|
|
247102
247171
|
async function checkForUpgrade() {
|
|
@@ -247280,6 +247349,10 @@ function writeJsonError(error) {
|
|
|
247280
247349
|
const envelope = {
|
|
247281
247350
|
error: error instanceof Error ? error.message : String(error)
|
|
247282
247351
|
};
|
|
247352
|
+
const step = stepOf(error);
|
|
247353
|
+
if (step !== undefined) {
|
|
247354
|
+
envelope.step = step;
|
|
247355
|
+
}
|
|
247283
247356
|
if (isCLIError(error)) {
|
|
247284
247357
|
envelope.code = error.code;
|
|
247285
247358
|
if (error.details.length > 0) {
|
|
@@ -247649,7 +247722,7 @@ function getActorsCommand() {
|
|
|
247649
247722
|
}
|
|
247650
247723
|
|
|
247651
247724
|
// src/cli/commands/agent-skills/pull.ts
|
|
247652
|
-
import { dirname as
|
|
247725
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
247653
247726
|
// src/core/utils/dependencies.ts
|
|
247654
247727
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
247655
247728
|
function verifyDenoInstalled(context) {
|
|
@@ -247738,7 +247811,7 @@ async function pullAction({
|
|
|
247738
247811
|
runTask
|
|
247739
247812
|
}) {
|
|
247740
247813
|
const { project } = await readProjectConfig();
|
|
247741
|
-
const dir =
|
|
247814
|
+
const dir = join20(dirname14(project.configPath), project.agentSkillsDir);
|
|
247742
247815
|
const remote = await runTask("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
247743
247816
|
successMessage: "Agent skills fetched successfully",
|
|
247744
247817
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -247794,14 +247867,14 @@ function getAgentSkillsCommand() {
|
|
|
247794
247867
|
}
|
|
247795
247868
|
|
|
247796
247869
|
// src/cli/commands/agents/pull.ts
|
|
247797
|
-
import { dirname as
|
|
247870
|
+
import { dirname as dirname15, join as join21 } from "node:path";
|
|
247798
247871
|
async function pullAgentsAction({
|
|
247799
247872
|
log,
|
|
247800
247873
|
runTask
|
|
247801
247874
|
}) {
|
|
247802
247875
|
const { project } = await readProjectConfig();
|
|
247803
|
-
const configDir =
|
|
247804
|
-
const agentsDir =
|
|
247876
|
+
const configDir = dirname15(project.configPath);
|
|
247877
|
+
const agentsDir = join21(configDir, project.agentsDir);
|
|
247805
247878
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
247806
247879
|
return await fetchAgents();
|
|
247807
247880
|
}, {
|
|
@@ -247871,12 +247944,12 @@ function getAgentsCommand() {
|
|
|
247871
247944
|
}
|
|
247872
247945
|
|
|
247873
247946
|
// src/cli/commands/auth/password-login.ts
|
|
247874
|
-
import { dirname as
|
|
247947
|
+
import { dirname as dirname16, join as join22 } from "node:path";
|
|
247875
247948
|
async function passwordLoginAction({ log, runTask }, action) {
|
|
247876
247949
|
const shouldEnable = action === "enable";
|
|
247877
247950
|
const { project } = await readProjectConfig();
|
|
247878
|
-
const configDir =
|
|
247879
|
-
const authDir =
|
|
247951
|
+
const configDir = dirname16(project.configPath);
|
|
247952
|
+
const authDir = join22(configDir, project.authDir);
|
|
247880
247953
|
const updated = await runTask("Updating local auth config", async () => {
|
|
247881
247954
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
247882
247955
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -247896,14 +247969,14 @@ function getPasswordLoginCommand() {
|
|
|
247896
247969
|
}
|
|
247897
247970
|
|
|
247898
247971
|
// src/cli/commands/auth/pull.ts
|
|
247899
|
-
import { dirname as
|
|
247972
|
+
import { dirname as dirname17, join as join23 } from "node:path";
|
|
247900
247973
|
async function pullAuthAction({
|
|
247901
247974
|
log,
|
|
247902
247975
|
runTask
|
|
247903
247976
|
}) {
|
|
247904
247977
|
const { project } = await readProjectConfig();
|
|
247905
|
-
const configDir =
|
|
247906
|
-
const authDir =
|
|
247978
|
+
const configDir = dirname17(project.configPath);
|
|
247979
|
+
const authDir = join23(configDir, project.authDir);
|
|
247907
247980
|
const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
|
|
247908
247981
|
return await pullAuthConfig();
|
|
247909
247982
|
}, {
|
|
@@ -247967,7 +248040,7 @@ function getAuthPushCommand() {
|
|
|
247967
248040
|
}
|
|
247968
248041
|
|
|
247969
248042
|
// src/cli/commands/auth/social-login.ts
|
|
247970
|
-
import { dirname as
|
|
248043
|
+
import { dirname as dirname18, join as join24, resolve as resolve7 } from "node:path";
|
|
247971
248044
|
var PROVIDER_LABELS = {
|
|
247972
248045
|
google: "Google",
|
|
247973
248046
|
microsoft: "Microsoft",
|
|
@@ -248007,7 +248080,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
|
|
|
248007
248080
|
let clientSecret;
|
|
248008
248081
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
248009
248082
|
if (options.envFile) {
|
|
248010
|
-
const secrets = await parseEnvFile(
|
|
248083
|
+
const secrets = await parseEnvFile(resolve7(options.envFile));
|
|
248011
248084
|
const value = secrets[oauthCli.envVar];
|
|
248012
248085
|
if (!value) {
|
|
248013
248086
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -248037,8 +248110,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
|
|
|
248037
248110
|
}
|
|
248038
248111
|
}
|
|
248039
248112
|
const { project } = await readProjectConfig();
|
|
248040
|
-
const configDir =
|
|
248041
|
-
const authDir =
|
|
248113
|
+
const configDir = dirname18(project.configPath);
|
|
248114
|
+
const authDir = join24(configDir, project.authDir);
|
|
248042
248115
|
const { config: updated } = await runTask("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
248043
248116
|
if (clientSecret) {
|
|
248044
248117
|
await runTask("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -248063,7 +248136,7 @@ function getSocialLoginCommand() {
|
|
|
248063
248136
|
}
|
|
248064
248137
|
|
|
248065
248138
|
// src/cli/commands/auth/sso.ts
|
|
248066
|
-
import { dirname as
|
|
248139
|
+
import { dirname as dirname19, join as join25, resolve as resolve8 } from "node:path";
|
|
248067
248140
|
var SSOConfigFileSchema = object({
|
|
248068
248141
|
provider: _enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
248069
248142
|
clientId: string2(),
|
|
@@ -248079,7 +248152,7 @@ var SSOConfigFileSchema = object({
|
|
|
248079
248152
|
ssoName: string2().optional()
|
|
248080
248153
|
});
|
|
248081
248154
|
async function loadSSOConfigFile(filePath) {
|
|
248082
|
-
const resolved =
|
|
248155
|
+
const resolved = resolve8(filePath);
|
|
248083
248156
|
const raw = await readJsonFile(resolved);
|
|
248084
248157
|
const result = SSOConfigFileSchema.safeParse(raw);
|
|
248085
248158
|
if (!result.success) {
|
|
@@ -248167,7 +248240,7 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
|
|
|
248167
248240
|
}
|
|
248168
248241
|
let clientSecret;
|
|
248169
248242
|
if (merged.envFile && !merged.clientSecret) {
|
|
248170
|
-
const secrets = await parseEnvFile(
|
|
248243
|
+
const secrets = await parseEnvFile(resolve8(merged.envFile));
|
|
248171
248244
|
const value = secrets.sso_client_secret;
|
|
248172
248245
|
if (!value) {
|
|
248173
248246
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -248226,8 +248299,8 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
|
|
|
248226
248299
|
throw error;
|
|
248227
248300
|
}
|
|
248228
248301
|
const { project } = await readProjectConfig();
|
|
248229
|
-
const configDir =
|
|
248230
|
-
const authDir =
|
|
248302
|
+
const configDir = dirname19(project.configPath);
|
|
248303
|
+
const authDir = join25(configDir, project.authDir);
|
|
248231
248304
|
await runTask("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
248232
248305
|
await runTask("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
248233
248306
|
return {
|
|
@@ -248242,8 +248315,8 @@ async function ssoDisableAction({ log, runTask }, options) {
|
|
|
248242
248315
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
248243
248316
|
}
|
|
248244
248317
|
const { project } = await readProjectConfig();
|
|
248245
|
-
const configDir =
|
|
248246
|
-
const authDir =
|
|
248318
|
+
const configDir = dirname19(project.configPath);
|
|
248319
|
+
const authDir = join25(configDir, project.authDir);
|
|
248247
248320
|
const updated = await runTask("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
248248
248321
|
await runTask("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
248249
248322
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -249125,13 +249198,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
249125
249198
|
}
|
|
249126
249199
|
|
|
249127
249200
|
// src/cli/commands/connectors/pull.ts
|
|
249128
|
-
import { dirname as
|
|
249201
|
+
import { dirname as dirname20, join as join26, resolve as resolve9 } from "node:path";
|
|
249129
249202
|
async function resolveConnectorsDir(options) {
|
|
249130
249203
|
if (!getAppContext().projectRoot) {
|
|
249131
|
-
return
|
|
249204
|
+
return resolve9(options.dir ?? "connectors");
|
|
249132
249205
|
}
|
|
249133
249206
|
const { project } = await readProjectConfig();
|
|
249134
|
-
return
|
|
249207
|
+
return join26(dirname20(project.configPath), project.connectorsDir);
|
|
249135
249208
|
}
|
|
249136
249209
|
async function pullConnectorsAction({ log, runTask, jsonMode }, options) {
|
|
249137
249210
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -249172,10 +249245,10 @@ function getConnectorsPullCommand() {
|
|
|
249172
249245
|
}
|
|
249173
249246
|
|
|
249174
249247
|
// src/cli/commands/connectors/push.ts
|
|
249175
|
-
import { resolve as
|
|
249248
|
+
import { resolve as resolve10 } from "node:path";
|
|
249176
249249
|
async function readConnectorsToPush(options) {
|
|
249177
249250
|
if (!getAppContext().projectRoot) {
|
|
249178
|
-
return readAllConnectors(
|
|
249251
|
+
return readAllConnectors(resolve10(options.dir ?? "connectors"));
|
|
249179
249252
|
}
|
|
249180
249253
|
const { connectors } = await readProjectConfig();
|
|
249181
249254
|
return connectors;
|
|
@@ -249518,11 +249591,11 @@ function getListCommand() {
|
|
|
249518
249591
|
}
|
|
249519
249592
|
|
|
249520
249593
|
// src/cli/commands/functions/pull.ts
|
|
249521
|
-
import { dirname as
|
|
249594
|
+
import { dirname as dirname21, join as join27 } from "node:path";
|
|
249522
249595
|
async function pullFunctionsAction({ log, runTask }, name) {
|
|
249523
249596
|
const { project, functions } = await readProjectConfig();
|
|
249524
|
-
const configDir =
|
|
249525
|
-
const functionsDir =
|
|
249597
|
+
const configDir = dirname21(project.configPath);
|
|
249598
|
+
const functionsDir = join27(configDir, project.functionsDir);
|
|
249526
249599
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
249527
249600
|
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
249528
249601
|
const { functions } = await listDeployedFunctions();
|
|
@@ -249625,14 +249698,11 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249625
249698
|
|
|
249626
249699
|
// src/cli/commands/project/build.ts
|
|
249627
249700
|
async function buildAction(ctx) {
|
|
249628
|
-
const
|
|
249629
|
-
|
|
249630
|
-
throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
249631
|
-
}
|
|
249632
|
-
const { project } = await readProjectConfig(app.projectRoot);
|
|
249701
|
+
const app = requireApp(ctx);
|
|
249702
|
+
const target = await resolveBuildTarget(app.projectRoot);
|
|
249633
249703
|
await runSiteBuild(ctx, {
|
|
249634
|
-
root:
|
|
249635
|
-
buildCommand:
|
|
249704
|
+
root: target.root,
|
|
249705
|
+
buildCommand: target.buildCommand,
|
|
249636
249706
|
appId: app.id
|
|
249637
249707
|
});
|
|
249638
249708
|
return {
|
|
@@ -249644,11 +249714,11 @@ function getBuildCommand() {
|
|
|
249644
249714
|
}
|
|
249645
249715
|
|
|
249646
249716
|
// src/cli/commands/project/create.ts
|
|
249647
|
-
import { basename as basename6, resolve as
|
|
249717
|
+
import { basename as basename6, resolve as resolve11 } from "node:path";
|
|
249648
249718
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249649
249719
|
|
|
249650
249720
|
// src/cli/commands/project/scaffold-shared.ts
|
|
249651
|
-
import { join as
|
|
249721
|
+
import { join as join28 } from "node:path";
|
|
249652
249722
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
249653
249723
|
async function getTemplateById(templateId) {
|
|
249654
249724
|
const templates = await listTemplates();
|
|
@@ -249711,7 +249781,7 @@ async function completeProjectSetup({
|
|
|
249711
249781
|
env: { VITE_BASE44_APP_ID: projectId }
|
|
249712
249782
|
})`${buildCommand}`;
|
|
249713
249783
|
updateMessage("Deploying site...");
|
|
249714
|
-
return await deploySite(
|
|
249784
|
+
return await deploySite(join28(resolvedPath, outputDirectory));
|
|
249715
249785
|
}, {
|
|
249716
249786
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
249717
249787
|
errorMessage: "Failed to deploy site"
|
|
@@ -249840,7 +249910,7 @@ async function createInteractive(options, ctx) {
|
|
|
249840
249910
|
}, ctx);
|
|
249841
249911
|
}
|
|
249842
249912
|
async function createNonInteractive(options, ctx) {
|
|
249843
|
-
ctx.log.info(`Creating a new project at ${
|
|
249913
|
+
ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
|
|
249844
249914
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
249845
249915
|
return await executeCreate({
|
|
249846
249916
|
template,
|
|
@@ -249864,7 +249934,7 @@ async function executeCreate({
|
|
|
249864
249934
|
}, ctx) {
|
|
249865
249935
|
const { log, runTask } = ctx;
|
|
249866
249936
|
const name = rawName.trim();
|
|
249867
|
-
const resolvedPath =
|
|
249937
|
+
const resolvedPath = resolve11(projectPath);
|
|
249868
249938
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
249869
249939
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
249870
249940
|
return await createProjectFiles({
|
|
@@ -250037,36 +250107,6 @@ function printStripeResult(r, log) {
|
|
|
250037
250107
|
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
250038
250108
|
}
|
|
250039
250109
|
|
|
250040
|
-
// src/cli/commands/project/install.ts
|
|
250041
|
-
async function installAction({
|
|
250042
|
-
runTask
|
|
250043
|
-
}) {
|
|
250044
|
-
const { project } = await readProjectConfig();
|
|
250045
|
-
const installCommand = project.site?.installCommand;
|
|
250046
|
-
if (!installCommand) {
|
|
250047
|
-
throw new ConfigNotFoundError("No site install command found.", {
|
|
250048
|
-
hints: [
|
|
250049
|
-
{
|
|
250050
|
-
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "installCommand": "npm ci" }). Inside one, installCommand defaults to "npm install".`
|
|
250051
|
-
}
|
|
250052
|
-
]
|
|
250053
|
-
});
|
|
250054
|
-
}
|
|
250055
|
-
await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
|
|
250056
|
-
successMessage: "Dependencies installed",
|
|
250057
|
-
errorMessage: "Install failed"
|
|
250058
|
-
});
|
|
250059
|
-
return {
|
|
250060
|
-
outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
|
|
250061
|
-
};
|
|
250062
|
-
}
|
|
250063
|
-
function getInstallCommand() {
|
|
250064
|
-
return new Base44Command("install", {
|
|
250065
|
-
requireAuth: false,
|
|
250066
|
-
requireAppContext: false
|
|
250067
|
-
}).description("Install the site's dependencies with its configured command").action(installAction);
|
|
250068
|
-
}
|
|
250069
|
-
|
|
250070
250110
|
// src/cli/commands/project/app-id-options.ts
|
|
250071
250111
|
function readExplicitAppId(command) {
|
|
250072
250112
|
const { appId } = command.optsWithGlobals();
|
|
@@ -250535,7 +250575,7 @@ function getLogsCommand() {
|
|
|
250535
250575
|
}
|
|
250536
250576
|
|
|
250537
250577
|
// src/cli/commands/project/scaffold.ts
|
|
250538
|
-
import { basename as basename7, resolve as
|
|
250578
|
+
import { basename as basename7, resolve as resolve12 } from "node:path";
|
|
250539
250579
|
function resolveAppId(options) {
|
|
250540
250580
|
const appId = options.appId;
|
|
250541
250581
|
if (!appId) {
|
|
@@ -250551,7 +250591,7 @@ function resolveAppId(options) {
|
|
|
250551
250591
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250552
250592
|
const { log, runTask } = ctx;
|
|
250553
250593
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250554
|
-
const resolvedPath =
|
|
250594
|
+
const resolvedPath = resolve12("./");
|
|
250555
250595
|
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250556
250596
|
const template = await getTemplateById("backend-only");
|
|
250557
250597
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -250599,6 +250639,315 @@ function getVisibilityCommand() {
|
|
|
250599
250639
|
])).action(setVisibility);
|
|
250600
250640
|
}
|
|
250601
250641
|
|
|
250642
|
+
// src/core/version/schema.ts
|
|
250643
|
+
var DeclareVersionResponseSchema = object({
|
|
250644
|
+
session_id: string2(),
|
|
250645
|
+
uploads: array(object({
|
|
250646
|
+
path: string2(),
|
|
250647
|
+
url: string2(),
|
|
250648
|
+
content_type: string2(),
|
|
250649
|
+
content_length: number2(),
|
|
250650
|
+
checksum_sha256: string2()
|
|
250651
|
+
}))
|
|
250652
|
+
}).transform((data) => ({
|
|
250653
|
+
sessionId: data.session_id,
|
|
250654
|
+
uploads: data.uploads.map((upload) => ({
|
|
250655
|
+
path: upload.path,
|
|
250656
|
+
url: upload.url,
|
|
250657
|
+
contentType: upload.content_type,
|
|
250658
|
+
contentLength: upload.content_length,
|
|
250659
|
+
checksumSha256: upload.checksum_sha256
|
|
250660
|
+
}))
|
|
250661
|
+
}));
|
|
250662
|
+
var CreateVersionResponseSchema = object({
|
|
250663
|
+
version_id: string2(),
|
|
250664
|
+
manifest_hash: string2()
|
|
250665
|
+
}).transform((data) => ({
|
|
250666
|
+
versionId: data.version_id,
|
|
250667
|
+
manifestHash: data.manifest_hash
|
|
250668
|
+
}));
|
|
250669
|
+
var EnvironmentResponseSchema = object({
|
|
250670
|
+
name: string2(),
|
|
250671
|
+
version_id: string2(),
|
|
250672
|
+
manifest_hash: string2(),
|
|
250673
|
+
deployment_id: string2()
|
|
250674
|
+
}).transform((data) => ({
|
|
250675
|
+
name: data.name,
|
|
250676
|
+
versionId: data.version_id,
|
|
250677
|
+
manifestHash: data.manifest_hash,
|
|
250678
|
+
deploymentId: data.deployment_id
|
|
250679
|
+
}));
|
|
250680
|
+
|
|
250681
|
+
// src/core/version/api.ts
|
|
250682
|
+
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
250683
|
+
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
250684
|
+
function declaredFile({ path, size, digest }) {
|
|
250685
|
+
return { path, size, digest };
|
|
250686
|
+
}
|
|
250687
|
+
function declaredModule(module) {
|
|
250688
|
+
return { ...declaredFile(module), type: module.type };
|
|
250689
|
+
}
|
|
250690
|
+
function declaredServingConfig(config) {
|
|
250691
|
+
const stated = {
|
|
250692
|
+
html_handling: config?.htmlHandling ?? null,
|
|
250693
|
+
not_found_handling: config?.notFoundHandling ?? null,
|
|
250694
|
+
run_worker_first: config?.runWorkerFirst ?? null,
|
|
250695
|
+
headers: config?.headers ?? null,
|
|
250696
|
+
redirects: config?.redirects ?? null
|
|
250697
|
+
};
|
|
250698
|
+
return Object.values(stated).every((v) => v === null) ? null : stated;
|
|
250699
|
+
}
|
|
250700
|
+
async function post(path, json, doing) {
|
|
250701
|
+
try {
|
|
250702
|
+
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
250703
|
+
} catch (error) {
|
|
250704
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
250705
|
+
}
|
|
250706
|
+
}
|
|
250707
|
+
var KEYED_RETRY = {
|
|
250708
|
+
limit: 3,
|
|
250709
|
+
methods: ["patch"],
|
|
250710
|
+
statusCodes: [408, 500, 502, 503, 504],
|
|
250711
|
+
retryOnTimeout: true
|
|
250712
|
+
};
|
|
250713
|
+
async function patch(path, json, doing, retry) {
|
|
250714
|
+
try {
|
|
250715
|
+
return await getAppClient().patch(path, {
|
|
250716
|
+
json,
|
|
250717
|
+
timeout: 180000,
|
|
250718
|
+
...retry ? { retry } : {}
|
|
250719
|
+
});
|
|
250720
|
+
} catch (error) {
|
|
250721
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
250722
|
+
}
|
|
250723
|
+
}
|
|
250724
|
+
function parse10(schema, body, what) {
|
|
250725
|
+
const result = schema.safeParse(body);
|
|
250726
|
+
if (!result.success) {
|
|
250727
|
+
throw new SchemaValidationError(`Invalid ${what} response from server`, result.error);
|
|
250728
|
+
}
|
|
250729
|
+
return result.data;
|
|
250730
|
+
}
|
|
250731
|
+
async function createVersion(artifacts, options = {}) {
|
|
250732
|
+
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
250733
|
+
assets: artifacts.assets.map(declaredFile),
|
|
250734
|
+
...artifacts.siteWorker ? {
|
|
250735
|
+
site_worker: {
|
|
250736
|
+
main: artifacts.siteWorker.main,
|
|
250737
|
+
modules: artifacts.siteWorker.modules.map(declaredModule),
|
|
250738
|
+
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
250739
|
+
compatibility_flags: artifacts.siteWorker.compatibilityFlags,
|
|
250740
|
+
serving_config: declaredServingConfig(artifacts.siteWorker.servingConfig)
|
|
250741
|
+
}
|
|
250742
|
+
} : {},
|
|
250743
|
+
entities: artifacts.entities,
|
|
250744
|
+
agents: artifacts.agents,
|
|
250745
|
+
source_commit: options.sourceCommit
|
|
250746
|
+
}, "declaring a version")).json(), "declare");
|
|
250747
|
+
const declaredFiles = [
|
|
250748
|
+
...artifacts.assets,
|
|
250749
|
+
...artifacts.siteWorker?.modules ?? []
|
|
250750
|
+
];
|
|
250751
|
+
options.progress?.onDeclared?.({ fileCount: declaredFiles.length });
|
|
250752
|
+
if (declared.uploads.length !== declaredFiles.length) {
|
|
250753
|
+
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
250754
|
+
}
|
|
250755
|
+
const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
|
|
250756
|
+
if (drifted !== -1) {
|
|
250757
|
+
throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
|
|
250758
|
+
}
|
|
250759
|
+
let uploadedFiles = 0;
|
|
250760
|
+
await pMap(declared.uploads, async (upload, index) => {
|
|
250761
|
+
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
250762
|
+
uploadedFiles++;
|
|
250763
|
+
options.progress?.onUpload?.({
|
|
250764
|
+
uploadedFiles,
|
|
250765
|
+
totalFiles: declared.uploads.length
|
|
250766
|
+
});
|
|
250767
|
+
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
250768
|
+
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
250769
|
+
}
|
|
250770
|
+
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
250771
|
+
return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
|
|
250772
|
+
version_id: versionId,
|
|
250773
|
+
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
250774
|
+
}, "setting the environment's version", options.idempotencyKey ? KEYED_RETRY : undefined)).json(), "environment");
|
|
250775
|
+
}
|
|
250776
|
+
// src/core/version/artifacts.ts
|
|
250777
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
250778
|
+
import { join as join29, resolve as resolve13 } from "node:path";
|
|
250779
|
+
var MAX_FILE_COUNT = 50000;
|
|
250780
|
+
var HASH_CONCURRENCY = 32;
|
|
250781
|
+
var ENTRY2 = "index.html";
|
|
250782
|
+
async function digestFile(absolutePath) {
|
|
250783
|
+
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
250784
|
+
return `sha256:${hash.digest("hex")}`;
|
|
250785
|
+
}
|
|
250786
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
250787
|
+
const found = await describeBuildOutput(outputDir);
|
|
250788
|
+
if (found.length > MAX_FILE_COUNT) {
|
|
250789
|
+
throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
250790
|
+
}
|
|
250791
|
+
if (options.entryFile) {
|
|
250792
|
+
if (found.length === 0) {
|
|
250793
|
+
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
250794
|
+
hints: [
|
|
250795
|
+
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
250796
|
+
]
|
|
250797
|
+
});
|
|
250798
|
+
}
|
|
250799
|
+
if (!found.some((f) => f.path === options.entryFile)) {
|
|
250800
|
+
throw new InvalidInputError(`${outputDir} has no ${options.entryFile}, so nothing could enter the site.`);
|
|
250801
|
+
}
|
|
250802
|
+
}
|
|
250803
|
+
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
250804
|
+
}
|
|
250805
|
+
async function describeSiteWorker(built) {
|
|
250806
|
+
const { config, modules } = built;
|
|
250807
|
+
const entry = resolve13(config.configDir, config.main);
|
|
250808
|
+
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
250809
|
+
if (!main) {
|
|
250810
|
+
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
250811
|
+
}
|
|
250812
|
+
return {
|
|
250813
|
+
main,
|
|
250814
|
+
modules: await pMap(modules, async ({ name, absolutePath, size, type }) => ({
|
|
250815
|
+
path: name,
|
|
250816
|
+
absolutePath,
|
|
250817
|
+
size,
|
|
250818
|
+
digest: await digestFile(absolutePath),
|
|
250819
|
+
type
|
|
250820
|
+
}), { concurrency: HASH_CONCURRENCY }),
|
|
250821
|
+
compatibilityDate: config.compatibilityDate,
|
|
250822
|
+
compatibilityFlags: config.compatibilityFlags,
|
|
250823
|
+
servingConfig: config.assetsConfig
|
|
250824
|
+
};
|
|
250825
|
+
}
|
|
250826
|
+
async function readRawResources(dir) {
|
|
250827
|
+
if (!await pathExists(dir)) {
|
|
250828
|
+
return {};
|
|
250829
|
+
}
|
|
250830
|
+
const files = await globby(`**/*.${CONFIG_FILE_EXTENSION_GLOB}`, {
|
|
250831
|
+
cwd: dir,
|
|
250832
|
+
onlyFiles: true,
|
|
250833
|
+
followSymbolicLinks: false
|
|
250834
|
+
});
|
|
250835
|
+
const payloads = {};
|
|
250836
|
+
for (const relativePath of files.sort()) {
|
|
250837
|
+
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
250838
|
+
payloads[name] = await readJsonFile(join29(dir, ...relativePath.split("/")));
|
|
250839
|
+
}
|
|
250840
|
+
return payloads;
|
|
250841
|
+
}
|
|
250842
|
+
async function collectResources(configDir, dirs) {
|
|
250843
|
+
const [entities, agents] = await Promise.all([
|
|
250844
|
+
readRawResources(join29(configDir, dirs.entitiesDir)),
|
|
250845
|
+
readRawResources(join29(configDir, dirs.agentsDir))
|
|
250846
|
+
]);
|
|
250847
|
+
return { entities, agents };
|
|
250848
|
+
}
|
|
250849
|
+
async function collectArtifacts(target) {
|
|
250850
|
+
const built = await resolveFullStackBuild(target.root);
|
|
250851
|
+
const siteWorker = built ? await describeSiteWorker(built) : null;
|
|
250852
|
+
return {
|
|
250853
|
+
assets: built ? built.assetsDir ? await collectBuildOutput(built.assetsDir) : [] : await collectBuildOutput(requireOutputDir(target), {
|
|
250854
|
+
entryFile: ENTRY2
|
|
250855
|
+
}),
|
|
250856
|
+
...siteWorker ? { siteWorker } : {},
|
|
250857
|
+
...await collectResources(target.configDir, target)
|
|
250858
|
+
};
|
|
250859
|
+
}
|
|
250860
|
+
// src/core/version/gate.ts
|
|
250861
|
+
var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
|
|
250862
|
+
function versionsApiEnabled(env = process.env) {
|
|
250863
|
+
const value = env[VERSIONS_API_ENV];
|
|
250864
|
+
return value === "1" || value === "true";
|
|
250865
|
+
}
|
|
250866
|
+
// src/core/version/publish.ts
|
|
250867
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
250868
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
250869
|
+
async function tagStep2(step, run) {
|
|
250870
|
+
return await tagStep(step, run);
|
|
250871
|
+
}
|
|
250872
|
+
async function publishVersion(artifacts, options = {}) {
|
|
250873
|
+
const version = await tagStep2("create_version", () => createVersion(artifacts, {
|
|
250874
|
+
sourceCommit: options.sourceCommit,
|
|
250875
|
+
concurrency: options.concurrency,
|
|
250876
|
+
progress: options.progress
|
|
250877
|
+
}));
|
|
250878
|
+
const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
|
|
250879
|
+
idempotencyKey: randomUUID4()
|
|
250880
|
+
}));
|
|
250881
|
+
return {
|
|
250882
|
+
environment: environment.name,
|
|
250883
|
+
versionId: environment.versionId,
|
|
250884
|
+
manifestHash: environment.manifestHash,
|
|
250885
|
+
deploymentId: environment.deploymentId
|
|
250886
|
+
};
|
|
250887
|
+
}
|
|
250888
|
+
// src/cli/commands/versions/options.ts
|
|
250889
|
+
function outputDirOption() {
|
|
250890
|
+
return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
|
|
250891
|
+
}
|
|
250892
|
+
function targetOption() {
|
|
250893
|
+
return new Option2("--target <name>", "Environment to serve the version at");
|
|
250894
|
+
}
|
|
250895
|
+
function gitHashOption() {
|
|
250896
|
+
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
|
|
250897
|
+
if (!isGitCommitHash(value)) {
|
|
250898
|
+
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
250899
|
+
}
|
|
250900
|
+
return value;
|
|
250901
|
+
});
|
|
250902
|
+
}
|
|
250903
|
+
function concurrencyOption() {
|
|
250904
|
+
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
250905
|
+
const parsed = Number(value);
|
|
250906
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
250907
|
+
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
250908
|
+
}
|
|
250909
|
+
return parsed;
|
|
250910
|
+
});
|
|
250911
|
+
}
|
|
250912
|
+
|
|
250913
|
+
// src/cli/commands/publish.ts
|
|
250914
|
+
async function publishAction(ctx, options) {
|
|
250915
|
+
const { runTask, log, jsonMode } = ctx;
|
|
250916
|
+
const app = requireApp(ctx);
|
|
250917
|
+
const target = await tagStep2("create_version", () => resolveBuildTarget(app.projectRoot, { outputDir: options.outputDir }));
|
|
250918
|
+
if (options.build !== false) {
|
|
250919
|
+
await tagStep2("build", () => runSiteBuild(ctx, {
|
|
250920
|
+
root: target.root,
|
|
250921
|
+
buildCommand: target.buildCommand,
|
|
250922
|
+
appId: app.id
|
|
250923
|
+
}));
|
|
250924
|
+
}
|
|
250925
|
+
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250926
|
+
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250927
|
+
const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
|
|
250928
|
+
return await publishVersion(artifacts, {
|
|
250929
|
+
sourceCommit: gitHash,
|
|
250930
|
+
target: options.target,
|
|
250931
|
+
concurrency: options.concurrency,
|
|
250932
|
+
progress: {
|
|
250933
|
+
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
250934
|
+
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
250935
|
+
}
|
|
250936
|
+
});
|
|
250937
|
+
}, { successMessage: "Published", errorMessage: "Publish failed" });
|
|
250938
|
+
if (!jsonMode) {
|
|
250939
|
+
log.message(theme.styles.dim(`version ${result.versionId}`));
|
|
250940
|
+
}
|
|
250941
|
+
return {
|
|
250942
|
+
outroMessage: `${result.environment} now serves ${result.versionId}`,
|
|
250943
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
250944
|
+
` : undefined
|
|
250945
|
+
};
|
|
250946
|
+
}
|
|
250947
|
+
function getPublishCommand() {
|
|
250948
|
+
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").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
|
|
250949
|
+
}
|
|
250950
|
+
|
|
250602
250951
|
// src/core/resources/sandbox/schema.ts
|
|
250603
250952
|
var FileErrorSchema = object({
|
|
250604
250953
|
code: string2(),
|
|
@@ -250984,7 +251333,7 @@ function getSecretsListCommand() {
|
|
|
250984
251333
|
}
|
|
250985
251334
|
|
|
250986
251335
|
// src/cli/commands/secrets/set.ts
|
|
250987
|
-
import { resolve as
|
|
251336
|
+
import { resolve as resolve14 } from "node:path";
|
|
250988
251337
|
function parseEntries(entries) {
|
|
250989
251338
|
const secrets = {};
|
|
250990
251339
|
for (const entry of entries) {
|
|
@@ -251015,7 +251364,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
251015
251364
|
validateInput(entries, options);
|
|
251016
251365
|
let secrets;
|
|
251017
251366
|
if (options.envFile) {
|
|
251018
|
-
secrets = await parseEnvFile(
|
|
251367
|
+
secrets = await parseEnvFile(resolve14(options.envFile));
|
|
251019
251368
|
if (Object.keys(secrets).length === 0) {
|
|
251020
251369
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
251021
251370
|
}
|
|
@@ -251044,7 +251393,7 @@ function getSecretsCommand() {
|
|
|
251044
251393
|
}
|
|
251045
251394
|
|
|
251046
251395
|
// src/cli/commands/site/deploy.ts
|
|
251047
|
-
import { resolve as
|
|
251396
|
+
import { resolve as resolve15 } from "node:path";
|
|
251048
251397
|
async function deployAction2(ctx, options) {
|
|
251049
251398
|
const { isNonInteractive } = ctx;
|
|
251050
251399
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251122,7 +251471,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251122
251471
|
}
|
|
251123
251472
|
function siteOutputDir(project) {
|
|
251124
251473
|
const outputDirectory = project.site?.outputDirectory;
|
|
251125
|
-
return outputDirectory ?
|
|
251474
|
+
return outputDirectory ? resolve15(project.root, outputDirectory) : null;
|
|
251126
251475
|
}
|
|
251127
251476
|
function getSiteDeployCommand() {
|
|
251128
251477
|
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)");
|
|
@@ -251313,6 +251662,7 @@ function stopRunnerOnProcessSignals(runner) {
|
|
|
251313
251662
|
}
|
|
251314
251663
|
|
|
251315
251664
|
// src/cli/commands/site/dev.ts
|
|
251665
|
+
var DEFAULT_SERVE_COMMAND = "npm run dev";
|
|
251316
251666
|
async function siteDevAction(ctx) {
|
|
251317
251667
|
const { app } = ctx;
|
|
251318
251668
|
if (!app?.projectRoot) {
|
|
@@ -251323,15 +251673,7 @@ async function siteDevAction(ctx) {
|
|
|
251323
251673
|
if (!site) {
|
|
251324
251674
|
throw new InvalidInputError(`This project has no 'site' block in base44/config.jsonc, so there is no frontend to serve. Add one naming its serveCommand; site dev falls back to "npm run dev".`);
|
|
251325
251675
|
}
|
|
251326
|
-
const
|
|
251327
|
-
const { command, droppedAddress } = withServeAddress(serveCommand, {
|
|
251328
|
-
host: site.devHost,
|
|
251329
|
-
port: site.devPort,
|
|
251330
|
-
hostFlag: site.devHostFlag
|
|
251331
|
-
});
|
|
251332
|
-
if (droppedAddress) {
|
|
251333
|
-
throw new InvalidInputError(`serveCommand '${serveCommand}' takes no forwarded arguments, so the bind address cannot be passed to it. Bind it inside serveCommand itself, or use an 'npm run', 'pnpm', 'yarn' or 'bun run' script.`);
|
|
251334
|
-
}
|
|
251676
|
+
const command = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
|
|
251335
251677
|
const runner = createServeCommandRunner({
|
|
251336
251678
|
serveCommand: command,
|
|
251337
251679
|
projectRoot: project.root,
|
|
@@ -251346,6 +251688,36 @@ function getSiteDevCommand() {
|
|
|
251346
251688
|
return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server, with no local backend").action(siteDevAction);
|
|
251347
251689
|
}
|
|
251348
251690
|
|
|
251691
|
+
// src/cli/commands/site/install.ts
|
|
251692
|
+
async function installAction({
|
|
251693
|
+
runTask
|
|
251694
|
+
}) {
|
|
251695
|
+
const { project } = await readProjectConfig();
|
|
251696
|
+
const installCommand = project.site?.installCommand;
|
|
251697
|
+
if (!installCommand) {
|
|
251698
|
+
throw new ConfigNotFoundError("No site install command found.", {
|
|
251699
|
+
hints: [
|
|
251700
|
+
{
|
|
251701
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "installCommand": "npm ci" }). Inside one, installCommand defaults to "npm install".`
|
|
251702
|
+
}
|
|
251703
|
+
]
|
|
251704
|
+
});
|
|
251705
|
+
}
|
|
251706
|
+
await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
|
|
251707
|
+
successMessage: "Dependencies installed",
|
|
251708
|
+
errorMessage: "Install failed"
|
|
251709
|
+
});
|
|
251710
|
+
return {
|
|
251711
|
+
outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
|
|
251712
|
+
};
|
|
251713
|
+
}
|
|
251714
|
+
function getSiteInstallCommand() {
|
|
251715
|
+
return new Base44Command("install", {
|
|
251716
|
+
requireAuth: false,
|
|
251717
|
+
requireAppContext: false
|
|
251718
|
+
}).description("Install the site's dependencies with its configured command").action(installAction);
|
|
251719
|
+
}
|
|
251720
|
+
|
|
251349
251721
|
// src/cli/commands/site/open.ts
|
|
251350
251722
|
async function openAction({
|
|
251351
251723
|
isNonInteractive
|
|
@@ -251362,7 +251734,7 @@ function getSiteOpenCommand() {
|
|
|
251362
251734
|
|
|
251363
251735
|
// src/cli/commands/site/index.ts
|
|
251364
251736
|
function getSiteCommand() {
|
|
251365
|
-
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteDevCommand()).addCommand(getSiteOpenCommand());
|
|
251737
|
+
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteDevCommand()).addCommand(getSiteInstallCommand()).addCommand(getSiteOpenCommand());
|
|
251366
251738
|
}
|
|
251367
251739
|
|
|
251368
251740
|
// src/core/types/generator.ts
|
|
@@ -251454,10 +251826,10 @@ function toPascalCase(name) {
|
|
|
251454
251826
|
return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
251455
251827
|
}
|
|
251456
251828
|
// src/core/types/update-project.ts
|
|
251457
|
-
import { join as
|
|
251829
|
+
import { join as join33 } from "node:path";
|
|
251458
251830
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
251459
251831
|
async function updateProjectConfig(projectRoot) {
|
|
251460
|
-
const tsconfigPath =
|
|
251832
|
+
const tsconfigPath = join33(projectRoot, "tsconfig.json");
|
|
251461
251833
|
if (!await pathExists(tsconfigPath)) {
|
|
251462
251834
|
return false;
|
|
251463
251835
|
}
|
|
@@ -251506,6 +251878,59 @@ function getTypesCommand() {
|
|
|
251506
251878
|
return new Command2("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
251507
251879
|
}
|
|
251508
251880
|
|
|
251881
|
+
// src/cli/commands/versions/create.ts
|
|
251882
|
+
async function createAction2(ctx, options) {
|
|
251883
|
+
const { runTask, jsonMode } = ctx;
|
|
251884
|
+
const target = await resolveBuildTarget(requireApp(ctx).projectRoot, {
|
|
251885
|
+
outputDir: options.outputDir
|
|
251886
|
+
});
|
|
251887
|
+
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
251888
|
+
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
|
|
251889
|
+
sourceCommit: gitHash,
|
|
251890
|
+
concurrency: options.concurrency,
|
|
251891
|
+
progress: {
|
|
251892
|
+
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
251893
|
+
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
251894
|
+
}
|
|
251895
|
+
}), {
|
|
251896
|
+
successMessage: "Version created",
|
|
251897
|
+
errorMessage: "Create version failed"
|
|
251898
|
+
});
|
|
251899
|
+
return {
|
|
251900
|
+
outroMessage: `Version ${version.versionId} (${version.manifestHash})`,
|
|
251901
|
+
stdout: jsonMode ? `${JSON.stringify(version, null, 2)}
|
|
251902
|
+
` : undefined
|
|
251903
|
+
};
|
|
251904
|
+
}
|
|
251905
|
+
function getVersionCreateCommand() {
|
|
251906
|
+
return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
|
|
251907
|
+
}
|
|
251908
|
+
|
|
251909
|
+
// src/cli/commands/versions/deploy.ts
|
|
251910
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
251911
|
+
async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
251912
|
+
const environment = options.target ?? DEFAULT_ENVIRONMENT;
|
|
251913
|
+
const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
|
|
251914
|
+
idempotencyKey: randomUUID5()
|
|
251915
|
+
}), {
|
|
251916
|
+
successMessage: "Environment updated",
|
|
251917
|
+
errorMessage: "Could not update the environment"
|
|
251918
|
+
});
|
|
251919
|
+
return {
|
|
251920
|
+
outroMessage: `${result.name} now serves ${result.versionId}`,
|
|
251921
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
251922
|
+
` : undefined
|
|
251923
|
+
};
|
|
251924
|
+
}
|
|
251925
|
+
function getVersionDeployCommand() {
|
|
251926
|
+
return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").addOption(targetOption()).action(deployAction3);
|
|
251927
|
+
}
|
|
251928
|
+
|
|
251929
|
+
// src/cli/commands/versions/index.ts
|
|
251930
|
+
function getVersionsCommand() {
|
|
251931
|
+
return new Command2("versions").description("Record app versions and serve them").addCommand(getVersionCreateCommand()).addCommand(getVersionDeployCommand());
|
|
251932
|
+
}
|
|
251933
|
+
|
|
251509
251934
|
// src/core/resources/workflow/schema.ts
|
|
251510
251935
|
var WorkflowRunStatusSchema = _enum([
|
|
251511
251936
|
"running",
|
|
@@ -251885,7 +252310,7 @@ function getWorkspaceCommand() {
|
|
|
251885
252310
|
// src/cli/dev/dev-server/main.ts
|
|
251886
252311
|
var import_cors = __toESM(require_lib4(), 1);
|
|
251887
252312
|
var import_express6 = __toESM(require_express(), 1);
|
|
251888
|
-
import { dirname as
|
|
252313
|
+
import { dirname as dirname27, join as join38 } from "node:path";
|
|
251889
252314
|
|
|
251890
252315
|
// ../../node_modules/get-port/index.js
|
|
251891
252316
|
import net from "node:net";
|
|
@@ -252015,7 +252440,7 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
252015
252440
|
|
|
252016
252441
|
// src/cli/dev/dev-server/function-manager.ts
|
|
252017
252442
|
import { spawn as spawn3 } from "node:child_process";
|
|
252018
|
-
import { dirname as
|
|
252443
|
+
import { dirname as dirname24, join as join34 } from "node:path";
|
|
252019
252444
|
import { pathToFileURL } from "node:url";
|
|
252020
252445
|
|
|
252021
252446
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -252120,7 +252545,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
252120
252545
|
}
|
|
252121
252546
|
spawnFunction(func, port) {
|
|
252122
252547
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
252123
|
-
const importMapPath =
|
|
252548
|
+
const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
|
|
252124
252549
|
const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
252125
252550
|
env: {
|
|
252126
252551
|
...globalThis.process.env,
|
|
@@ -252194,7 +252619,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
252194
252619
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
252195
252620
|
import { isBuiltin } from "node:module";
|
|
252196
252621
|
import { homedir as homedir3 } from "node:os";
|
|
252197
|
-
import { join as
|
|
252622
|
+
import { join as join35 } from "node:path";
|
|
252198
252623
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
252199
252624
|
var depsPromise;
|
|
252200
252625
|
function loadDeps() {
|
|
@@ -252315,9 +252740,9 @@ export default {
|
|
|
252315
252740
|
};
|
|
252316
252741
|
`;
|
|
252317
252742
|
function ensureBundlerConfig() {
|
|
252318
|
-
const dir =
|
|
252743
|
+
const dir = join35(homedir3(), ".base44", "function-bundler");
|
|
252319
252744
|
mkdirSync2(dir, { recursive: true });
|
|
252320
|
-
const configPath =
|
|
252745
|
+
const configPath = join35(dir, "deno.json");
|
|
252321
252746
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
252322
252747
|
`);
|
|
252323
252748
|
return configPath;
|
|
@@ -253698,11 +254123,11 @@ async function createEntityRoutes(db, logger, broadcast) {
|
|
|
253698
254123
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
253699
254124
|
var import_express5 = __toESM(require_express(), 1);
|
|
253700
254125
|
var import_multer = __toESM(require_multer(), 1);
|
|
253701
|
-
import { createHash as
|
|
254126
|
+
import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
|
|
253702
254127
|
import fs28 from "node:fs";
|
|
253703
254128
|
import path18 from "node:path";
|
|
253704
254129
|
function createFileToken(fileUri) {
|
|
253705
|
-
return
|
|
254130
|
+
return createHash3("sha256").update(fileUri).digest("hex");
|
|
253706
254131
|
}
|
|
253707
254132
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
253708
254133
|
const router = import_express5.Router({ mergeParams: true });
|
|
@@ -253715,14 +254140,14 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253715
254140
|
destination: mediaFilesDir,
|
|
253716
254141
|
filename: (_req, file, cb) => {
|
|
253717
254142
|
const ext = path18.extname(file.originalname);
|
|
253718
|
-
cb(null, `${
|
|
254143
|
+
cb(null, `${randomUUID6()}${ext}`);
|
|
253719
254144
|
}
|
|
253720
254145
|
});
|
|
253721
254146
|
const privateStorage = import_multer.default.diskStorage({
|
|
253722
254147
|
destination: privateFilesDir,
|
|
253723
254148
|
filename: (_req, file, cb) => {
|
|
253724
254149
|
const ext = path18.extname(file.originalname);
|
|
253725
|
-
cb(null, `${
|
|
254150
|
+
cb(null, `${randomUUID6()}${ext}`);
|
|
253726
254151
|
}
|
|
253727
254152
|
});
|
|
253728
254153
|
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
@@ -255584,8 +256009,8 @@ async function createDevServer(options) {
|
|
|
255584
256009
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
255585
256010
|
};
|
|
255586
256011
|
const base44ConfigWatcher = new WatchBase44({
|
|
255587
|
-
functions:
|
|
255588
|
-
entities:
|
|
256012
|
+
functions: join38(dirname27(project.configPath), project.functionsDir),
|
|
256013
|
+
entities: join38(dirname27(project.configPath), project.entitiesDir)
|
|
255589
256014
|
}, devLogger);
|
|
255590
256015
|
base44ConfigWatcher.on("change", async (name) => {
|
|
255591
256016
|
try {
|
|
@@ -255856,7 +256281,7 @@ Examples:
|
|
|
255856
256281
|
}
|
|
255857
256282
|
|
|
255858
256283
|
// src/cli/commands/project/eject.ts
|
|
255859
|
-
import { resolve as
|
|
256284
|
+
import { resolve as resolve19 } from "node:path";
|
|
255860
256285
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
255861
256286
|
async function eject(ctx, options, command) {
|
|
255862
256287
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -255920,7 +256345,7 @@ async function eject(ctx, options, command) {
|
|
|
255920
256345
|
Ne("Operation cancelled.");
|
|
255921
256346
|
throw new CLIExitError(0);
|
|
255922
256347
|
}
|
|
255923
|
-
const resolvedPath =
|
|
256348
|
+
const resolvedPath = resolve19(selectedPath);
|
|
255924
256349
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
255925
256350
|
await createProjectFilesForExistingProject({
|
|
255926
256351
|
projectId,
|
|
@@ -255991,7 +256416,6 @@ function createProgram(context) {
|
|
|
255991
256416
|
program.addCommand(getCreateCommand());
|
|
255992
256417
|
program.addCommand(getScaffoldCommand());
|
|
255993
256418
|
program.addCommand(getDashboardCommand());
|
|
255994
|
-
program.addCommand(getInstallCommand());
|
|
255995
256419
|
program.addCommand(getBuildCommand());
|
|
255996
256420
|
program.addCommand(getDeployCommand3());
|
|
255997
256421
|
program.addCommand(getVisibilityCommand());
|
|
@@ -256010,6 +256434,10 @@ function createProgram(context) {
|
|
|
256010
256434
|
program.addCommand(getBranchesCommand());
|
|
256011
256435
|
program.addCommand(getAuthCommand());
|
|
256012
256436
|
program.addCommand(getSiteCommand());
|
|
256437
|
+
if (versionsApiEnabled()) {
|
|
256438
|
+
program.addCommand(getPublishCommand());
|
|
256439
|
+
program.addCommand(getVersionsCommand());
|
|
256440
|
+
}
|
|
256013
256441
|
program.addCommand(getTypesCommand());
|
|
256014
256442
|
program.addCommand(getExecCommand());
|
|
256015
256443
|
program.addCommand(getDevCommand());
|
|
@@ -256022,7 +256450,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
256022
256450
|
import { release, type } from "node:os";
|
|
256023
256451
|
|
|
256024
256452
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
256025
|
-
import { dirname as
|
|
256453
|
+
import { dirname as dirname28, posix, sep as sep2 } from "path";
|
|
256026
256454
|
function createModulerModifier() {
|
|
256027
256455
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
256028
256456
|
return async (frames) => {
|
|
@@ -256031,7 +256459,7 @@ function createModulerModifier() {
|
|
|
256031
256459
|
return frames;
|
|
256032
256460
|
};
|
|
256033
256461
|
}
|
|
256034
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
256462
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname28(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
|
|
256035
256463
|
const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
|
|
256036
256464
|
return (filename) => {
|
|
256037
256465
|
if (!filename)
|
|
@@ -260020,9 +260448,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
260020
260448
|
});
|
|
260021
260449
|
}
|
|
260022
260450
|
// src/cli/index.ts
|
|
260023
|
-
var __dirname4 =
|
|
260451
|
+
var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
|
|
260024
260452
|
async function runCLI(options) {
|
|
260025
|
-
ensureNpmAssets(
|
|
260453
|
+
ensureNpmAssets(join39(__dirname4, "../assets"));
|
|
260026
260454
|
const errorReporter = new ErrorReporter;
|
|
260027
260455
|
errorReporter.registerProcessErrorHandlers();
|
|
260028
260456
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -260061,4 +260489,4 @@ export {
|
|
|
260061
260489
|
runCLI
|
|
260062
260490
|
};
|
|
260063
260491
|
|
|
260064
|
-
//# debugId=
|
|
260492
|
+
//# debugId=85D29A9427275CB664756E2164756E21
|