From 6d96425c0b891f726c641bc00eba241c11703b8a Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Sat, 27 Jul 2024 16:33:36 -0700 Subject: [PATCH] ensures posix path separators are used in package.json --- packages/misc/redwood/src/commands/setup.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/misc/redwood/src/commands/setup.ts b/packages/misc/redwood/src/commands/setup.ts index 781d878e6..ec5979617 100644 --- a/packages/misc/redwood/src/commands/setup.ts +++ b/packages/misc/redwood/src/commands/setup.ts @@ -48,8 +48,8 @@ function bootstrapSchema() { const pkg = JSON.parse(content); if (!pkg.zenstack) { pkg.zenstack = { - schema: path.relative(apiPaths.base, zmodel), - prisma: path.relative(apiPaths.base, apiPaths.dbSchema), + schema: normalizePath(path.relative(apiPaths.base, zmodel)), + prisma: normalizePath(path.relative(apiPaths.base, apiPaths.dbSchema)), }; fs.writeFileSync(pkgJson, JSON.stringify(pkg, null, 4)); } @@ -58,6 +58,11 @@ function bootstrapSchema() { }; } +// ensures posix path separators are used in package.json +function normalizePath(_path: string) { + return _path.replaceAll(path.sep, path.posix.sep); +} + // install ZenStack GraphQLYoga plugin function installGraphQLPlugin() { return {