Skip to content

Commit

Permalink
feat(create-medusa-app): remove .git directory in the project (#4493)
Browse files Browse the repository at this point in the history
* feat(create-medusa-app): remove .git directory in the project

* reverted version changes

* remove version from package.json
  • Loading branch information
shahednasser authored Jul 11, 2023
1 parent 09157f0 commit 4b4296d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilled-hairs-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-medusa-app": patch
---

feat(create-medusa-app): remove .git directory in the project
2 changes: 1 addition & 1 deletion docs/content/development/backend/prepare-environment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Node.js is the environment that makes it possible for Medusa to run, so you must

:::caution

Medusa supports v16 or greater of Node.js. You can check your Node.js version using the following command:
Medusa supports v16+ of Node.js. You can check your Node.js version using the following command:

```bash noReport
node -v
Expand Down
11 changes: 11 additions & 0 deletions packages/create-medusa-app/src/utils/clone-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import promiseExec from "./promise-exec.js"
import { Ora } from "ora"
import { isAbortError } from "./create-abort-controller.js"
import logMessage from "./log-message.js"
import fs from "fs"
import path from "path"

type CloneRepoOptions = {
directoryName?: string
Expand Down Expand Up @@ -39,6 +41,8 @@ export async function runCloneRepo({
repoUrl,
abortController,
})

deleteGitDirectory(projectName)
} catch (e) {
if (isAbortError(e)) {
process.exit()
Expand All @@ -51,3 +55,10 @@ export async function runCloneRepo({
})
}
}

function deleteGitDirectory(projectDirectory: string) {
fs.rmSync(path.join(projectDirectory, ".git"), {
recursive: true,
force: true,
})
}

1 comment on commit 4b4296d

@vercel
Copy link

@vercel vercel bot commented on 4b4296d Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.