feat(create-medusa-app,medusa-cli): Allow clearing project (#4273)

- Added build step
- Added `--no-boilerplate` option to `create-medusa-app` to allow clearing onboarding files
- Clear project files by default in medusa-cli
This commit is contained in:
Shahed Nasser
2023-06-15 17:31:30 +00:00
committed by GitHub
parent f8643361cd
commit f98ba5bde8
18 changed files with 582 additions and 87 deletions
+20
View File
@@ -0,0 +1,20 @@
import fs from "fs"
import path from "path"
import { globSync } from "glob"
export function clearProject (directory: string) {
const files = globSync([
path.join(directory, `src`, `admin/**/*`),
path.join(directory, `src`, `**/onboarding/`),
path.join(directory, `src`, `types`),
path.join(directory, `src`, `**/*.{ts,tsx,js,jsx}`),
])
files.forEach((file) =>
fs.rmSync(file, {
recursive: true,
force: true,
})
)
// add empty typescript file to avoid build errors
fs.openSync(path.join(directory, "src", "index.ts"), "w")
}
+1
View File
@@ -0,0 +1 @@
export * from "./clear-project"
+2 -1
View File
@@ -1,5 +1,6 @@
export * from "./bundles"
export * from "./cli"
export * from "./common"
export * from "./decorators"
export * from "./event-bus"
export * from "./search"
export * from "./search"