Skip to content

Commit

Permalink
Merge branch 'main' of github.com:prisma/prisma into integration/fix/…
Browse files Browse the repository at this point in the history
…client/oom-default-selection
  • Loading branch information
millsp committed Jul 11, 2023
2 parents 304d3a4 + 3df162d commit 693e410
Show file tree
Hide file tree
Showing 73 changed files with 88,525 additions and 340 deletions.
5 changes: 4 additions & 1 deletion .buildkite/publish/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
app:
image: node:14-buster
image: node:16-buster
volumes:
- ../../:/app
working_dir: /app
Expand Down Expand Up @@ -68,6 +68,9 @@ services:
- PRISMA_HIDE_UPDATE_MESSAGE="true"
- SKIP_ECOSYSTEMTESTS_CHECK
- SLACK_RELEASE_FEED_WEBHOOK
# TODO find why we need NODE_OPTIONS for Buildkite (we need it since Node v16)
# This is to avoid OOM errors like "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory"
- NODE_OPTIONS="--max-old-space-size=8096"
depends_on:
- postgres
- postgres_isolated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
app:
image: node:14-buster
image: node:16-buster
volumes:
- ../../:/app
working_dir: /app
Expand Down Expand Up @@ -57,6 +57,9 @@ services:
# To hide "Update available 0.0.0 -> x.x.x"
- PRISMA_HIDE_UPDATE_MESSAGE="true"
- SKIP_ECOSYSTEMTESTS_CHECK
# TODO find why we need NODE_OPTIONS for Buildkite (we need it since Node v16)
# This is to avoid OOM errors like "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory"
- NODE_OPTIONS="--max-old-space-size=8096"
depends_on:
- postgres
- postgres_isolated
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/test/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
steps:
- label: ':coverage: Test %n - Node 14 (Search for `BUILDKITE_PARALLEL_JOB` in test output for definition what is being tested)'
- label: ':coverage: Test %n - Node 16 (Search for `BUILDKITE_PARALLEL_JOB` in test output for definition what is being tested)'
parallelism: 2
timeout_in_minutes: 35
plugins:
- docker-compose#v3.9.0:
config: .buildkite/test/docker-compose.14.yml
config: .buildkite/test/docker-compose.yml
run: app

- wait
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/typescript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 14, 16, 18
# [Choice] Node.js version: 16, 18, 20
ARG VARIANT="16-buster"
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

Expand Down
9 changes: 1 addition & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 14, 16, 18
// Update 'VARIANT' to pick a Node version: 16, 18, 20
"args": {
"VARIANT": "16"
}
},

