Skip to content

Commit

Permalink
Merge branch 'canary' into examples/with-chakra-ui-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 21, 2020
2 parents 346270d + 111d2df commit eec0747
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: A custom asset prefix allows you serve static assets from a CDN. Le

# CDN Support with Asset Prefix

> **Attention**: [Deploying to Vercel](docs/deployment.md) automatically configures a global CDN for your Next.js project.
> **Attention**: [Deploying to Vercel](/docs/deployment.md) automatically configures a global CDN for your Next.js project.
> You do not need to manually setup an Asset Prefix.
> **Note**: Next.js 9.5+ added support for a customizable [Base Path](docs/api-reference/next.config.js/basepath.md), which is better
> **Note**: Next.js 9.5+ added support for a customizable [Base Path](/docs/api-reference/next.config.js/basepath.md), which is better
> suited for hosting your application on a sub-path like `/docs`.
> We do not suggest you use a custom Asset Prefix for this use case.
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/next.config.js/exportPathMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To switch back and add a trailing slash, open `next.config.js` and enable the `e

```js
module.exports = {
exportTrailingSlash: true,
trailingSlash: true,
}
```

Expand Down
2 changes: 2 additions & 0 deletions docs/basic-features/static-file-serving.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ This folder is also useful for `robots.txt`, Google Site Verification, and any o
> **Note**: Be sure to not have a static file with the same name as a file in the `pages/` directory, as this will result in an error.
>
> Read more: <http://err.sh/next.js/conflicting-public-file-page>
> **Note**: Only assets that are in the `public` directory at [build time](/docs/api-reference/cli.md#build) will be served by Next.js. Files added at runtime won't be available. We recommend using a third party service like [AWS S3](https://aws.amazon.com/s3/) for persistent file storage.
3 changes: 1 addition & 2 deletions errors/invalid-href-passed.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ When using any of these, it is expected they are only used for internal navigati

Either you passed a non-internal `href` to a `next/link` component or you called `Router#push` or `Router#replace` with one.

Invalid `href`s include external sites (https://google.com) and `mailto:` links. In the past, usage of these invalid `href`s could have gone unnoticed but since they can cause unexpected behavior.
We now show a warning in development for them.
Invalid `href`s include external sites (https://google.com) and `mailto:` links. In the past, usage of these invalid `href`s could have gone unnoticed, but since they can cause unexpected behavior we now show a warning in development for them.

#### Possible Ways to Fix It

Expand Down
5 changes: 4 additions & 1 deletion examples/with-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM mhart/alpine-node

WORKDIR /app

COPY . .

RUN yarn install
RUN yarn install --frozen-lockfile

RUN yarn build

EXPOSE 3000

CMD ["yarn", "start"]
26 changes: 19 additions & 7 deletions examples/with-docker/Dockerfile.multistage
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
# Do the npm install or yarn install in the full image
# Stage 1: Building the code
FROM mhart/alpine-node AS builder

WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn install --frozen-lockfile

COPY . .
RUN yarn --production

RUN yarn build
RUN yarn install --production --frozen-lockfile


# Stage 2: And then copy over node_modules, etc from that stage to the smaller base image
FROM mhart/alpine-node:base as production

# And then copy over node_modules, etc from that stage to the smaller base image
FROM mhart/alpine-node:base
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next

# COPY package.json next.config.js .env* ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules

EXPOSE 3000
CMD ["node_modules/.bin/next", "start"]

CMD ["node_modules/.bin/next", "start"]
2 changes: 1 addition & 1 deletion examples/with-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Build it with docker:
# build
docker build -t next-app .
# or, use multi-stage builds to build a smaller docker image
docker build -t next-app -f ./Dockerfile.multistage .
docker build --target production -t next-app -f ./Dockerfile.multistage .
```

Alternatively you can add these commands as scripts to your package.json and simply run
Expand Down
2 changes: 1 addition & 1 deletion examples/with-docker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "next build",
"start": "next start",
"build-docker": "docker build -t next-app .",
"build-docker-multistage": "docker build -t next-app -f ./Dockerfile.multistage .",
"build-docker-multistage": "docker build --target production -t next-app -f ./Dockerfile.multistage .",
"run-docker": "docker run --rm -it -p 3000:3000 next-app"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions examples/with-patternfly/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = withCSS(
publicPath: '/_next/static/fonts/',
outputPath: 'static/fonts/',
name: '[name].[ext]',
esModule: false,
},
},
})
Expand Down
14 changes: 7 additions & 7 deletions examples/with-patternfly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"start": "next start"
},
"dependencies": {
"@patternfly/react-core": "^3.112.3",
"@patternfly/react-core": "^4.50.2",
"next": "latest",
"next-transpile-modules": "^4.0.2",
"react": "^16.7.0",
"react-dom": "^16.7.0"
"next-transpile-modules": "^4.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"@zeit/next-css": "^1.0.1",
"file-loader": "^3.0.1",
"svg-url-loader": "^3.0.2",
"url-loader": "^1.1.2"
"file-loader": "^6.1.0",
"svg-url-loader": "^6.0.0",
"url-loader": "^4.1.0"
},
"license": "MIT"
}
8 changes: 6 additions & 2 deletions examples/with-react-intl/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@ const getInitialProps: typeof App.getInitialProps = async appContext => {

const [supportedLocale, messagePromise] = getMessages(requestedLocales);

const [appProps, messages] = await Promise.all([
const [, messages, appProps] = await Promise.all([
polyfill(supportedLocale),
messagePromise,
App.getInitialProps(appContext),
]);

return {...(appProps as any), locale: supportedLocale, messages};
return {
...(appProps as any),
locale: supportedLocale,
messages: messages.default,
};
};

MyApp.getInitialProps = getInitialProps;
Expand Down
2 changes: 2 additions & 0 deletions examples/with-rebass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
},
"dependencies": {
"babel-plugin-styled-components": "^1.1.7",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-set-prototype-of-to-assign": "^6.22.0",
"next": "latest",
"react": "^16.7.0",
"react-dom": "^16.7.0",
Expand Down
1 change: 0 additions & 1 deletion examples/with-typescript-eslint-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@types/jest": "^25.1.4",
"@types/node": "^13.9.5",
"@types/react": "^16.9.27",
"@types/testing-library__react": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"babel-jest": "^25.2.3",
Expand Down
15 changes: 11 additions & 4 deletions packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ module.exports = {
},

create: function (context) {
const [pagesDirectory] = context.options
const pagesDir = pagesDirectory || path.join(context.getCwd(), 'pages')
if (!fs.existsSync(pagesDir)) {
const [customPagesDirectory] = context.options
const pagesDirs = customPagesDirectory
? [customPagesDirectory]
: [
path.join(context.getCwd(), 'pages'),
path.join(context.getCwd(), 'src', 'pages'),
]
const pagesDir = pagesDirs.find((dir) => fs.existsSync(dir))
if (!pagesDir) {
throw new Error(
`Pages directory cannot be found at ${pagesDir}, if using a custom path, please configure with the no-html-link-for-pages rule`
`Pages directory cannot be found at ${pagesDirs.join(' or ')}. ` +
`If using a custom path, please configure with the no-html-link-for-pages rule`
)
}

Expand Down

0 comments on commit eec0747

Please sign in to comment.