Skip to content

Commit

Permalink
Merge branch 'remove-mkdirp' of github.com:matamatanot/next.js into r…
Browse files Browse the repository at this point in the history
…emove-mkdirp
  • Loading branch information
matamatanot committed Oct 3, 2020
2 parents 8c5bab3 + 6c8c5e3 commit 008514e
Show file tree
Hide file tree
Showing 39 changed files with 139 additions and 54 deletions.
9 changes: 9 additions & 0 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path')
const fs = require('fs-extra')
const exec = require('./util/exec')
const logger = require('./util/logger')
const runConfigs = require('./run')
Expand Down Expand Up @@ -25,6 +27,13 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {

;(async () => {
try {
if (await fs.pathExists(path.join(process.cwd(), 'SKIP_NEXT_STATS.txt'))) {
console.log(
'SKIP_NEXT_STATS.txt file present, exiting stats generation..'
)
process.exit(0)
}

const { stdout: gitName } = await exec(
'git config user.name && git config user.email'
)
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,14 @@ jobs:
key: ${{ github.sha }}

- run: ./publish-release.sh

prStats:
name: Release Stats
runs-on: ubuntu-latest
needs: [publishRelease]
steps:
- uses: actions/checkout@v2
- run: ./release-stats.sh
- uses: ./.github/actions/next-stats-action
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
13 changes: 0 additions & 13 deletions .github/workflows/release_stats.yml

This file was deleted.

2 changes: 2 additions & 0 deletions docs/api-reference/next.config.js/exportPathMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ description: Customize the pages that will be exported as HTML files when using
</ul>
</details>

`exportPathMap` allows you to specify a mapping of request paths to page destinations, to be used during export.

Let's start with an example, to create a custom `exportPathMap` for an app with the following pages:

- `pages/index.js`
Expand Down
2 changes: 2 additions & 0 deletions docs/api-reference/next.config.js/rewrites.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Rewrites allow you to map an incoming request path to a different destination pa

Rewrites are only available on the Node.js environment and do not affect client-side routing.

Rewrites are not able to override public files or routes in the pages directory as these have higher priority than rewrites. For example, if you have `pages/index.js` you are not able to rewrite `/` to another location unless you rename the `pages/index.js` file.

To use rewrites you can use the `rewrites` key in `next.config.js`:

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-features/built-in-css-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ In production, all CSS files will be automatically concatenated into a single mi

### Import styles from `node_modules`

Importing a CSS file from `node_modules` is permitted in anywhere your application.
Since Next.js **9.5.4**, importing a CSS file from `node_modules` is permitted anywhere in your application.

For global stylesheets, like `bootstrap` or `nprogress`, you should import the file inside `pages/_app.js`.
For example:
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-features/static-file-serving.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function MyImage() {
export default MyImage
```

This folder is also useful for `robots.txt`, Google Site Verification, and any other static files (including `.html`)!
This folder is also useful for `robots.txt`, `favicon.ico`, Google Site Verification, and any other static files (including `.html`)!

> **Note**: Don't name the `public` directory anything else. The name cannot be changed and is the only directory used to serve static assets.
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-features/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You're now ready to start converting files from `.js` to `.tsx` and leveraging t

> A file named `next-env.d.ts` will be created in the root of your project. This file ensures Next.js types are picked up by the TypeScript compiler. **You cannot remove it**, however, you can edit it (but you don't need to).
> Next.js `strict` mode is turned off by default. When you feel comfortable with TypeScript, it's recommended to turn it on in your `tsconfig.json`.
> TypeScript `strict` mode is turned off by default. When you feel comfortable with TypeScript, it's recommended to turn it on in your `tsconfig.json`.
By default, Next.js will do type checking as part of `next build`. We recommend using code editor type checking during development.

Expand Down
2 changes: 1 addition & 1 deletion examples/amp-first/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Things you need to do after installing the boilerplate:
```

- **amp-list & amp-mustache:** mustache templates conflict with JSX and it's template literals need to be escaped. A simple approach is to escape them via back ticks: `` src={`{{imageUrl}}`} ``.
- **amp-script:** you can use [amp-script](https://amp.dev/documentation/components/amp-script/) to add custom JavaScript to your AMP pages. The boilerplate includes a helper [`components/amp/AmpScript.js`](components/amp/AmpScript.js) to simplify using amp-script. The helper also supports embedding inline scripts. Good to know: Next.js uses [AMP Optimizer](https://github.com/ampproject/amp-toolbox/tree/master/packages/optimizer) under the hood, which automatically adds the needed script hashes for [inline amp-scripts](https://amp.dev/documentation/components/amp-script/#load-javascript-from-a-local-element).
- **amp-script:** you can use [amp-script](https://amp.dev/documentation/components/amp-script/) to add custom JavaScript to your AMP pages. The boilerplate includes a helper [`components/amp/AmpScript.js`](components/amp/AmpScript.js) to simplify using `amp-script`. The helper also supports embedding inline scripts. Good to know: Next.js uses [AMP Optimizer](https://github.com/ampproject/amp-toolbox/tree/master/packages/optimizer) under the hood, which automatically adds the needed script hashes for [inline amp-scripts](https://amp.dev/documentation/components/amp-script/#load-javascript-from-a-local-element).

## Deployment

Expand Down
2 changes: 1 addition & 1 deletion examples/api-routes-rest/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# API routes with REST

Next.js ships with [API routes](https://github.com/vercel/next.js#api-routes), which provide an easy solution to build your own `API`. This example shows how it can be used to create your [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) api.
Next.js ships with [API routes](https://github.com/vercel/next.js#api-routes), which provide an easy solution to build your own `API`. This example shows how it can be used to create your [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) `API`.

## Deploy your own

Expand Down
6 changes: 3 additions & 3 deletions examples/blog-starter-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript.

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using markdown files as the data source.
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.

The blog posts are stored in `/_posts` as markdown files with front matter support. Adding a new markdown file in there will create a new blog post.
The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post.

To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.
To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the Markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.

## How to use

Expand Down
6 changes: 3 additions & 3 deletions examples/blog-starter/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# A statically generated blog example using Next.js and Markdown

This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using markdown files as the data source.
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.

The blog posts are stored in `/_posts` as markdown files with front matter support. Adding a new markdown file in there will create a new blog post.
The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post.

To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.
To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the Markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.

## Demo

Expand Down
6 changes: 3 additions & 3 deletions examples/environment-variables/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const IndexPage = () => (
<p>
In general only <Code>.env.local</Code> or <Code>.env</Code> are needed
for this, but the table also features the usage of{' '}
<Code>.env.develoment</Code> and <Code>.env.production</Code>.
<Code>.env.development</Code> and <Code>.env.production</Code>.
</p>
<table className={styles.table}>
<thead>
Expand Down Expand Up @@ -47,7 +47,7 @@ const IndexPage = () => (

<td>{process.env.NEXT_PUBLIC_DEVELOPMENT_ENV_VARIABLE}</td>
<td>
<Code>.env.develoment</Code>
<Code>.env.development</Code>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -75,7 +75,7 @@ const IndexPage = () => (
<code>npm run dev</code>
</pre>
<p>
Similarly, variables in <Code>.env.develoment</Code> won't be available
Similarly, variables in <Code>.env.development</Code> won't be available
if the app is running on production:
</p>
<pre>
Expand Down
3 changes: 2 additions & 1 deletion examples/with-google-analytics-amp/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Document, { Html, Main, NextScript } from 'next/document'
import Document, { Html, Head, Main, NextScript } from 'next/document'
import { useAmp } from 'next/amp'

import { GA_TRACKING_ID } from '../lib/gtag'
Expand All @@ -14,6 +14,7 @@ export default class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
Expand Down
4 changes: 3 additions & 1 deletion examples/with-mux-video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ This example uses Mux Video, an API-first platform for video. The example featur

## Demo

### [https://with-mux-video.now.sh/](https://with-mux-video.now.sh/)
### [https://with-mux-video.vercel.app/](https://with-mux-video.vercel.app/)

### This project was used to create [stream.new](https://stream.new/)

## Deploy your own

Expand Down
4 changes: 2 additions & 2 deletions examples/with-mux-video/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { MUX_HOME_PAGE_URL } from '../constants'
export default function Layout({
title,
description,
metaTitle,
metaTitle = 'Mux + Next.js',
metaDescription,
image,
image = 'https://with-mux-video.vercel.app/mux-nextjs-og-image.png',
children,
loadTwitterWidget,
}) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/with-tailwindcss/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@tailwind components;
/* Stop purging. */

/* Write you own custom component styles here */
/* Write your own custom component styles here */
.btn-blue {
@apply bg-blue-500 text-white font-bold py-2 px-4 rounded;
}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.5.4-canary.22"
"version": "9.5.4-canary.23"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/next/build/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ module.exports = (
// In production/development this option is set to `false` so that webpack can handle import/export with tree-shaking
modules: 'auto',
exclude: ['transform-typeof-symbol'],
include: [
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator',
],
...options['preset-env'],
}

Expand Down
14 changes: 12 additions & 2 deletions packages/next/client/head-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ function reactElementToDOM({ type, props }: JSX.Element): HTMLElement {
if (dangerouslySetInnerHTML) {
el.innerHTML = dangerouslySetInnerHTML.__html || ''
} else if (children) {
el.textContent = typeof children === 'string' ? children : children.join('')
el.textContent =
typeof children === 'string'
? children
: Array.isArray(children)
? children.join('')
: ''
}
return el
}
Expand All @@ -43,7 +48,12 @@ function updateElements(
let title = ''
if (tag) {
const { children } = tag.props
title = typeof children === 'string' ? children : children.join('')
title =
typeof children === 'string'
? children
: Array.isArray(children)
? children.join('')
: ''
}
if (title !== document.title) document.title = title
return
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -76,10 +76,10 @@
"@babel/preset-typescript": "7.10.4",
"@babel/runtime": "7.11.2",
"@babel/types": "7.11.5",
"@next/env": "9.5.4-canary.22",
"@next/polyfill-module": "9.5.4-canary.22",
"@next/react-dev-overlay": "9.5.4-canary.22",
"@next/react-refresh-utils": "9.5.4-canary.22",
"@next/env": "9.5.4-canary.23",
"@next/polyfill-module": "9.5.4-canary.23",
"@next/react-dev-overlay": "9.5.4-canary.23",
"@next/react-refresh-utils": "9.5.4-canary.23",
"ast-types": "0.13.2",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
Expand Down Expand Up @@ -122,7 +122,7 @@
"react-dom": "^16.6.0"
},
"devDependencies": {
"@next/polyfill-nomodule": "9.5.4-canary.22",
"@next/polyfill-nomodule": "9.5.4-canary.23",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "9.5.4-canary.22",
"version": "9.5.4-canary.23",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
Loading

0 comments on commit 008514e

Please sign in to comment.