@base44-preview/cli 0.0.38-pr.362.72930b8 → 0.0.38-pr.362.db7a625

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.
Files changed (31) hide show
  1. package/dist/{deno-runtime → assets/deno-runtime}/main.js.map +1 -1
  2. package/dist/cli/index.js +58 -59
  3. package/dist/cli/index.js.map +11 -12
  4. package/package.json +3 -3
  5. /package/dist/{deno-runtime → assets/deno-runtime}/main.js +0 -0
  6. /package/dist/{templates → assets/templates}/backend-and-client/.nvmrc +0 -0
  7. /package/dist/{templates → assets/templates}/backend-and-client/README.md +0 -0
  8. /package/dist/{templates → assets/templates}/backend-and-client/base44/agents/task_manager.jsonc +0 -0
  9. /package/dist/{templates → assets/templates}/backend-and-client/base44/app.jsonc.ejs +0 -0
  10. /package/dist/{templates → assets/templates}/backend-and-client/base44/config.jsonc.ejs +0 -0
  11. /package/dist/{templates → assets/templates}/backend-and-client/base44/entities/task.jsonc +0 -0
  12. /package/dist/{templates → assets/templates}/backend-and-client/components.json +0 -0
  13. /package/dist/{templates → assets/templates}/backend-and-client/gitignore.ejs +0 -0
  14. /package/dist/{templates → assets/templates}/backend-and-client/index.html +0 -0
  15. /package/dist/{templates → assets/templates}/backend-and-client/jsconfig.json +0 -0
  16. /package/dist/{templates → assets/templates}/backend-and-client/package.json +0 -0
  17. /package/dist/{templates → assets/templates}/backend-and-client/postcss.config.js +0 -0
  18. /package/dist/{templates → assets/templates}/backend-and-client/src/App.jsx +0 -0
  19. /package/dist/{templates → assets/templates}/backend-and-client/src/api/base44Client.js.ejs +0 -0
  20. /package/dist/{templates → assets/templates}/backend-and-client/src/components/Base44Logo.jsx +0 -0
  21. /package/dist/{templates → assets/templates}/backend-and-client/src/components/ui/button.jsx +0 -0
  22. /package/dist/{templates → assets/templates}/backend-and-client/src/components/ui/checkbox.jsx +0 -0
  23. /package/dist/{templates → assets/templates}/backend-and-client/src/components/ui/input.jsx +0 -0
  24. /package/dist/{templates → assets/templates}/backend-and-client/src/index.css +0 -0
  25. /package/dist/{templates → assets/templates}/backend-and-client/src/main.jsx +0 -0
  26. /package/dist/{templates → assets/templates}/backend-and-client/tailwind.config.js +0 -0
  27. /package/dist/{templates → assets/templates}/backend-and-client/vite.config.js +0 -0
  28. /package/dist/{templates → assets/templates}/backend-only/base44/app.jsonc.ejs +0 -0
  29. /package/dist/{templates → assets/templates}/backend-only/base44/config.jsonc.ejs +0 -0
  30. /package/dist/{templates → assets/templates}/backend-only/base44/gitignore.ejs +0 -0
  31. /package/dist/{templates → assets/templates}/templates.json +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../deno-runtime/main.ts"],
