Skip to content

Commit

Permalink
fix: start-database.sh CONTAINER_NAME update with '.' project name (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xelacast committed May 7, 2024
1 parent 9d38a19 commit f29a69f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/selfish-geese-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": patch
---

Fixed project creation of . bug in ./start-database.sh
10 changes: 9 additions & 1 deletion cli/src/installers/dbContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from "path";

import { PKG_ROOT } from "~/consts.js";
import { type Installer } from "~/installers/index.js";
import { parseNameAndPath } from "~/utils/parseNameAndPath.js";

export const dbContainerInstaller: Installer = ({
projectDir,
Expand All @@ -15,6 +16,13 @@ export const dbContainerInstaller: Installer = ({
);
const scriptText = fs.readFileSync(scriptSrc, "utf-8");
const scriptDest = path.join(projectDir, "start-database.sh");
fs.writeFileSync(scriptDest, scriptText.replaceAll("project1", projectName));
// for configuration with postgresql and mysql when project is created with '.' project name
const [projectNameParsed] =
projectName == "." ? parseNameAndPath(projectDir) : [projectName];

fs.writeFileSync(
scriptDest,
scriptText.replaceAll("project1", projectNameParsed)
);
fs.chmodSync(scriptDest, "755");
};

0 comments on commit f29a69f

Please sign in to comment.