@base44-preview/cli 0.0.30-pr.220.e264f60 → 0.0.30-pr.220.f6fa1e1
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 +53 -36
- package/dist/cli/index.js.map +5 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -159581,9 +159581,14 @@ async function listProjects() {
|
|
|
159581
159581
|
return result.data;
|
|
159582
159582
|
}
|
|
159583
159583
|
async function downloadProject(projectId, projectPath) {
|
|
159584
|
-
|
|
159585
|
-
|
|
159586
|
-
|
|
159584
|
+
let response;
|
|
159585
|
+
try {
|
|
159586
|
+
response = await base44Client.get(`api/apps/${projectId}/eject`, {
|
|
159587
|
+
timeout: false
|
|
159588
|
+
});
|
|
159589
|
+
} catch (error48) {
|
|
159590
|
+
throw await ApiError.fromHttpError(error48, "downloading project");
|
|
159591
|
+
}
|
|
159587
159592
|
const nodeStream = Readable.fromWeb(response.body);
|
|
159588
159593
|
await makeDirectory(projectPath);
|
|
159589
159594
|
await pipeline(nodeStream, extract({ cwd: projectPath }));
|
|
@@ -161131,15 +161136,18 @@ async function renderTemplate(template, destPath, data) {
|
|
|
161131
161136
|
}
|
|
161132
161137
|
|
|
161133
161138
|
// src/core/project/create.ts
|
|
161134
|
-
async function
|
|
161135
|
-
const { name: name2, description, path: basePath, template } = options;
|
|
161139
|
+
async function assertProjectNotExists(dirPath) {
|
|
161136
161140
|
const existingConfigs = await globby(PROJECT_CONFIG_PATTERNS, {
|
|
161137
|
-
cwd:
|
|
161141
|
+
cwd: dirPath,
|
|
161138
161142
|
absolute: true
|
|
161139
161143
|
});
|
|
161140
161144
|
if (existingConfigs.length > 0) {
|
|
161141
161145
|
throw new ConfigExistsError(`A Base44 project already exists at ${existingConfigs[0]}. Please choose a different location.`);
|
|
161142
161146
|
}
|
|
161147
|
+
}
|
|
161148
|
+
async function createProjectFiles(options) {
|
|
161149
|
+
const { name: name2, description, path: basePath, template } = options;
|
|
161150
|
+
await assertProjectNotExists(basePath);
|
|
161143
161151
|
const { projectId } = await createProject(name2, description);
|
|
161144
161152
|
await renderTemplate(template, basePath, {
|
|
161145
161153
|
name: name2,
|
|
@@ -161153,13 +161161,7 @@ async function createProjectFiles(options) {
|
|
|
161153
161161
|
}
|
|
161154
161162
|
async function createProjectFilesForExistingProject(options) {
|
|
161155
161163
|
const { projectId, projectPath } = options;
|
|
161156
|
-
|
|
161157
|
-
cwd: projectPath,
|
|
161158
|
-
absolute: true
|
|
161159
|
-
});
|
|
161160
|
-
if (existingConfigs.length > 0) {
|
|
161161
|
-
throw new Error(`A Base44 project already exists at ${existingConfigs[0]}. Please choose a different location.`);
|
|
161162
|
-
}
|
|
161164
|
+
await assertProjectNotExists(projectPath);
|
|
161163
161165
|
await downloadProject(projectId, projectPath);
|
|
161164
161166
|
return {
|
|
161165
161167
|
projectId,
|
|
@@ -170268,18 +170270,35 @@ var import_lodash2 = __toESM(require_lodash(), 1);
|
|
|
170268
170270
|
async function eject(options8) {
|
|
170269
170271
|
const projects = await listProjects();
|
|
170270
170272
|
const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
|
|
170271
|
-
|
|
170272
|
-
|
|
170273
|
-
|
|
170274
|
-
|
|
170275
|
-
|
|
170276
|
-
|
|
170277
|
-
|
|
170278
|
-
|
|
170279
|
-
|
|
170280
|
-
|
|
170281
|
-
|
|
170282
|
-
|
|
170273
|
+
let selectedProject;
|
|
170274
|
+
if (options8.projectId) {
|
|
170275
|
+
const foundProject = ejectableProjects.find((p4) => p4.id === options8.projectId);
|
|
170276
|
+
if (!foundProject) {
|
|
170277
|
+
throw new InvalidInputError(`Project with ID "${options8.projectId}" not found or not ejectable`, {
|
|
170278
|
+
hints: [
|
|
170279
|
+
{
|
|
170280
|
+
message: "Run 'base44 eject' without --project-id to see available projects"
|
|
170281
|
+
}
|
|
170282
|
+
]
|
|
170283
|
+
});
|
|
170284
|
+
}
|
|
170285
|
+
selectedProject = foundProject;
|
|
170286
|
+
M2.info(`Selected project: ${theme.styles.bold(selectedProject.name)}`);
|
|
170287
|
+
} else {
|
|
170288
|
+
const projectOptions = ejectableProjects.map((p4) => ({
|
|
170289
|
+
value: p4,
|
|
170290
|
+
label: p4.name,
|
|
170291
|
+
hint: p4.userDescription
|
|
170292
|
+
}));
|
|
170293
|
+
const selected = await ve({
|
|
170294
|
+
message: `Choose a project to download ${theme.styles.dim("(Note: this will clone the selected project)")}`,
|
|
170295
|
+
options: projectOptions
|
|
170296
|
+
});
|
|
170297
|
+
if (pD(selected)) {
|
|
170298
|
+
xe("Operation cancelled.");
|
|
170299
|
+
throw new CLIExitError(0);
|
|
170300
|
+
}
|
|
170301
|
+
selectedProject = selected;
|
|
170283
170302
|
}
|
|
170284
170303
|
const projectId = selectedProject.id;
|
|
170285
170304
|
const suggestedPath = await isDirEmpty() ? `./` : `./${import_lodash2.default(selectedProject.name)}`;
|
|
@@ -170290,7 +170309,7 @@ async function eject(options8) {
|
|
|
170290
170309
|
});
|
|
170291
170310
|
if (pD(selectedPath)) {
|
|
170292
170311
|
xe("Operation cancelled.");
|
|
170293
|
-
|
|
170312
|
+
throw new CLIExitError(0);
|
|
170294
170313
|
}
|
|
170295
170314
|
const resolvedPath = resolve5(selectedPath);
|
|
170296
170315
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
@@ -170307,16 +170326,16 @@ async function eject(options8) {
|
|
|
170307
170326
|
setAppConfig({ id: newProjectId, projectRoot: resolvedPath });
|
|
170308
170327
|
}, {
|
|
170309
170328
|
successMessage: theme.colors.base44Orange("Project pulled successfully"),
|
|
170310
|
-
errorMessage: "Failed to
|
|
170311
|
-
});
|
|
170312
|
-
const shouldDeploy = await ye({
|
|
170313
|
-
message: "Would you like to deploy your project now?"
|
|
170329
|
+
errorMessage: "Failed to pull project"
|
|
170314
170330
|
});
|
|
170315
170331
|
const { project: project2 } = await readProjectConfig(resolvedPath);
|
|
170316
170332
|
const installCommand = project2.site?.installCommand;
|
|
170317
170333
|
const buildCommand = project2.site?.buildCommand;
|
|
170318
|
-
if (
|
|
170319
|
-
|
|
170334
|
+
if (installCommand && buildCommand) {
|
|
170335
|
+
const shouldDeploy = options8.yes ? true : await ye({
|
|
170336
|
+
message: "Would you like to deploy your project now?"
|
|
170337
|
+
});
|
|
170338
|
+
if (!pD(shouldDeploy) && shouldDeploy) {
|
|
170320
170339
|
await runTask("Installing dependencies...", async (updateMessage) => {
|
|
170321
170340
|
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
170322
170341
|
updateMessage("Building project...");
|
|
@@ -170326,14 +170345,12 @@ async function eject(options8) {
|
|
|
170326
170345
|
errorMessage: "Failed to build project"
|
|
170327
170346
|
});
|
|
170328
170347
|
await deployAction({ yes: true });
|
|
170329
|
-
} catch (error48) {
|
|
170330
|
-
console.error(error48);
|
|
170331
170348
|
}
|
|
170332
170349
|
}
|
|
170333
170350
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
170334
170351
|
}
|
|
170335
170352
|
function getEjectCommand(context) {
|
|
170336
|
-
return new Command("eject").description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").action(async (options8) => {
|
|
170353
|
+
return new Command("eject").description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(async (options8) => {
|
|
170337
170354
|
await runCommand(() => eject(options8), { requireAuth: true, requireAppConfig: false }, context);
|
|
170338
170355
|
});
|
|
170339
170356
|
}
|
|
@@ -174624,4 +174641,4 @@ export {
|
|
|
174624
174641
|
CLIExitError
|
|
174625
174642
|
};
|
|
174626
174643
|
|
|
174627
|
-
//# debugId=
|
|
174644
|
+
//# debugId=529518DD8534262664756E2164756E21
|