@base44-preview/cli 0.0.31-pr.226.58caa4f → 0.0.31-pr.226.5f9b2b0
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.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js.map
CHANGED
|
@@ -813,7 +813,7 @@
|
|
|
813
813
|
"import { join } from \"node:path\";\nimport { PROJECT_SUBDIR, TYPES_OUTPUT_SUBDIR } from \"@/core/consts.js\";\nimport { pathExists, readJsonFile, writeJsonFile } from \"@/core/utils/fs.js\";\n\nconst TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;\n\n/**\n * Update project configuration files after generating types.\n * Currently handles:\n * - tsconfig.json: adds base44/.types to the include array\n *\n * @returns true if tsconfig.json was updated, false otherwise\n */\nexport async function updateProjectConfig(\n projectRoot: string\n): Promise<boolean> {\n const tsconfigPath = join(projectRoot, \"tsconfig.json\");\n\n if (!(await pathExists(tsconfigPath))) {\n return false;\n }\n\n try {\n const tsconfig = (await readJsonFile(tsconfigPath)) as {\n include?: string[];\n };\n\n // Ensure include array exists\n if (!tsconfig.include) {\n tsconfig.include = [];\n }\n\n // Check if already included\n if (tsconfig.include.includes(TYPES_INCLUDE_PATH)) {\n return false;\n }\n\n // Add to include array\n tsconfig.include.push(TYPES_INCLUDE_PATH);\n await writeJsonFile(tsconfigPath, tsconfig);\n return true;\n } catch {\n // If we can't parse or update, silently fail and let user configure manually\n return false;\n }\n}\n",
|
|
814
814
|
"import { Command } from \"commander\";\nimport type { CLIContext } from \"@/cli/types.js\";\nimport { runCommand, runTask } from \"@/cli/utils/index.js\";\nimport type { RunCommandResult } from \"@/cli/utils/runCommand.js\";\nimport { readProjectConfig } from \"@/core/index.js\";\nimport { generateTypesFile, updateProjectConfig } from \"@/core/types/index.js\";\n\nconst TYPES_FILE_PATH = \"base44/.types/types.d.ts\";\n\nasync function generateTypesAction(): Promise<RunCommandResult> {\n const { entities, functions, agents, project } = await readProjectConfig();\n\n await runTask(\"Generating types\", async () => {\n await generateTypesFile({ entities, functions, agents });\n });\n\n const tsconfigUpdated = await updateProjectConfig(project.root);\n\n return {\n outroMessage: tsconfigUpdated\n ? `Generated ${TYPES_FILE_PATH} and updated tsconfig.json`\n : `Generated ${TYPES_FILE_PATH}`,\n };\n}\n\nexport function getTypesGenerateCommand(context: CLIContext): Command {\n return new Command(\"generate\")\n .description(\n \"Generate TypeScript declaration file (types.d.ts) from project resources\"\n )\n .action(async () => {\n await runCommand(\n () => generateTypesAction(),\n { requireAuth: false },\n context\n );\n });\n}\n",
|
|
815
815
|
"import { Command } from \"commander\";\nimport type { CLIContext } from \"@/cli/types.js\";\nimport { getTypesGenerateCommand } from \"./generate.js\";\n\nexport function getTypesCommand(context: CLIContext): Command {\n return new Command(\"types\")\n .description(\"Manage TypeScript type generation\")\n .addCommand(getTypesGenerateCommand(context));\n}\n",
|
|
816
|
-
"import type { Server } from \"node:http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { createProxyMiddleware } from \"http-proxy-middleware\";\n\nconst DEFAULT_PORT = 3000;\nconst BASE44_APP_URL = \"https://base44.app\";\n\ninterface DevServerResult {\n port: number;\n server: Server;\n}\n\nexport async function createDevServer(): Promise<DevServerResult> {\n // After creating of the dev server we need to pass url to the base44 createClient() on the client side.\n // It lives in a separate process, so it's a problem to communicate port and align build process when we're not in full control.\n // So for now I will hard code the port.\n const port = DEFAULT_PORT;\n\n const app = express();\n\n const remoteProxy = createProxyMiddleware({\n target: BASE44_APP_URL,\n changeOrigin: true,\n });\n\n app.use(\n cors({\n origin: /^http:\\/\\/localhost(:\\d+)?$/,\n credentials: true,\n })
|
|
816
|
+
"import type { Server } from \"node:http\";\nimport cors from \"cors\";\nimport express from \"express\";\nimport { createProxyMiddleware } from \"http-proxy-middleware\";\n\nconst DEFAULT_PORT = 3000;\nconst BASE44_APP_URL = \"https://base44.app\";\n\ninterface DevServerResult {\n port: number;\n server: Server;\n}\n\nexport async function createDevServer(): Promise<DevServerResult> {\n // After creating of the dev server we need to pass url to the base44 createClient() on the client side.\n // It lives in a separate process, so it's a problem to communicate port and align build process when we're not in full control.\n // So for now I will hard code the port.\n const port = DEFAULT_PORT;\n\n const app = express();\n\n const remoteProxy = createProxyMiddleware({\n target: BASE44_APP_URL,\n changeOrigin: true,\n });\n\n app.use(\n cors({\n origin: /^http:\\/\\/localhost(:\\d+)?$/,\n credentials: true,\n })\n );\n\n // Redirect OAuth routes to base44.app directly — proxying breaks the\n // redirect flow and session cookies set by the provider.\n const AUTH_ROUTE_PATTERN = /^\\/api\\/apps\\/auth(\\/|$)/;\n app.use((req, res, next) => {\n if (AUTH_ROUTE_PATTERN.test(req.path)) {\n const targetUrl = `${BASE44_APP_URL}${req.originalUrl}`;\n return res.redirect(targetUrl);\n }\n next();\n });\n\n app.use((req, res, next) => {\n return remoteProxy(req, res, next);\n });\n\n return new Promise((resolve, reject) => {\n const server = app.listen(port, \"127.0.0.1\", (err) => {\n if (err) {\n if (\"code\" in err && err.code === \"EADDRINUSE\") {\n reject(\n new Error(\n `Port ${port} is already in use. Stop the other process and try again.`\n )\n );\n } else {\n reject(err);\n }\n } else {\n resolve({\n port,\n server,\n });\n }\n });\n });\n}\n",
|
|
817
817
|
"import { Command } from \"commander\";\nimport { createDevServer } from \"@/cli/dev/dev-server/main\";\nimport { runCommand, theme } from \"@/cli/utils/index.js\";\nimport type { RunCommandResult } from \"@/cli/utils/runCommand.js\";\nimport type { CLIContext } from \"../types.js\";\n\nasync function devAction(): Promise<RunCommandResult> {\n const { port } = await createDevServer();\n\n return {\n outroMessage: `Dev server is available at ${theme.colors.links(`http://localhost:${port}`)}`,\n };\n}\n\nexport function getDevCommand(context: CLIContext): Command {\n return new Command(\"dev\")\n .description(\"Start the development server\")\n .action(async () => {\n await runCommand(devAction, { requireAuth: true }, context);\n });\n}\n",
|
|
818
818
|
"import { resolve } from \"node:path\";\nimport type { Option } from \"@clack/prompts\";\nimport { cancel, confirm, isCancel, log, select, text } from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { execa } from \"execa\";\nimport kebabCase from \"lodash.kebabcase\";\nimport { deployAction } from \"@/cli/commands/project/deploy.js\";\nimport { CLIExitError } from \"@/cli/errors.js\";\nimport type { CLIContext } from \"@/cli/types.js\";\nimport { runCommand, runTask, theme } from \"@/cli/utils/index.js\";\nimport type { RunCommandResult } from \"@/cli/utils/runCommand.js\";\nimport type { Project } from \"@/core/index.js\";\nimport {\n createProject,\n createProjectFilesForExistingProject,\n InvalidInputError,\n isDirEmpty,\n listProjects,\n readProjectConfig,\n setAppConfig,\n writeAppConfig,\n writeFile,\n} from \"@/core/index.js\";\n\ninterface EjectOptions {\n path?: string;\n projectId?: string;\n yes?: boolean;\n}\n\nasync function eject(options: EjectOptions): Promise<RunCommandResult> {\n const projects = await listProjects();\n const ejectableProjects = projects.filter(\n (p) => p.isManagedSourceCode !== false\n );\n\n let selectedProject: Project;\n\n if (options.projectId) {\n const foundProject = ejectableProjects.find(\n (p) => p.id === options.projectId\n );\n\n if (!foundProject) {\n throw new InvalidInputError(\n `Project with ID \"${options.projectId}\" not found or not ejectable`,\n {\n hints: [\n {\n message:\n \"Run 'base44 eject' without --project-id to see available projects\",\n },\n ],\n }\n );\n }\n\n selectedProject = foundProject;\n log.info(`Selected project: ${theme.styles.bold(selectedProject.name)}`);\n } else {\n // Interactive: show project selection prompt\n const projectOptions: Option<Project>[] = ejectableProjects.map((p) => ({\n value: p,\n label: p.name,\n hint: p.userDescription ?? undefined,\n }));\n\n const selected = await select({\n message: `Choose a project to download ${theme.styles.dim(\"(Note: this will clone the selected project)\")}`,\n options: projectOptions,\n });\n\n if (isCancel(selected)) {\n cancel(\"Operation cancelled.\");\n throw new CLIExitError(0);\n }\n selectedProject = selected;\n }\n\n const projectId = selectedProject.id;\n const suggestedPath = (await isDirEmpty())\n ? `./`\n : `./${kebabCase(selectedProject.name)}`;\n\n const selectedPath =\n options.path ??\n (await text({\n message: \"Where should we create your project?\",\n placeholder: suggestedPath,\n initialValue: suggestedPath,\n }));\n\n if (isCancel(selectedPath)) {\n cancel(\"Operation cancelled.\");\n throw new CLIExitError(0);\n }\n\n const resolvedPath = resolve(selectedPath);\n\n await runTask(\n \"Downloading your project's code...\",\n async (updateMessage) => {\n await createProjectFilesForExistingProject({\n projectId,\n projectPath: resolvedPath,\n });\n\n updateMessage(\"Creating a new project...\");\n\n const newProjectName = `${selectedProject.name} Copy`;\n const { projectId: newProjectId } = await createProject(\n newProjectName,\n selectedProject.userDescription ?? undefined\n );\n\n updateMessage(\"Linking the project...\");\n\n await writeAppConfig(resolvedPath, newProjectId);\n await writeFile(\n `${resolvedPath}/.env.local`,\n `VITE_BASE44_APP_ID=${newProjectId}`\n );\n\n setAppConfig({ id: newProjectId, projectRoot: resolvedPath });\n },\n {\n successMessage: theme.colors.base44Orange(\"Project pulled successfully\"),\n errorMessage: \"Failed to pull project\",\n }\n );\n\n const { project } = await readProjectConfig(resolvedPath);\n const installCommand = project.site?.installCommand;\n const buildCommand = project.site?.buildCommand;\n\n // Only offer deploy if the project has build commands configured\n if (installCommand && buildCommand) {\n const shouldDeploy = options.yes\n ? true\n : await confirm({\n message: \"Would you like to deploy your project now?\",\n });\n\n if (!isCancel(shouldDeploy) && shouldDeploy) {\n await runTask(\n \"Installing dependencies...\",\n async (updateMessage) => {\n await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;\n\n updateMessage(\"Building project...\");\n await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;\n },\n {\n successMessage: theme.colors.base44Orange(\n \"Project built successfully\"\n ),\n errorMessage: \"Failed to build project\",\n }\n );\n\n await deployAction({ yes: true, projectRoot: resolvedPath });\n }\n }\n\n return { outroMessage: \"Your new project is set and ready to use\" };\n}\n\nexport function getEjectCommand(context: CLIContext): Command {\n return new Command(\"eject\")\n .description(\"Download the code for an existing Base44 project\")\n .option(\"-p, --path <path>\", \"Path where to write the project\")\n .option(\n \"--project-id <id>\",\n \"Project ID to eject (skips interactive selection)\"\n )\n .option(\"-y, --yes\", \"Skip confirmation prompts\")\n .action(async (options: EjectOptions) => {\n await runCommand(\n () => eject(options),\n { requireAuth: true, requireAppConfig: false },\n context\n );\n });\n}\n",
|
|
819
819
|
"import { Command } from \"commander\";\nimport { getAgentsCommand } from \"@/cli/commands/agents/index.js\";\nimport { getLoginCommand } from \"@/cli/commands/auth/login.js\";\nimport { getLogoutCommand } from \"@/cli/commands/auth/logout.js\";\nimport { getWhoamiCommand } from \"@/cli/commands/auth/whoami.js\";\nimport { getDashboardCommand } from \"@/cli/commands/dashboard/index.js\";\nimport { getEntitiesPushCommand } from \"@/cli/commands/entities/push.js\";\nimport { getFunctionsDeployCommand } from \"@/cli/commands/functions/deploy.js\";\nimport { getCreateCommand } from \"@/cli/commands/project/create.js\";\nimport { getDeployCommand } from \"@/cli/commands/project/deploy.js\";\nimport { getLinkCommand } from \"@/cli/commands/project/link.js\";\nimport { getSiteCommand } from \"@/cli/commands/site/index.js\";\nimport { getTypesCommand } from \"@/cli/commands/types/index.js\";\nimport packageJson from \"../../package.json\";\nimport { getDevCommand } from \"./commands/dev.js\";\nimport { getEjectCommand } from \"./commands/project/eject.js\";\nimport type { CLIContext } from \"./types.js\";\n\nexport function createProgram(context: CLIContext): Command {\n const program = new Command();\n\n program\n .name(\"base44\")\n .description(\n \"Base44 CLI - Unified interface for managing Base44 applications\"\n )\n .version(packageJson.version);\n\n program.configureHelp({\n sortSubcommands: true,\n });\n\n // Register authentication commands\n program.addCommand(getLoginCommand(context));\n program.addCommand(getWhoamiCommand(context));\n program.addCommand(getLogoutCommand(context));\n\n // Register project commands\n program.addCommand(getCreateCommand(context));\n program.addCommand(getDashboardCommand(context));\n program.addCommand(getDeployCommand(context));\n program.addCommand(getLinkCommand(context));\n program.addCommand(getEjectCommand(context));\n\n // Register entities commands\n program.addCommand(getEntitiesPushCommand(context));\n\n // Register agents commands\n program.addCommand(getAgentsCommand(context));\n\n // Register functions commands\n program.addCommand(getFunctionsDeployCommand(context));\n\n // Register site commands\n program.addCommand(getSiteCommand(context));\n\n // Register types command\n program.addCommand(getTypesCommand(context), { hidden: true });\n\n // Register development commands\n program.addCommand(getDevCommand(context), { hidden: true });\n\n return program;\n}\n",
|