fix(create-medusa-app): fix seed step to use seed script in package.json (#7397)
Fix the seed step to use the `seed` script defined in `package.json` to avoid issues if the file is renamed or path is changed
This commit is contained in:
1 parent
6ab7cbd529
commit
24a2ab754a
1 file changed
+8
-21
@@ -226,30 +226,17 @@ export default async ({
|
|||||||
title: "Seeding database...",
|
title: "Seeding database...",
|
||||||
})
|
})
|
||||||
|
|
||||||
const seedScriptPath = path.join("dist", "helpers", "seed.js")
|
|
||||||
|
|
||||||
// check if a seed file exists in the project
|
|
||||||
if (!fs.existsSync(path.join(directory, seedScriptPath))) {
|
|
||||||
spinner
|
|
||||||
?.warn(
|
|
||||||
chalk.yellow(
|
|
||||||
"Seed file was not found in the project. Skipping seeding..."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.start()
|
|
||||||
return inviteToken
|
|
||||||
}
|
|
||||||
|
|
||||||
await processManager.runProcess({
|
await processManager.runProcess({
|
||||||
process: async () => {
|
process: async () => {
|
||||||
await execute(
|
try {
|
||||||
[
|
await execute([`yarn seed`, execOptions], { verbose })
|
||||||
`npx medusa exec ${seedScriptPath}`,
|
} catch (e) {
|
||||||
npxOptions,
|
// yarn isn't available
|
||||||
],
|
// use npm
|
||||||
{ verbose }
|
await execute([`npm run seed`, execOptions], { verbose })
|
||||||
)
|
}
|
||||||
},
|
},
|
||||||
|
ignoreERESOLVE: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
displayFactBox({
|
displayFactBox({
|
||||||
|
|||||||
Reference in new issue
Block a user