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:
@@ -7,7 +7,7 @@
|
|||||||
"bin": "dist/index.js",
|
"bin": "dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node --esm src/index.ts",
|
"dev": "node --loader ts-node/esm src/index.ts",
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"watch": "tsc --watch",
|
"watch": "tsc --watch",
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
"boxen": "^5",
|
"boxen": "^5",
|
||||||
"chalk": "^5.2.0",
|
"chalk": "^5.2.0",
|
||||||
"commander": "^10.0.1",
|
"commander": "^10.0.1",
|
||||||
"glob": "^7.1.6",
|
|
||||||
"inquirer": "^9.2.2",
|
"inquirer": "^9.2.2",
|
||||||
"medusa-telemetry": "^0.0.17",
|
"medusa-telemetry": "^0.0.17",
|
||||||
"nanoid": "^4.0.2",
|
"nanoid": "^4.0.2",
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ const slugify = slugifyType.default
|
|||||||
export type CreateOptions = {
|
export type CreateOptions = {
|
||||||
repoUrl?: string
|
repoUrl?: string
|
||||||
seed?: boolean
|
seed?: boolean
|
||||||
boilerplate?: boolean
|
|
||||||
skipDb?: boolean
|
skipDb?: boolean
|
||||||
dbUrl?: string
|
dbUrl?: string
|
||||||
browser?: boolean
|
browser?: boolean
|
||||||
@@ -46,7 +45,6 @@ export type CreateOptions = {
|
|||||||
export default async ({
|
export default async ({
|
||||||
repoUrl = "",
|
repoUrl = "",
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
|
||||||
skipDb,
|
skipDb,
|
||||||
dbUrl,
|
dbUrl,
|
||||||
browser,
|
browser,
|
||||||
@@ -108,7 +106,6 @@ export default async ({
|
|||||||
track("CMA_OPTIONS", {
|
track("CMA_OPTIONS", {
|
||||||
repoUrl,
|
repoUrl,
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
|
||||||
skipDb,
|
skipDb,
|
||||||
browser,
|
browser,
|
||||||
migrations,
|
migrations,
|
||||||
@@ -176,7 +173,6 @@ export default async ({
|
|||||||
directory: projectPath,
|
directory: projectPath,
|
||||||
dbConnectionString,
|
dbConnectionString,
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
|
||||||
spinner,
|
spinner,
|
||||||
processManager,
|
processManager,
|
||||||
abortController,
|
abortController,
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ program
|
|||||||
.description("Create a new Medusa project")
|
.description("Create a new Medusa project")
|
||||||
.option("--repo-url <url>", "URL of repository to use to setup project.")
|
.option("--repo-url <url>", "URL of repository to use to setup project.")
|
||||||
.option("--seed", "Seed the created database with demo data.")
|
.option("--seed", "Seed the created database with demo data.")
|
||||||
.option(
|
|
||||||
"--no-boilerplate",
|
|
||||||
"Install a Medusa project without the boilerplate and demo files."
|
|
||||||
)
|
|
||||||
.option(
|
.option(
|
||||||
"--skip-db",
|
"--skip-db",
|
||||||
"Skips creating the database, running migrations, and seeding, and subsequently skips opening the browser.",
|
"Skips creating the database, running migrations, and seeding, and subsequently skips opening the browser.",
|
||||||
|
|||||||
@@ -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")
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import execute from "./execute.js"
|
|||||||
import { EOL } from "os"
|
import { EOL } from "os"
|
||||||
import { displayFactBox, FactBoxOptions } from "./facts.js"
|
import { displayFactBox, FactBoxOptions } from "./facts.js"
|
||||||
import ProcessManager from "./process-manager.js"
|
import ProcessManager from "./process-manager.js"
|
||||||
import { clearProject } from "./clear-project.js"
|
|
||||||
import type { Client } from "pg"
|
import type { Client } from "pg"
|
||||||
|
|
||||||
const ADMIN_EMAIL = "admin@medusa-test.com"
|
const ADMIN_EMAIL = "admin@medusa-test.com"
|
||||||
@@ -18,7 +17,6 @@ type PrepareOptions = {
|
|||||||
directory: string
|
directory: string
|
||||||
dbConnectionString: string
|
dbConnectionString: string
|
||||||
seed?: boolean
|
seed?: boolean
|
||||||
boilerplate?: boolean
|
|
||||||
spinner: Ora
|
spinner: Ora
|
||||||
processManager: ProcessManager
|
processManager: ProcessManager
|
||||||
abortController?: AbortController
|
abortController?: AbortController
|
||||||
@@ -34,7 +32,6 @@ export default async ({
|
|||||||
directory,
|
directory,
|
||||||
dbConnectionString,
|
dbConnectionString,
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
|
||||||
spinner,
|
spinner,
|
||||||
processManager,
|
processManager,
|
||||||
abortController,
|
abortController,
|
||||||
@@ -111,19 +108,6 @@ export default async ({
|
|||||||
message: "Installed Dependencies",
|
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.interval = displayFactBox({
|
||||||
...factBoxOptions,
|
...factBoxOptions,
|
||||||
title: "Building Project...",
|
title: "Building Project...",
|
||||||
|
|||||||
@@ -72,23 +72,6 @@ npx create-medusa-app@latest
|
|||||||
|
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`--no-boilerplate`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
Whether to remove all files added for an enhanced onboarding experience (files under `src/admin`, `src/api`, etc...). Useful if you want to create a clean project, and is only recommended if you're familiar with Medusa.
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
<Table.Cell>
|
|
||||||
|
|
||||||
`false`
|
|
||||||
|
|
||||||
</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
|
|
||||||
|
|||||||
@@ -15409,7 +15409,6 @@ __metadata:
|
|||||||
eslint-config-google: ^0.14.0
|
eslint-config-google: ^0.14.0
|
||||||
eslint-config-prettier: ^8.8.0
|
eslint-config-prettier: ^8.8.0
|
||||||
eslint-plugin-prettier: ^4.2.1
|
eslint-plugin-prettier: ^4.2.1
|
||||||
glob: ^7.1.6
|
|
||||||
inquirer: ^9.2.2
|
inquirer: ^9.2.2
|
||||||
medusa-telemetry: ^0.0.17
|
medusa-telemetry: ^0.0.17
|
||||||
nanoid: ^4.0.2
|
nanoid: ^4.0.2
|
||||||
|
|||||||
Reference in New Issue
Block a user