3
+ "sources": ["../../../deno-runtime/main.ts"],
4
4
  "sourcesContent": [
5
5
  "/**\n * Deno Function Wrapper\n *\n * This script is executed by Deno to run user functions.\n * It patches Deno.serve to inject a dynamic port before importing the user's function.\n *\n * Environment variables:\n * - FUNCTION_PATH: Absolute path to the user's function entry file\n * - FUNCTION_PORT: Port number for the function to listen on\n * - FUNCTION_NAME: Name of the function (for logging)\n */\n\n// Make this file a module for top-level await support\nexport {};\n\nconst functionPath = Deno.env.get(\"FUNCTION_PATH\");\nconst port = parseInt(Deno.env.get(\"FUNCTION_PORT\") || \"8000\", 10);\nconst functionName = Deno.env.get(\"FUNCTION_NAME\") || \"unknown\";\n\nif (!functionPath) {\n console.error(\"[wrapper] FUNCTION_PATH environment variable is required\");\n Deno.exit(1);\n}\n\n// Store the original Deno.serve\nconst originalServe = Deno.serve.bind(Deno);\n\n// Patch Deno.serve to inject our port and add onListen callback\n// @ts-expect-error - We're intentionally overriding Deno.serve\nDeno.serve = (\n optionsOrHandler:\n | Deno.ServeOptions\n | Deno.ServeHandler\n | (Deno.ServeOptions & { handler: Deno.ServeHandler }),\n maybeHandler?: Deno.ServeHandler,\n): Deno.HttpServer<Deno.NetAddr> => {\n const onListen = () => {\n // This message is used by FunctionManager to detect when the function is ready\n console.log(`[${functionName}] Listening on http://localhost:${port}`);\n };\n\n // Handle the different Deno.serve signatures:\n // 1. Deno.serve(handler)\n // 2. Deno.serve(options, handler)\n // 3. Deno.serve({ ...options, handler })\n if (typeof optionsOrHandler === \"function\") {\n // Signature: Deno.serve(handler)\n return originalServe({ port, onListen }, optionsOrHandler);\n }\n\n if (maybeHandler) {\n // Signature: Deno.serve(options, handler)\n return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);\n }\n\n // Signature: Deno.serve({ ...options, handler })\n const options = optionsOrHandler as Deno.ServeOptions & {\n handler: Deno.ServeHandler;\n };\n return originalServe({ ...options, port, onListen });\n};\n\nconsole.log(`[${functionName}] Starting function from ${functionPath}`);\n\n// Dynamically import the user's function\n// The function will call Deno.serve which is now patched to use our port\ntry {\n await import(functionPath);\n} catch (error) {\n console.error(`[${functionName}] Failed to load function:`, error);\n Deno.exit(1);\n}\n"
6
6
  ],
