@prisma/cli 3.0.0-alpha.11 → 3.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ async function executePreviewBuild(options) {
46
46
  });
47
47
  const artifact = await strategy.execute();
48
48
  try {
49
- if (buildType === "nextjs") await restageNextjsArtifact(artifact.directory, options.appPath);
49
+ if (buildType === "nextjs") await restageNextjsArtifact(artifact, options.appPath);
50
50
  await normalizeArtifactSymlinks(artifact.directory, options.appPath);
51
51
  return {
52
52
  artifact,
@@ -116,7 +116,8 @@ async function stageNextjsStandaloneArtifact(options) {
116
116
  });
117
117
  await hoistPnpmDependencies(path.join(artifactRoot, "node_modules"));
118
118
  }
119
- async function restageNextjsArtifact(artifactDir, appPath) {
119
+ async function restageNextjsArtifact(artifact, appPath) {
120
+ const artifactDir = artifact.directory;
120
121
  const standaloneDir = path.join(appPath, ".next", "standalone");
121
122
  await rm(artifactDir, {
122
123
  recursive: true,
@@ -127,17 +128,23 @@ async function restageNextjsArtifact(artifactDir, appPath) {
127
128
  artifactDir,
128
129
  appPath
129
130
  });
131
+ const serverSubpath = nextjsServerSubpath(artifact.entrypoint);
132
+ const serverDir = serverSubpath ? path.join(artifactDir, serverSubpath) : artifactDir;
130
133
  const publicDir = path.join(appPath, "public");
131
- if (await directoryExists(publicDir)) await cp(publicDir, path.join(artifactDir, "public"), {
134
+ if (await directoryExists(publicDir)) await cp(publicDir, path.join(serverDir, "public"), {
132
135
  recursive: true,
133
136
  verbatimSymlinks: true
134
137
  });
135
138
  const staticDir = path.join(appPath, ".next", "static");
136
- if (await directoryExists(staticDir)) await cp(staticDir, path.join(artifactDir, ".next", "static"), {
139
+ if (await directoryExists(staticDir)) await cp(staticDir, path.join(serverDir, ".next", "static"), {
137
140
  recursive: true,
138
141
  verbatimSymlinks: true
139
142
  });
140
143
  }
144
+ function nextjsServerSubpath(entrypoint) {
145
+ const dir = path.posix.dirname(entrypoint);
146
+ return dir === "." ? "" : dir;
147
+ }
141
148
  async function hoistPnpmDependencies(nodeModulesDir) {
142
149
  const pnpmNodeModulesDir = path.join(nodeModulesDir, ".pnpm", "node_modules");
143
150
  if (!await directoryExists(pnpmNodeModulesDir)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "3.0.0-alpha.11",
3
+ "version": "3.0.0-alpha.13",
4
4
  "description": "Preview of the unified Prisma CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,7 +36,7 @@
36
36
  "license": "Apache-2.0",
37
37
  "dependencies": {
38
38
  "@clack/prompts": "^1.2.0",
39
- "@prisma/compute-sdk": "^0.18.0",
39
+ "@prisma/compute-sdk": "^0.19.0",
40
40
  "c12": "4.0.0-beta.4",
41
41
  "@prisma/credentials-store": "^7.7.0",
42
42
  "@prisma/management-api-sdk": "^1.32.1",