提交 f01af7ce 编写于 作者: J JJ Kasper 提交者: Tim Neutkens

Add config/test app for new PR stats set-up (#8317)

* Add config/test app for new PR stats set-up

* Move config/test app to test folder
上级 4ab56e8a
{
"name": "stats-app",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "16.9.0",
"react-dom": "16.9.0"
}
}
const Page = () => 'Hello world 👋'
Page.getInitialProps = () => ({})
export default Page
import Link from 'next/link'
function aLink (props) {
return (
<div>
<h3>A Link page!</h3>
<Link href='/'>Go to /</Link>
</div>
)
}
aLink.getInitialProps = () => ({})
export default aLink
/* eslint-disable-next-line */
import Router from 'next/router'
function routerDirect (props) {
return <div>I import the router directly</div>
}
routerDirect.getInitialProps = () => ({})
export default routerDirect
import { withRouter } from 'next/router'
function useWithRouter (props) {
return <div>I use withRouter</div>
}
useWithRouter.getInitialProps = () => ({})
export default withRouter(useWithRouter)
const clientGlobs = [
{
name: 'Client Bundles (main, webpack, commons)',
globs: [
'.next/static/runtime/+(main|webpack)-!(*.module.js)',
'.next/static/chunks/commons!(*.module.js)'
]
},
{
name: 'Client Bundles (main, webpack, commons) Modern',
globs: [
'.next/static/runtime/+(main|webpack)-*.module.js',
'.next/static/chunks/commons.*.module.js'
]
},
{
name: 'Client Pages',
globs: ['.next/static/*/pages/**/!(*.module.js)']
},
{
name: 'Client Pages Modern',
globs: ['.next/static/*/pages/**/*.module.js']
}
]
const renames = [
{
srcGlob: '.next/static/*/pages',
dest: '.next/static/BUILD_ID/pages'
},
{
srcGlob: '.next/static/runtime/main-!(*.module.js)',
dest: '.next/static/runtime/main-HASH.js'
},
{
srcGlob: '.next/static/runtime/webpack-!(*.module.js)',
dest: '.next/static/runtime/webpack-HASH.js'
},
{
srcGlob: '.next/static/chunks/commons!(*.module.js)',
dest: 'next/static/chunks/commons-HASH.js'
},
// modern
{
srcGlob: '.next/static/runtime/main-*.module.js',
dest: '.next/static/runtime/main-HASH.module.js'
},
{
srcGlob: '.next/static/runtime/webpack-*.module.js',
dest: '.next/static/runtime/webpack-HASH.module.js'
},
{
srcGlob: '.next/static/chunks/commons*.module.js',
dest: 'next/static/chunks/commons.HASH.module.js'
}
]
module.exports = {
commentHeading: 'Stats from current PR',
commentReleaseHeading: 'Stats from current release',
appBuildCommand: 'yarn next build',
appStartCommand: 'yarn next start',
mainRepo: 'zeit/next.js',
mainBranch: 'canary',
autoMergeMain: true,
configs: [
{
title: 'Default Server Mode',
diff: 'onOutputChange',
diffConfigFiles: [
{
path: 'next.config.js',
content: `
module.exports = {
webpack(config) {
config.optimization.minimize = false
config.optimization.minimizer = undefined
return config
},
experimental: {
modern: true
}
}
`
}
],
// renames to apply to make file names deterministic
renames,
configFiles: [
{
path: 'next.config.js',
content: `
module.exports = {
experimental: {
modern: true
}
}
`
}
],
filesToTrack: clientGlobs,
pagesToFetch: [
'http://localhost:3000/link',
'http://localhost:3000/index',
'http://localhost:3000/withRouter'
]
},
{
title: 'Serverless Mode',
diff: false,
renames,
configFiles: [
{
path: 'next.config.js',
content: `
module.exports = {
target: 'serverless',
experimental: {
modern: true
}
}
`
}
],
filesToTrack: [
...clientGlobs,
{
name: 'Serverless bundles',
globs: ['.next/serverless/pages/**/*']
}
]
}
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册