package/dist/cli/index.js CHANGED
@@ -206944,7 +206944,7 @@ var require_buffer_list = __commonJS((exports, module) => {
206944
206944
  }
206945
206945
  }, {
206946
206946
  key: "join",
206947
- value: function join16(s5) {
206947
+ value: function join15(s5) {
206948
206948
  if (this.length === 0)
206949
206949
  return "";
206950
206950
  var p4 = this.head;
@@ -226140,12 +226140,6 @@ import { homedir } from "node:os";
226140
226140
  import { dirname, join } from "node:path";
226141
226141
  import { fileURLToPath } from "node:url";
226142
226142
 
226143
- // src/core/assets.ts
226144
- var assetsDir;
226145
- function getAssetsDir() {
226146
- return assetsDir;
226147
- }
226148
-
226149
226143
  // src/core/consts.ts
226150
226144
  var PROJECT_SUBDIR = "base44";
226151
226145
  var CONFIG_FILE_EXTENSION = "jsonc";
@@ -226223,14 +226217,18 @@ function getBase44GlobalDir() {
226223
226217
  function getAuthFilePath() {
226224
226218
  return join(getBase44GlobalDir(), "auth", "auth.json");
226225
226219
  }
226226
- function getTemplatesDir() {
226227
- const assets = getAssetsDir();
226228
- if (assets)
226229
- return join(assets, "templates");
226230
- return join(__dirname2, "../templates");
226220
+ function getTemplatesDir(assetsDir) {
226221
+ if (assetsDir)
226222
+ return join(assetsDir, "templates");
226223
+ return join(__dirname2, "../assets/templates");
226224
+ }
226225
+ function getTemplatesIndexPath(assetsDir) {
226226
+ return join(getTemplatesDir(assetsDir), "templates.json");
226231
226227
  }
226232
- function getTemplatesIndexPath() {
226233
- return join(getTemplatesDir(), "templates.json");
226228
+ function getDenoWrapperPath(assetsDir) {
226229
+ if (assetsDir)
226230
+ return join(assetsDir, "deno-runtime", "main.js");
226231
+ return join(__dirname2, "../assets/deno-runtime/main.js");
226234
226232
  }
226235
226233
  function getAppConfigPath(projectRoot) {
226236
226234
  return join(projectRoot, PROJECT_SUBDIR, ".app.jsonc");
@@ -234233,16 +234231,17 @@ async function readAppConfig(projectRoot) {
234233
234231
  var import_ejs = __toESM(require_ejs(), 1);
234234
234232
  var import_front_matter = __toESM(require_front_matter(), 1);
234235
234233
  import { dirname as dirname7, join as join7 } from "node:path";
234236
- async function listTemplates() {
234237
- const parsed = await readJsonFile(getTemplatesIndexPath());
234234
+ async function listTemplates(assetsDir) {
234235
+ const indexPath = getTemplatesIndexPath(assetsDir);
234236
+ const parsed = await readJsonFile(indexPath);
234238
234237
  const result = TemplatesConfigSchema.safeParse(parsed);
234239
234238
  if (!result.success) {
234240
- throw new SchemaValidationError("Invalid templates configuration", result.error, getTemplatesIndexPath());
234239
+ throw new SchemaValidationError("Invalid templates configuration", result.error, indexPath);
234241
234240
  }
234242
234241
  return result.data.templates;
234243
234242
  }
234244
- async function renderTemplate(template, destPath, data) {
234245
- const templateDir = join7(getTemplatesDir(), template.path);
234243
+ async function renderTemplate(template, destPath, data, assetsDir) {
234244
+ const templateDir = join7(getTemplatesDir(assetsDir), template.path);
234246
234245
  const files = await globby("**/*", {
234247
234246
  cwd: templateDir,
234248
234247
  dot: true,
@@ -234279,14 +234278,10 @@ async function assertProjectNotExists(dirPath) {
234279
234278
  }
234280
234279
  }
234281
234280
  async function createProjectFiles(options) {
234282
- const { name: name2, description, path: basePath, template } = options;
234281
+ const { name: name2, description, path: basePath, template, assetsDir } = options;
234283
234282
  await assertProjectNotExists(basePath);
234284
234283
  const { projectId } = await createProject(name2, description);
234285
- await renderTemplate(template, basePath, {
234286
- name: name2,
234287
- description,
234288
- projectId
234289
- });
234284
+ await renderTemplate(template, basePath, { name: name2, description, projectId }, assetsDir);
234290
234285
  return {
234291
234286
  projectId,
234292
234287
  projectDir: basePath
@@ -241957,8 +241952,8 @@ var package_default = {
241957
241952
  "bin"
241958
241953
  ],
241959
241954
  scripts: {
241960
- build: "bun run clean && cp -r templates dist/ && bun run infra/build.ts",
241961
- "build:watch": "bun run clean && cp -r templates dist/ && bun run infra/build.ts --watch",
241955
+ build: "bun run clean && mkdir -p dist/assets && cp -r templates dist/assets/ && bun run infra/build.ts",
241956
+ "build:watch": "bun run clean && mkdir -p dist/assets && cp -r templates dist/assets/ && bun run infra/build.ts --watch",
241962
241957
  typecheck: "tsc --noEmit",
241963
241958
  dev: "./bin/dev.ts",
241964
241959
  start: "./bin/run.js",
@@ -243145,8 +243140,8 @@ function getFunctionsDeployCommand(context) {
243145
243140
  import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
243146
243141
  var import_kebabCase = __toESM(require_kebabCase(), 1);
243147
243142
  var DEFAULT_TEMPLATE_ID = "backend-only";
243148
- async function getTemplateById(templateId) {
243149
- const templates = await listTemplates();
243143
+ async function getTemplateById(templateId, assetsDir) {
243144
+ const templates = await listTemplates(assetsDir);
243150
243145
  const template2 = templates.find((t) => t.id === templateId);
243151
243146
  if (!template2) {
243152
243147
  const validIds = templates.map((t) => t.id).join(", ");
@@ -243162,8 +243157,8 @@ function validateNonInteractiveFlags(command) {
243162
243157
  command.error("Non-interactive mode requires all flags: --name, --path");
243163
243158
  }
243164
243159
  }
243165
- async function createInteractive(options) {
243166
- const templates = await listTemplates();
243160
+ async function createInteractive(options, assetsDir) {
243161
+ const templates = await listTemplates(assetsDir);
243167
243162
  const templateOptions = templates.map((t) => ({
243168
243163
  value: t,
243169
243164
  label: t.name,
@@ -243204,10 +243199,10 @@ async function createInteractive(options) {
243204
243199
  deploy: options.deploy,
243205
243200
  skills: options.skills,
243206
243201
  isInteractive: true
243207
- });
243202
+ }, assetsDir);
243208
243203
  }
243209
- async function createNonInteractive(options) {
243210
- const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
243204
+ async function createNonInteractive(options, assetsDir) {
243205
+ const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID, assetsDir);
243211
243206
  return await executeCreate({
243212
243207
  template: template2,
243213
243208
  name: options.name,
@@ -243215,7 +243210,7 @@ async function createNonInteractive(options) {
243215
243210
  deploy: options.deploy,
243216
243211
  skills: options.skills,
243217
243212
  isInteractive: false
243218
- });
243213
+ }, assetsDir);
243219
243214
  }
243220
243215
  async function executeCreate({
243221
243216
  template: template2,
@@ -243225,7 +243220,7 @@ async function executeCreate({
243225
243220
  deploy: deploy5,
243226
243221
  skills,
243227
243222
  isInteractive
243228
- }) {
243223
+ }, assetsDir) {
243229
243224
  const name2 = rawName.trim();
243230
243225
  const resolvedPath = resolve2(projectPath);
243231
243226
  const { projectId } = await runTask("Setting up your project...", async () => {
@@ -243233,7 +243228,8 @@ async function executeCreate({
243233
243228
  name: name2,
243234
243229
  description: description?.trim(),
243235
243230
  path: resolvedPath,
243236
- template: template2
243231
+ template: template2,
243232
+ assetsDir
243237
243233
  });
243238
243234
  }, {
243239
243235
  successMessage: theme.colors.base44Orange("Project created successfully"),
@@ -243311,9 +243307,9 @@ function getCreateCommand(context) {
243311
243307
  return new Command("create").description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").hook("preAction", validateNonInteractiveFlags).action(async (name2, options) => {
243312
243308
  const isNonInteractive = !!(options.name ?? name2) && !!options.path;
243313
243309
  if (isNonInteractive) {
243314
- await runCommand(() => createNonInteractive({ name: options.name ?? name2, ...options }), { requireAuth: true, requireAppConfig: false }, context);
243310
+ await runCommand(() => createNonInteractive({ name: options.name ?? name2, ...options }, context.assetsDir), { requireAuth: true, requireAppConfig: false }, context);
243315
243311
  } else {
243316
- await runCommand(() => createInteractive({ name: name2, ...options }), { fullBanner: true, requireAuth: true, requireAppConfig: false }, context);
243312
+ await runCommand(() => createInteractive({ name: name2, ...options }, context.assetsDir), { fullBanner: true, requireAuth: true, requireAppConfig: false }, context);
243317
243313
  }
243318
243314
  });
243319
243315
  }
@@ -243950,7 +243946,7 @@ function getTypesCommand(context) {
243950
243946
  }
243951
243947
 
243952
243948
  // src/cli/dev/dev-server/main.ts
243953
- import { dirname as dirname15, join as join18 } from "node:path";
243949
+ import { dirname as dirname14, join as join17 } from "node:path";
243954
243950
  var import_cors = __toESM(require_lib4(), 1);
243955
243951
  var import_express4 = __toESM(require_express(), 1);
243956
243952
 
@@ -244109,10 +244105,6 @@ function createDevLogger() {
244109
244105
 
244110
244106
  // src/cli/dev/dev-server/function-manager.ts
244111
244107
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
244112
- import { dirname as dirname12, join as join15 } from "node:path";
244113
- import { fileURLToPath as fileURLToPath7 } from "node:url";
244114
- var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
244115
- var WRAPPER_PATH = getAssetsDir() ? join15(getAssetsDir(), "deno-runtime", "main.js") : join15(__dirname5, "../deno-runtime/main.js");
244116
244108
  var READY_TIMEOUT = 30000;
244117
244109
 
244118
244110
  class FunctionManager {
@@ -244120,9 +244112,11 @@ class FunctionManager {
244120
244112
  running = new Map;
244121
244113
  starting = new Map;
244122
244114
  logger;
244123
- constructor(functions, logger) {
244115
+ wrapperPath;
244116
+ constructor(functions, logger, wrapperPath) {
244124
244117
  this.functions = new Map(functions.map((f7) => [f7.name, f7]));
244125
244118
  this.logger = logger;
244119
+ this.wrapperPath = wrapperPath;
244126
244120
  if (functions.length > 0) {
244127
244121
  this.verifyDenoIsInstalled();
244128
244122
  }
@@ -244195,7 +244189,7 @@ class FunctionManager {
244195
244189
  }
244196
244190
  spawnFunction(func, port) {
244197
244191
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
244198
- const process21 = spawn2("deno", ["run", "--allow-all", WRAPPER_PATH], {
244192
+ const process21 = spawn2("deno", ["run", "--allow-all", this.wrapperPath], {
244199
244193
  env: {
244200
244194
  ...globalThis.process.env,
244201
244195
  FUNCTION_PATH: func.entryPath,
@@ -245416,9 +245410,9 @@ class NodeFsHandler {
245416
245410
  if (this.fsw.closed) {
245417
245411
  return;
245418
245412
  }
245419
- const dirname14 = sp2.dirname(file2);
245413
+ const dirname13 = sp2.dirname(file2);
245420
245414
  const basename5 = sp2.basename(file2);
245421
- const parent = this.fsw._getWatchedDir(dirname14);
245415
+ const parent = this.fsw._getWatchedDir(dirname13);
245422
245416
  let prevStats = stats;
245423
245417
  if (parent.has(basename5))
245424
245418
  return;
@@ -245445,7 +245439,7 @@ class NodeFsHandler {
245445
245439
  prevStats = newStats2;
245446
245440
  }
245447
245441
  } catch (error48) {
245448
- this.fsw._remove(dirname14, basename5);
245442
+ this.fsw._remove(dirname13, basename5);
245449
245443
  }
245450
245444
  } else if (parent.has(basename5)) {
245451
245445
  const at13 = newStats.atimeMs;
@@ -246406,7 +246400,7 @@ async function createDevServer(options8) {
246406
246400
  next();
246407
246401
  });
246408
246402
  const devLogger = createDevLogger();
246409
- const functionManager = new FunctionManager(functions, devLogger);
246403
+ const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
246410
246404
  const functionRoutes = createFunctionRouter(functionManager, devLogger);
246411
246405
  app.use("/api/apps/:appId/functions", functionRoutes);
246412
246406
  if (functionManager.getFunctionNames().length > 0) {
@@ -246448,8 +246442,8 @@ async function createDevServer(options8) {
246448
246442
  broadcastEntityEvent(io6, appId, entityName, event);
246449
246443
  };
246450
246444
  const base44ConfigWatcher = new WatchBase44({
246451
- functions: join18(dirname15(project2.configPath), project2.functionsDir),
246452
- entities: join18(dirname15(project2.configPath), project2.entitiesDir)
246445
+ functions: join17(dirname14(project2.configPath), project2.functionsDir),
246446
+ entities: join17(dirname14(project2.configPath), project2.entitiesDir)
246453
246447
  }, devLogger);
246454
246448
  base44ConfigWatcher.on("change", async (name2) => {
246455
246449
  try {
@@ -246493,10 +246487,11 @@ async function createDevServer(options8) {
246493
246487
  }
246494
246488
 
246495
246489
  // src/cli/commands/dev.ts
246496
- async function devAction(options8) {
246490
+ async function devAction(options8, context) {
246497
246491
  const port = options8.port ? Number(options8.port) : undefined;
246498
246492
  const { port: resolvedPort } = await createDevServer({
246499
246493
  port,
246494
+ denoWrapperPath: getDenoWrapperPath(context.assetsDir),
246500
246495
  loadResources: async () => {
246501
246496
  const { functions, entities, project: project2 } = await readProjectConfig();
246502
246497
  return { functions, entities, project: project2 };
@@ -246508,7 +246503,7 @@ async function devAction(options8) {
246508
246503
  }
246509
246504
  function getDevCommand(context) {
246510
246505
  return new Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").action(async (options8) => {
246511
- await runCommand(() => devAction(options8), { requireAuth: true }, context);
246506
+ await runCommand(() => devAction(options8, context), { requireAuth: true }, context);
246512
246507
  });
246513
246508
  }
246514
246509
 
@@ -246638,7 +246633,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246638
246633
  import { release, type } from "node:os";
246639
246634
 
246640
246635
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246641
- import { dirname as dirname16, posix, sep } from "path";
246636
+ import { dirname as dirname15, posix, sep } from "path";
246642
246637
  function createModulerModifier() {
246643
246638
  const getModuleFromFileName = createGetModuleFromFilename();
246644
246639
  return async (frames) => {
@@ -246647,7 +246642,7 @@ function createModulerModifier() {
246647
246642
  return frames;
246648
246643
  };
246649
246644
  }
246650
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246645
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246651
246646
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246652
246647
  return (filename) => {
246653
246648
  if (!filename)
@@ -250836,11 +250831,15 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
250836
250831
  });
250837
250832
  }
250838
250833
  // src/cli/index.ts
250839
- async function runCLI() {
250834
+ async function runCLI(options8) {
250840
250835
  const errorReporter = new ErrorReporter;
250841
250836
  errorReporter.registerProcessErrorHandlers();
250842
250837
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
250843
- const context = { errorReporter, isNonInteractive };
250838
+ const context = {
250839
+ errorReporter,
250840
+ isNonInteractive,
250841
+ assetsDir: options8?.assetsDir
250842
+ };
250844
250843
  const program2 = createProgram(context);
250845
250844
  try {
250846
250845
  const userInfo = await readAuth();
@@ -250865,4 +250864,4 @@ export {
250865
250864
  CLIExitError
250866
250865
  };
250867
250866
 
250868
- //# debugId=16BBB389AA548E0B64756E2164756E21
250867
+ //# debugId=D0A2D98BCA9348F864756E2164756E21