Skip to content

Commit

Permalink
chore(sdk,engine-core): rename pinnedPlatform to pinnedBinaryTargets
Browse files Browse the repository at this point in the history
Related #2644
  • Loading branch information
Jolg42 committed Jun 4, 2020
1 parent 38200ab commit 3e0cfbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/packages/engine-core/src/NodeEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class NodeEngine {
platformPromise: Promise<Platform>
platform?: Platform | string
generator?: GeneratorConfig
incorrectlyPinnedPlatform?: string
incorrectlyPinnedBinaryTarget?: string
datasources?: DatasourceOverwrite[]
lastErrorLog?: RustLog
lastError?: RustError
Expand Down Expand Up @@ -240,7 +240,7 @@ You may have to run ${chalk.greenBright(

const platform = await this.getPlatform()
if (this.platform && this.platform !== platform) {
this.incorrectlyPinnedPlatform = this.platform
this.incorrectlyPinnedBinaryTarget = this.platform
}

this.platform = this.platform || platform
Expand Down Expand Up @@ -299,9 +299,9 @@ You may have to run ${chalk.greenBright(
const platform = await this.getPlatform()
// If path to query engine doesn't exist, throw
if (!(await exists(prismaPath))) {
const pinnedStr = this.incorrectlyPinnedPlatform
const pinnedStr = this.incorrectlyPinnedBinaryTarget
? `\nYou incorrectly pinned it to ${chalk.redBright.bold(
`${this.incorrectlyPinnedPlatform}`,
`${this.incorrectlyPinnedBinaryTarget}`,
)}\n`
: ''

Expand Down Expand Up @@ -361,11 +361,11 @@ Read more about deploying Prisma Client: https://pris.ly/d/client-generator`
throw new PrismaClientInitializationError(errorText)
}

if (this.incorrectlyPinnedPlatform) {
if (this.incorrectlyPinnedBinaryTarget) {
console.error(`${chalk.yellow(
'Warning:',
)} You pinned the platform ${chalk.bold(
this.incorrectlyPinnedPlatform,
this.incorrectlyPinnedBinaryTarget,
)}, but Prisma Client detects ${chalk.bold(await this.getPlatform())}.
This means you should very likely pin the platform ${chalk.greenBright(
await this.getPlatform(),
Expand Down
2 changes: 1 addition & 1 deletion src/packages/sdk/src/cli/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type GeneratorConfig = {
provider: string
config: Dictionary<string>
platforms: string[]
pinnedPlatform?: string | null
pinnedBinaryTargets?: string | null
}

export type GeneratorOptions = {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/sdk/src/getGenerators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ async function validateGenerators(
`The \`platforms\` field on the generator definition is deprecated. Please rename it to \`binaryTargets\`.`,
)
}
if (generator.config.pinnedPlatform) {
if (generator.config.pinnedBinaryTargets) {
throw new Error(
`The \`pinnedPlatform\` field on the generator definition is deprecated.
`The \`pinnedBinaryTargets\` field on the generator definition is deprecated.
Please use the PRISMA_QUERY_ENGINE_BINARY env var instead to pin the binary target.`,
)
}
Expand Down

0 comments on commit 3e0cfbc

Please sign in to comment.