fix(create-medusa-app): remove glob-related warnings (#7985)

On every new installation of `create-medusa-app`, you get a warning related to `glob`'s version.

Since we don't need `glob` anymore (it was used to remove boilerplate files), I've removed it along with its usage. This includes removing the `--no-boilerplate` option.
This commit is contained in:
Shahed Nasser
2024-07-08 11:24:10 +03:00
committed by GitHub
parent 4d750c13d9
commit d2c89e7071
7 changed files with 1 additions and 69 deletions

View File

@@ -7,7 +7,7 @@
"bin": "dist/index.js",
"license": "MIT",
"scripts": {
"dev": "ts-node --esm src/index.ts",
"dev": "node --loader ts-node/esm src/index.ts",
"start": "node dist/index.js",
"build": "tsc",
"watch": "tsc --watch",
@@ -17,7 +17,6 @@
"boxen": "^5",
"chalk": "^5.2.0",
"commander": "^10.0.1",
"glob": "^7.1.6",
"inquirer": "^9.2.2",
"medusa-telemetry": "^0.0.17",
"nanoid": "^4.0.2",

View File

@@ -33,7 +33,6 @@ const slugify = slugifyType.default
export type CreateOptions = {
repoUrl?: string
seed?: boolean
boilerplate?: boolean
skipDb?: boolean
dbUrl?: string
browser?: boolean
@@ -46,7 +45,6 @@ export type CreateOptions = {
export default async ({
repoUrl = "",
seed,
boilerplate,
skipDb,
dbUrl,
browser,
@@ -108,7 +106,6 @@ export default async ({
track("CMA_OPTIONS", {
repoUrl,
seed,
boilerplate,
skipDb,
browser,
migrations,
@@ -176,7 +173,6 @@ export default async ({
directory: projectPath,
dbConnectionString,
seed,
boilerplate,
spinner,
processManager,
abortController,

View File

@@ -6,10 +6,6 @@ program
.description("Create a new Medusa project")
.option("--repo-url <url>", "URL of repository to use to setup project.")
.option("--seed", "Seed the created database with demo data.")
.option(
"--no-boilerplate",
"Install a Medusa project without the boilerplate and demo files."
)
.option(
"--skip-db",
"Skips creating the database, running migrations, and seeding, and subsequently skips opening the browser.",

View File

@@ -1,25 +0,0 @@
import fs from "fs"
import glob from "glob"
import path from "path"
export function clearProject(directory: string) {
const adminFiles = glob.sync(path.join(directory, `src`, `admin/**/*`))
const onboardingFiles = glob.sync(
path.join(directory, `src`, `**/onboarding/`)
)
const typeFiles = glob.sync(path.join(directory, `src`, `types`))
const srcFiles = glob.sync(
path.join(directory, `src`, `**/*.{ts,tsx,js,jsx}`)
)
const files = [...adminFiles, ...onboardingFiles, ...typeFiles, ...srcFiles]
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")
}

View File

@@ -5,7 +5,6 @@ import execute from "./execute.js"
import { EOL } from "os"
import { displayFactBox, FactBoxOptions } from "./facts.js"
import ProcessManager from "./process-manager.js"
import { clearProject } from "./clear-project.js"
import type { Client } from "pg"
const ADMIN_EMAIL = "admin@medusa-test.com"
@@ -18,7 +17,6 @@ type PrepareOptions = {
directory: string
dbConnectionString: string
seed?: boolean
boilerplate?: boolean
spinner: Ora
processManager: ProcessManager
abortController?: AbortController
@@ -34,7 +32,6 @@ export default async ({
directory,
dbConnectionString,
seed,
boilerplate,
spinner,
processManager,
abortController,
@@ -111,19 +108,6 @@ export default async ({
message: "Installed Dependencies",
})
if (!boilerplate) {
factBoxOptions.interval = displayFactBox({
...factBoxOptions,
title: "Preparing Project Directory...",
})
// delete files and directories related to onboarding
clearProject(directory)
displayFactBox({
...factBoxOptions,
message: "Prepared Project Directory",
})
}
factBoxOptions.interval = displayFactBox({
...factBoxOptions,
title: "Building Project...",