// Set *default* container specific settings.json values on container create.
"settings": {
"telemetry.enableTelemetry": false,
"redhat.telemetry.enabled": false,
"vulnCost.sendStatistics": false,

"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"editor.formatOnSave": true,

"files.insertFinalNewline": true
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
// "dbaeumer.vscode-eslint",
Expand All @@ -31,13 +27,10 @@
"Orta.vscode-jest",
"GitHub.vscode-pull-request-github"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pnpm install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
14 changes: 7 additions & 7 deletions .github/workflows/test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
matrix:
shard: ['1/5', '2/5', '3/5', '4/5', '5/5']
queryEngine: ${{ fromJson(inputs.queryEngine) }}
node: [16, 18]
node: [18, 20]

env:
CI: true
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
fail-fast: false
matrix:
shard: ['1/6', '2/6', '3/6', '4/6', '5/6', '6/6']
node: [14, 16, 18]
node: [16, 18, 20]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -246,7 +246,7 @@ jobs:
SKIP_GIT: true
GITHUB_CONTEXT: ${{ toJson(github) }}

- run: pnpm run test:functional --silent --data-proxy --shard ${{ matrix.shard }}
- run: pnpm run test:functional --data-proxy --shard ${{ matrix.shard }}
working-directory: packages/client
env:
CI: true
Expand All @@ -262,7 +262,7 @@ jobs:
JEST_JUNIT_SUITE_NAME: '${{ github.job }}/client/functional/${{ matrix.os }}/node-${{ matrix.node }}/dataproxy'
JEST_JUNIT_UNIQUE_OUTPUT_NAME: true

- run: pnpm run test:functional --silent --data-proxy --edge-client --shard ${{ matrix.shard }}
- run: pnpm run test:functional --data-proxy --edge-client --shard ${{ matrix.shard }}
working-directory: packages/client
env:
CI: true
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
fail-fast: false
matrix:
queryEngine: ['library'] # TODO: binary engine is leaking at the moment
node: [14, 16, 18]
node: [16, 18, 20]
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -1026,7 +1026,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
node: [14]
node: [16]
queryEngine: ${{ fromJson(inputs.queryEngine) }}
shard: ['1/2', '2/2']

Expand Down Expand Up @@ -1124,7 +1124,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
node: [14]
node: [16]
queryEngine: ${{ fromJson(inputs.queryEngine) }}

steps:
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Welcome to the monorepo for our TypeScript code for the Prisma ORM. (for the Eng

## General Prerequisites

1. Install Node.js `>=14` minimum, [latest LTS is recommended](https://nodejs.org/en/about/releases/)
1. Install Node.js `>=16.13` minimum, [latest LTS is recommended](https://nodejs.org/en/about/releases/)

- Recommended: use [`nvm`](https://github.com/nvm-sh/nvm) for managing Node.js versions

Expand All @@ -26,8 +26,8 @@ https://github.com/direnv/direnv/blob/master/docs/installation.md
Copy paste these commands to install the global dependencies:

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install 16
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install 18
npm install --global pnpm@7 ts-node
# For direnv see https://github.com/direnv/direnv/blob/master/docs/installation.md
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"triggerEmptyDevReleaseByIncrementingThisNumber": 0,
"license": "Apache-2.0",
"engines": {
"node": ">=14.17",
"node": ">=16.13",
"pnpm": ">=7.3.0 <8"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"bugs": "https://github.com/prisma/prisma/issues",
"license": "Apache-2.0",
"engines": {
"node": ">=14.17"
"node": ">=16.13"
},
"prisma": {
"prismaCommit": "placeholder-for-commit-hash-replaced-during-publishing-in-publish-ts"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/scripts/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export function main() {
// `.slice(1)` removes `v` from `v16`
const nodeMajorVersion = parseInt(nodeVersions[0].slice(1))
const nodeMinorVersion = parseInt(nodeVersions[1])
if (nodeMajorVersion < 14 || (nodeMajorVersion === 14 && nodeMinorVersion < 17)) {
if (nodeMajorVersion < 16 || nodeMajorVersion === 16 && nodeMinorVersion < 13) {
console.error(
drawBox({
str: `Prisma only supports Node.js >= 14.17`,
str: `Prisma only supports Node.js >= 16.13`,
verticalPadding: 1,
horizontalPadding: 3,
}),
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/Generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ ${highlightTS(`\
import { PrismaClient } from '${importPath}/${isDeno ? 'deno/' : ''}edge${isDeno ? '.ts' : ''}'`)}
${dim('```')}
You will need a Prisma Data Proxy connection string. See documentation: ${link('https://pris.ly/d/data-proxy')}
You will need an Accelerate or a Prisma Data Proxy connection string. See documentation: ${link(
'https://pris.ly/d/data-proxy',
)}
`
: ''
}${breakingChangesStr}${versionsWarning}`
Expand Down
3 changes: 1 addition & 2 deletions packages/client/helpers/functional-test/run-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const args = arg(
async function main(): Promise<number | void> {
let jestCli = new JestCli(['--config', 'tests/functional/jest.config.js'])
let miniProxyProcess: ExecaChildProcess | undefined
const jestArgs = ['--testPathIgnorePatterns', 'typescript']

if (args['--provider']) {
const providers = args['--provider'] as Providers[]
Expand Down Expand Up @@ -106,8 +107,6 @@ async function main(): Promise<number | void> {
throw new Error('--edge-client is only available when --data-proxy is used')
}

const jestArgs = ['--testPathIgnorePatterns', 'typescript']

// See flag description above.
// If the flag is not provided we want to ignore `relationMode` tests
if (args['--relation-mode-tests-only']) {
Expand Down
4 changes: 4 additions & 0 deletions packages/client/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ module.exports = {
'<rootDir>/tests/e2e',
'<rootDir>/src/__tests__/benchmarks/',
'<rootDir>/src/__tests__/types/.*/test.ts',
'<rootDir>/src/__tests__/types/.*/test.binary.ts',
'<rootDir>/src/__tests__/types/.*/test.library.ts',
'<rootDir>/src/__tests__/integration/happy/exhaustive-schema/common.ts',
'<rootDir>/src/__tests__/integration/happy/exhaustive-schema/generated-dmmf.ts',
'<rootDir>/src/__tests__/generation/__fixture__',
'<rootDir>/src/__tests__/integration/happy/exhaustive-schema-mongo/common.ts',
'<rootDir>/src/__tests__/integration/happy/exhaustive-schema-mongo/generated-dmmf.ts',
'__helpers__/',
'node_modules/',
Expand Down
6 changes: 3 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"types": "index.d.ts",
"license": "Apache-2.0",
"engines": {
"node": ">=14.17"
"node": ">=16.13"
},
"homepage": "https://www.prisma.io",
"repository": {
Expand Down Expand Up @@ -84,7 +84,7 @@
"@prisma/instrumentation": "workspace:*",
"@prisma/internals": "workspace:*",
"@prisma/migrate": "workspace:*",
"@prisma/mini-proxy": "0.9.0",
"@prisma/mini-proxy": "0.9.3",
"@swc-node/register": "1.6.5",
"@swc/core": "1.3.64",
"@swc/jest": "0.2.26",
Expand Down Expand Up @@ -153,7 +153,7 @@
}
},
"dependencies": {
"@prisma/engines-version": "4.17.0-24.e992c91512a236fad14c1961a7e0cb10f43f6f5c"
"@prisma/engines-version": "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584"
},
"sideEffects": false
}
4 changes: 3 additions & 1 deletion packages/client/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ async function createDefaultGeneratedThrowFiles() {
await makeDir(dotPrismaClientDir)
await makeDir(defaultDenoClientDir)

if (!fs.existsSync(defaultNodeIndexPath)) {
// `default-index.js` may not exist in scripts yet when the postinstall script is running
// in Prisma repo itself. It will always exist in the published package.
if (!fs.existsSync(defaultNodeIndexPath) && fs.existsSync(path.join(__dirname, 'default-index.js'))) {
await fs.promises.copyFile(path.join(__dirname, 'default-index.js'), defaultNodeIndexPath)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ suite
.add('client generation ~50 Models', {
defer: true,
fn: function (deferred) {
generateTestClient(__dirname)
generateTestClient({ projectDir: __dirname })
.then(() => {
deferred.resolve()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ suite
.add('client generation 100 models with relations', {
defer: true,
fn: function (deferred) {
generateTestClient(__dirname)
generateTestClient({ projectDir: __dirname })
.then(() => {
deferred.resolve()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function buildTests() {
process.env[envVar] = value

// Generate Client to tmp dir
await generateTestClient(projectDir)
await generateTestClient({ projectDir })

// Run Tests
const { PrismaClient } = require(path.join(projectDir, 'node_modules/@prisma/client'))
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
generated-dmmf.ts
test-clients/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`exhaustive-schema: generatedBrowserJS 1`] = `
exports[`exhaustive-schema-mongo (binary): generatedBrowserJS 1`] = `

Object.defineProperty(exports, "__esModule", { value: true });

Expand Down Expand Up @@ -326,13 +326,13 @@ Object.assign(exports, Prisma)

`;

exports[`exhaustive-schema: generatedTypeScript 1`] = `
exports[`exhaustive-schema-mongo (binary): generatedTypeScript 1`] = `

/**
* Client
**/

import * as runtime from '@prisma/client/runtime/{RUNTIME_FILE}';
import * as runtime from '@prisma/client/runtime/binary';
import $Types = runtime.Types // general types
import $Public = runtime.Types.Public
import $Utils = runtime.Types.Utils
Expand Down

0 comments on commit 693e410

Please sign in to comment.