@base44-preview/cli 0.0.1-pr.16.514b62d → 0.0.1-pr.16.6c1f17f

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 CHANGED
@@ -4,7 +4,7 @@ import chalk from "chalk";
4
4
  import { cancel, group, intro, log, select, spinner, text } from "@clack/prompts";
5
5
  import pWaitFor from "p-wait-for";
6
6
  import { z } from "zod";
7
- import { dirname, join, resolve } from "node:path";
7
+ import { dirname, isAbsolute, join, resolve } from "node:path";
8
8
  import { homedir } from "node:os";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { config } from "dotenv";
@@ -468,6 +468,7 @@ async function listTemplates() {
468
468
  * - All other files are copied directly
469
469
  */
470
470
  async function renderTemplate(template, destPath, data) {
471
+ if (template.path.includes("..") || isAbsolute(template.path)) throw new Error(`Invalid template path: ${template.path}`);
471
472
  const templateDir = join(getTemplatesDir(), template.path);
472
473
  const files = await globby("**/*", {
473
474
  cwd: templateDir,
@@ -476,8 +477,13 @@ async function renderTemplate(template, destPath, data) {
476
477
  });
477
478
  for (const file of files) {
478
479
  const srcPath = join(templateDir, file);
479
- if (file.endsWith(".ejs")) await writeFile$1(join(destPath, file.replace(".ejs", "")), await ejs.renderFile(srcPath, data));
480
- else await copyFile$1(srcPath, join(destPath, file));
480
+ try {
481
+ if (file.endsWith(".ejs")) await writeFile$1(join(destPath, file.replace(/\.ejs$/, "")), await ejs.renderFile(srcPath, data));
482
+ else await copyFile$1(srcPath, join(destPath, file));
483
+ } catch (error) {
484
+ const message = error instanceof Error ? error.message : String(error);
485
+ throw new Error(`Failed to process template file "${file}": ${message}`);
486
+ }
481
487
  }
482
488
  }
483
489
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.1-pr.16.514b62d",
3
+ "version": "0.0.1-pr.16.6c1f17f",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",