Skip to content

Commit

Permalink
chore(deps): Revert update dependency @prisma/studio-server to v0.426…
Browse files Browse the repository at this point in the history
….0 (#9357)

This reverts commit d75d71e.
  • Loading branch information
Jolg42 committed Sep 21, 2021
1 parent fd104cf commit 66e6e36
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm exec ts-node scripts/lint.ts --staged
ts-node scripts/lint.ts --staged
24 changes: 3 additions & 21 deletions packages/cli/helpers/build.js
Expand Up @@ -13,24 +13,7 @@ const ESBUILD_DEFAULT = {
platform: 'node',
target: 'es2018',
bundle: true,
tsconfig: 'tsconfig.build.json',
}

const prismaSDKResolvePlugin = {
name: 'PrismaSDKResolvePlugin',
setup(build) {
/**
* We need this because:
* 1. The SDK is a `peerDependency` of Studio, which means the CLI is supposed to make it available. In order for ESBuild to resolve it correctly, the SDK must be a dependency of the CLI.
* 2. But we want to bundle everything into one file for the CLI. So the SDK is not a dependency of the CLI, but rather a `devDependency`.
* 3. Moreover, the SDK's version in the CLI's package.json is `workspace:*`, so ESBuild cannot resolve it anyway without PNPM's help.
*
* So, we override ESBuild's resolution logic for the SDK in this plugin. We manually resolve the SDK's location at build time.
*/
build.onResolve({ filter: /^@prisma\/sdk$/ }, (args) => {
return { path: require.resolve('@prisma/sdk') }
})
},
tsconfig: 'tsconfig.build.json'
}

async function main() {
Expand All @@ -46,7 +29,6 @@ async function main() {
entryPoints: ['src/bin.ts'],
outfile: 'build/index.js',
external: ['@prisma/engines', '_http_common'],
plugins: [prismaSDKResolvePlugin],
}),
esbuild.build({
...ESBUILD_DEFAULT,
Expand All @@ -61,8 +43,8 @@ async function main() {
}),
copy({
from: path.join(
require.resolve('@prisma/studio/package.json'),
'../dist',
require.resolve('@prisma/studio-server/package.json'),
'../public',
),
to: './build/public',
recursive: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Expand Up @@ -68,7 +68,7 @@
"@prisma/get-platform": "3.1.0-24.c22652b7e418506fab23052d569b85d3aec4883f",
"@prisma/migrate": "workspace:*",
"@prisma/sdk": "workspace:*",
"@prisma/studio-server": "0.428.0",
"@prisma/studio-server": "0.423.0",
"@timsuchanek/copy": "1.4.5",
"@types/jest": "27.0.1",
"@types/rimraf": "3.0.2",
Expand Down Expand Up @@ -132,4 +132,4 @@
"prettier --write"
]
}
}
}
4 changes: 2 additions & 2 deletions packages/cli/src/Studio.ts
Expand Up @@ -7,7 +7,7 @@ import {
HelpError,
isError,
} from '@prisma/sdk'
import { StudioServer } from '@prisma/studio-server'
import StudioServer from '@prisma/studio-server'
import chalk from 'chalk'
import getPort from 'get-port'
import open from 'open'
Expand Down Expand Up @@ -126,7 +126,7 @@ ${chalk.bold('Examples')}
},
},
versions: {
prisma: packageJson.version,
prisma2: packageJson.version,
queryEngine: enginesVersion,
},
})
Expand Down

0 comments on commit 66e6e36

Please sign in to comment.