Skip to content

Commit

Permalink
Merge branch 'canary' into updating-versions-examples/with-react-nati…
Browse files Browse the repository at this point in the history
…ve-web
  • Loading branch information
orYoffe committed Oct 18, 2020
2 parents 4224076 + 753bb9f commit 985589b
Show file tree
Hide file tree
Showing 93 changed files with 2,581 additions and 233 deletions.
15 changes: 15 additions & 0 deletions errors/install-sharp.md
@@ -0,0 +1,15 @@
# Install `sharp` to Use Built-In Image Optimization

#### Why This Error Occurred

Using Next.js' built-in Image Optimization requires that you bring your own version of `sharp`.

#### Possible Ways to Fix It

Please install the `sharp` package in your project.

```bash
npm i sharp
# or
yarn add sharp
```
2 changes: 1 addition & 1 deletion examples/with-expo-typescript/next.config.js
@@ -1,5 +1,5 @@
// @generated: @expo/next-adapter@2.1.9
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/guides/using-nextjs.md#withexpo
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/guides/using-nextjs.md

const { withExpo } = require('@expo/next-adapter')

Expand Down
2 changes: 1 addition & 1 deletion examples/with-expo/next.config.js
@@ -1,5 +1,5 @@
// @generated: @expo/next-adapter@2.1.5
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/guides/using-nextjs.md#withexpo
// Learn more: https://github.com/expo/expo/blob/master/docs/pages/guides/using-nextjs.md

const { withExpo } = require('@expo/next-adapter')

Expand Down
50 changes: 29 additions & 21 deletions examples/with-mongodb/util/mongodb.js
@@ -1,37 +1,45 @@
import { MongoClient } from 'mongodb'

let uri = process.env.MONGODB_URI
let dbName = process.env.MONGODB_DB
const { MONGODB_URI, MONGODB_DB } = process.env

let cachedClient = null
let cachedDb = null

if (!uri) {
if (!MONGODB_URI) {
throw new Error(
'Please define the MONGODB_URI environment variable inside .env.local'
)
}

if (!dbName) {
if (!MONGODB_DB) {
throw new Error(
'Please define the MONGODB_DB environment variable inside .env.local'
)
}

/**
* Global is used here to maintain a cached connection across hot reloads
* in development. This prevents connections growing exponentiatlly
* during API Route usage.
*/
let cached = global.mongo
if (!cached) cached = global.mongo = {}

export async function connectToDatabase() {
if (cachedClient && cachedDb) {
return { client: cachedClient, db: cachedDb }
if (cached.conn) return cached.conn
if (!cached.promise) {
const conn = {}
const opts = {
useNewUrlParser: true,
useUnifiedTopology: true,
}
cached.promise = MongoClient.connect(MONGODB_URI, opts)
.then((client) => {
conn.client = client
return client.db(MONGODB_DB)
})
.then((db) => {
conn.db = db
cached.conn = conn
})
}

const client = await MongoClient.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true,
})

const db = await client.db(dbName)

cachedClient = client
cachedDb = db

return { client, db }
await cached.promise
return cached.conn
}
6 changes: 4 additions & 2 deletions examples/with-prisma/README.md
@@ -1,5 +1,7 @@
Prisma.io maintains it's own Next.Js examples

- [Javascript](https://github.com/prisma/prisma-examples/tree/master/javascript/rest-nextjs)
- [Typescript](https://github.com/prisma/prisma-examples/tree/master/typescript/rest-nextjs)
- [Typescript-GraphQL](https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-nextjs)
- [Typescript: rest-api-routes-auth](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes-auth)
- [Typescript: rest-api-routes](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes)
- [Typescript: rest-api-express](https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-express)
- [Typescript: graphql](https://github.com/prisma/prisma-examples/tree/latest/typescript/graphql-nextjs)
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.5.5"
"version": "9.5.6-canary.4"
}
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -82,6 +82,7 @@
"get-port": "5.1.1",
"glob": "7.1.6",
"gzip-size": "5.1.1",
"is-animated": "2.0.0",
"isomorphic-unfetch": "3.0.0",
"jest-circus": "26.0.1",
"jest-cli": "24.9.0",
Expand All @@ -98,6 +99,7 @@
"npm-run-all": "4.1.5",
"nprogress": "0.2.0",
"pixrem": "5.0.0",
"pnpm": "5.8.0",
"postcss-nested": "4.2.1",
"postcss-pseudoelements": "5.0.0",
"postcss-short-size": "4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "9.5.5",
"version": "9.5.6-canary.4",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down

0 comments on commit 985589b

Please sign in to comment.