Skip to content
Permalink
Browse files

Monorepo (#5341)

- Implements Lerna
- Moves all source code into `packages/next`
- Keeps integration tests in the root directory
  • Loading branch information
timneutkens committed Sep 30, 2018
1 parent 08c71a4 commit b1c4f3aec4ca2d51b0ed849914cc8fc97805740a
Showing with 241 additions and 196 deletions.
  1. +1 −0 .circleci/config.yml
  2. +0 −3 .flowconfig
  3. +1 −0 .travis.yml
  4. +1 −0 appveyor.yml
  5. +14 −0 lerna.json
  6. +21 −105 package.json
  7. +2 −0 packages/next/.flowconfig
  8. 0 { → packages/next}/README.md
  9. 0 { → packages/next}/app.js
  10. 0 { → packages/next}/asset.js
  11. 0 .babelrc.js → packages/next/babel.config.js
  12. 0 { → packages/next}/babel.js
  13. 0 { → packages/next}/bin/next
  14. 0 { → packages/next}/bin/next-build
  15. 0 { → packages/next}/bin/next-dev
  16. 0 { → packages/next}/bin/next-export
  17. 0 { → packages/next}/bin/next-init
  18. 0 { → packages/next}/bin/next-start
  19. 0 { → packages/next}/build/babel/plugins/react-loadable-plugin.js
  20. 0 { → packages/next}/build/babel/preset.js
  21. 0 { → packages/next}/build/index.js
  22. 0 { → packages/next}/build/webpack.js
  23. 0 { → packages/next}/build/webpack/loaders/emit-file-loader.js
  24. 0 { → packages/next}/build/webpack/loaders/hot-self-accept-loader.js
  25. 0 { → packages/next}/build/webpack/loaders/next-babel-loader.js
  26. 0 { → packages/next}/build/webpack/plugins/build-manifest-plugin.js
  27. 0 { → packages/next}/build/webpack/plugins/chunk-names-plugin.js
  28. 0 { → packages/next}/build/webpack/plugins/nextjs-require-cache-hot-reloader.js
  29. 0 { → packages/next}/build/webpack/plugins/nextjs-ssr-import.js
  30. 0 { → packages/next}/build/webpack/plugins/nextjs-ssr-module-cache.js
  31. 0 { → packages/next}/build/webpack/plugins/pages-manifest-plugin.js
  32. 0 { → packages/next}/build/webpack/plugins/pages-plugin.js
  33. 0 { → packages/next}/build/webpack/plugins/react-loadable-plugin.js
  34. 0 { → packages/next}/build/webpack/plugins/unlink-file-plugin.js
  35. 0 { → packages/next}/build/webpack/utils.js
  36. 0 { → packages/next}/client.js
  37. 0 { → packages/next}/client/dev-error-overlay/eventsource.js
  38. 0 { → packages/next}/client/dev-error-overlay/format-webpack-messages.js
  39. 0 { → packages/next}/client/dev-error-overlay/hot-dev-client.js
  40. 0 { → packages/next}/client/error-boundary.js
  41. 0 { → packages/next}/client/head-manager.js
  42. 0 { → packages/next}/client/index.js
  43. 0 { → packages/next}/client/next-dev.js
  44. 0 { → packages/next}/client/next.js
  45. 0 { → packages/next}/client/noop.js
  46. 0 { → packages/next}/client/on-demand-entries-client.js
  47. 0 { → packages/next}/client/source-map-support.js
  48. 0 { → packages/next}/client/webpack-hot-middleware-client.js
  49. 0 { → packages/next}/config.js
  50. 0 { → packages/next}/constants.js
  51. 0 { → packages/next}/contributing.md
  52. 0 { → packages/next}/document.js
  53. 0 { → packages/next}/dynamic.js
  54. 0 { → packages/next}/error.js
  55. 0 { → packages/next}/export/index.js
  56. 0 { → packages/next}/flow-typed/npm/autodll-webpack-plugin_vx.x.x.js
  57. 0 { → packages/next}/flow-typed/npm/glob_vx.x.x.js
  58. 0 { → packages/next}/flow-typed/npm/loader-utils_vx.x.x.js
  59. 0 { → packages/next}/flow-typed/npm/react-lifecycles-compat_vx.x.x.js
  60. 0 { → packages/next}/flow-typed/npm/source-map_vx.x.x.js
  61. 0 { → packages/next}/flow-typed/npm/terser-webpack-plugin_vx.x.x.js
  62. 0 { → packages/next}/flow-typed/npm/uglifyjs-webpack-plugin_vx.x.x.js
  63. 0 { → packages/next}/flow-typed/npm/unfetch_vx.x.x.js
  64. 0 { → packages/next}/flow-typed/npm/webpack-sources_vx.x.x.js
  65. 0 { → packages/next}/flow-typed/npm/webpack_vx.x.x.js
  66. 0 { → packages/next}/flow-typed/npm/webpackbar_vx.x.x.js
  67. 0 { → packages/next}/flow-typed/npm/write-file-webpack-plugin_vx.x.x.js
  68. 0 { → packages/next}/head.js
  69. 0 { → packages/next}/lib/EventEmitter.js
  70. 0 { → packages/next}/lib/app.js
  71. 0 { → packages/next}/lib/asset.js
  72. 0 { → packages/next}/lib/constants.js
  73. 0 { → packages/next}/lib/dynamic.js
  74. 0 { → packages/next}/lib/error-debug.js
  75. 0 { → packages/next}/lib/error.js
  76. 0 { → packages/next}/lib/head.js
  77. 0 { → packages/next}/lib/link.js
  78. 0 { → packages/next}/lib/loadable-capture.js
  79. 0 { → packages/next}/lib/loadable.js
  80. 0 { → packages/next}/lib/p-queue.js
  81. 0 { → packages/next}/lib/page-loader.js
  82. 0 { → packages/next}/lib/promisify.js
  83. 0 { → packages/next}/lib/router/index.js
  84. 0 { → packages/next}/lib/router/router.js
  85. 0 { → packages/next}/lib/router/with-router.js
  86. 0 { → packages/next}/lib/runtime-config.js
  87. 0 { → packages/next}/lib/shallow-equals.js
  88. 0 { → packages/next}/lib/side-effect.js
  89. 0 { → packages/next}/lib/utils.js
  90. 0 { → packages/next}/license.md
  91. 0 { → packages/next}/link.js
  92. +114 −0 packages/next/package.json
  93. 0 { → packages/next}/pages/_app.js
  94. 0 { → packages/next}/pages/_document.js
  95. 0 { → packages/next}/pages/_error.js
  96. 0 { → packages/next}/prefetch.js
  97. 0 { → packages/next}/router.js
  98. 0 { → packages/next}/server/config.js
  99. 0 { → packages/next}/server/document.js
  100. 0 { → packages/next}/server/hot-reloader.js
  101. 0 { → packages/next}/server/lib/error-overlay-middleware.js
  102. 0 { → packages/next}/server/lib/path-match.js
  103. 0 { → packages/next}/server/lib/start-server.js
  104. 0 { → packages/next}/server/lib/utils.js
  105. 0 { → packages/next}/server/next-dev-server.js
  106. 0 { → packages/next}/server/next-server.js
  107. 0 { → packages/next}/server/next.js
  108. 0 { → packages/next}/server/on-demand-entry-handler.js
  109. 0 { → packages/next}/server/render.js
  110. 0 { → packages/next}/server/require.js
  111. 0 { → packages/next}/server/router.js
  112. 0 { → packages/next}/server/utils.js
  113. 0 { → packages/next}/taskfile-babel.js
  114. +68 −0 packages/next/taskfile.js
  115. +1 −0 readme.md
  116. +11 −80 taskfile.js
  117. +0 −1 test/integration/basic/test/rendering.js
  118. +1 −1 test/isolated/require-page.test.js
  119. +1 −1 test/isolated/webpack-utils.test.js
  120. +1 −1 test/lib/next-test-utils.js
  121. +1 −1 test/node_modules/next
  122. +1 −1 test/unit/EventEmitter.test.js
  123. +1 −1 test/unit/getDisplayName.test.js
  124. +1 −1 test/unit/loadGetInitialProps.test.js
@@ -7,4 +7,5 @@ jobs:
steps:
- checkout
- run: yarn install
- run: yarn bootstrap
- run: yarn test

This file was deleted.

@@ -20,6 +20,7 @@
before_cache: [
"rm -rf node_modules/.cache"
],
before_script: ["npm run bootstrap"],
after_script: ["npm run coveralls"],
deploy: {
provider: "npm",
@@ -10,6 +10,7 @@ install:
- ps: Install-Product node $env:nodejs_version x64
# install modules
- npm install
- npm run bootstrap

# Post-install test scripts.
test_script:
@@ -0,0 +1,14 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*"
],
"command": {
"publish": {
"allowBranch": "canary",
"registry": "https://registry.npmjs.org/"
}
},
"version": "0.0.0"
}
@@ -1,50 +1,26 @@
{
"name": "next",
"version": "7.0.1",
"description": "Minimalistic framework for server-rendered React applications",
"main": "./dist/server/next.js",
"license": "MIT",
"repository": "zeit/next.js",
"bugs": "https://github.com/zeit/next.js/issues",
"homepage": "https://github.com/zeit/next.js",
"files": [
"dist",
"app.js",
"asset.js",
"babel.js",
"client.js",
"config.js",
"constants.js",
"document.js",
"dynamic.js",
"error.js",
"head.js",
"link.js",
"prefetch.js",
"router.js"
"name": "nextjs-project",
"private": true,
"workspaces": [
"packages/*"
],
"bin": {
"next": "./dist/bin/next"
},
"scripts": {
"build": "taskr",
"release": "taskr release",
"lerna": "lerna",
"bootstrap": "lerna bootstrap",
"pretestonly": "taskr pretest",
"testonly": "cross-env NODE_PATH=test/lib jest \\.test.js",
"posttestonly": "taskr posttest",
"testall": "npm run testonly -- --coverage --forceExit --runInBand --verbose --bail",
"pretest": "npm run lint && npm run flow",
"pretest": "npm run lint",
"test": "cross-env npm run testall || npm run testall",
"coveralls": "nyc --instrument=false --source-map=false report --temp-directory=./coverage --reporter=text-lcov | coveralls",
"flow": "flow check",
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
"prepublish": "npm run release",
"precommit": "lint-staged"
"precommit": "lint-staged",
"lint": "lerna run lint",
"prepublish": "lerna run prepublish"
},
"taskr": {
"requires": [
"./taskfile-babel.js"
]
"lint-staged": {
"*.js": "standard",
"bin/*": "standard"
},
"standard": {
"parser": "babel-eslint",
@@ -55,73 +31,22 @@
"**/examples/with-mobx/**"
]
},
"lint-staged": {
"*.js": "standard",
"bin/*": "standard"
"jest": {
"testEnvironment": "node",
"roots": [
"test/"
]
},
"dependencies": {
"@babel/core": "7.0.0",
"@babel/plugin-proposal-class-properties": "7.0.0",
"devDependencies": {
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
"@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-runtime": "7.0.0",
"@babel/preset-env": "7.0.0",
"@babel/preset-react": "7.0.0",
"@babel/runtime": "7.0.0",
"@babel/runtime-corejs2": "7.0.0",
"@babel/template": "7.0.0",
"ansi-html": "0.0.7",
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.2",
"babel-plugin-react-require": "3.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"cross-spawn": "5.1.0",
"del": "3.0.0",
"etag": "1.8.1",
"event-source-polyfill": "0.0.12",
"find-up": "2.1.0",
"fresh": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"glob": "7.1.2",
"hoist-non-react-statics": "2.5.5",
"htmlescape": "1.1.1",
"http-errors": "1.6.2",
"http-status": "1.0.1",
"launch-editor": "2.2.1",
"loader-utils": "1.1.0",
"minimist": "1.2.0",
"mkdirp-then": "1.2.0",
"nanoid": "1.2.1",
"path-to-regexp": "2.1.0",
"prop-types": "15.6.2",
"prop-types-exact": "1.2.0",
"react-error-overlay": "4.0.0",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
"send": "0.16.1",
"source-map": "0.5.7",
"strip-ansi": "3.0.1",
"styled-jsx": "3.1.0",
"terser-webpack-plugin": "1.0.2",
"unfetch": "3.0.0",
"url": "0.11.0",
"webpack": "4.20.2",
"webpack-dev-middleware": "3.4.0",
"webpack-hot-middleware": "2.22.3",
"webpack-sources": "1.2.0",
"webpackbar": "2.6.3",
"write-file-webpack-plugin": "4.3.2"
},
"devDependencies": {
"@babel/preset-flow": "7.0.0",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
"@zeit/next-css": "0.2.1-canary.1",
"@zeit/next-sass": "0.2.1-canary.1",
"@zeit/next-typescript": "1.1.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.4.2",
"babel-plugin-transform-define": "1.3.0",
@@ -138,6 +63,7 @@
"get-port": "3.2.0",
"husky": "0.14.3",
"jest-cli": "21.2.0",
"lerna": "^3.4.0",
"lint-staged": "4.2.3",
"micro": "9.1.0",
"mkdirp": "0.5.1",
@@ -151,15 +77,5 @@
"standard": "11.0.1",
"taskr": "1.1.0",
"wd": "1.10.3"
},
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"jest": {
"testEnvironment": "node",
"roots": [
"test/"
]
}
}
@@ -0,0 +1,2 @@
[ignore]
<PROJECT_ROOT>/.*.json
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,114 @@
{
"name": "next",
"version": "7.0.1",
"description": "Minimalistic framework for server-rendered React applications",
"main": "./dist/server/next.js",
"license": "MIT",
"repository": "zeit/next.js",
"bugs": "https://github.com/zeit/next.js/issues",
"homepage": "https://github.com/zeit/next.js",
"files": [
"dist",
"app.js",
"asset.js",
"babel.js",
"client.js",
"config.js",
"constants.js",
"document.js",
"dynamic.js",
"error.js",
"head.js",
"link.js",
"prefetch.js",
"router.js"
],
"bin": {
"next": "./dist/bin/next"
},
"scripts": {
"build": "taskr",
"release": "taskr release",
"flow": "flow check",
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
"prepublish": "npm run release"
},
"taskr": {
"requires": [
"./taskfile-babel.js"
]
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"**/node_modules/**",
"**/examples/with-ioc/**",
"**/examples/with-kea/**",
"**/examples/with-mobx/**"
]
},
"dependencies": {
"@babel/core": "7.1.2",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
"@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-runtime": "7.1.0",
"@babel/preset-env": "7.1.0",
"@babel/preset-react": "7.0.0",
"@babel/runtime": "7.1.2",
"@babel/runtime-corejs2": "7.1.2",
"@babel/template": "7.1.2",
"ansi-html": "0.0.7",
"autodll-webpack-plugin": "0.4.2",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.2",
"babel-plugin-react-require": "3.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"cross-spawn": "5.1.0",
"del": "3.0.0",
"etag": "1.8.1",
"event-source-polyfill": "0.0.12",
"find-up": "2.1.0",
"fresh": "0.5.2",
"friendly-errors-webpack-plugin": "1.7.0",
"glob": "7.1.2",
"hoist-non-react-statics": "2.5.5",
"htmlescape": "1.1.1",
"http-errors": "1.6.2",
"http-status": "1.0.1",
"launch-editor": "2.2.1",
"loader-utils": "1.1.0",
"minimist": "1.2.0",
"mkdirp-then": "1.2.0",
"nanoid": "1.2.1",
"path-to-regexp": "2.1.0",
"prop-types": "15.6.2",
"prop-types-exact": "1.2.0",
"react-error-overlay": "4.0.0",
"recursive-copy": "2.0.6",
"resolve": "1.5.0",
"send": "0.16.1",
"source-map": "0.5.7",
"strip-ansi": "3.0.1",
"styled-jsx": "3.1.0",
"terser-webpack-plugin": "1.0.2",
"unfetch": "3.0.0",
"url": "0.11.0",
"webpack": "4.20.2",
"webpack-dev-middleware": "3.4.0",
"webpack-hot-middleware": "2.22.3",
"webpack-sources": "1.2.0",
"webpackbar": "2.6.3",
"write-file-webpack-plugin": "4.3.2"
},
"peerDependencies": {
"react": "^16.0.0",
"react-dom": "^16.0.0"
},
"devDependencies": {
"@babel/preset-flow": "7.0.0",
"@taskr/clear": "1.1.0",
"@taskr/watch": "1.1.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,68 @@
const notifier = require('node-notifier')

export async function compile (task) {
await task.parallel(['bin', 'server', 'nextbuild', 'nextbuildstatic', 'lib', 'client'])
}

export async function bin (task, opts) {
await task.source(opts.src || 'bin/*').babel().target('dist/bin', {mode: '0755'})
notify('Compiled binaries')
}

export async function lib (task, opts) {
await task.source(opts.src || 'lib/**/*.js').babel().target('dist/lib')
notify('Compiled lib files')
}

export async function server (task, opts) {
await task.source(opts.src || 'server/**/*.js').babel().target('dist/server')
notify('Compiled server files')
}

export async function nextbuild (task, opts) {
await task.source(opts.src || 'build/**/*.js').babel().target('dist/build')
notify('Compiled build files')
}

export async function client (task, opts) {
await task.source(opts.src || 'client/**/*.js').babel().target('dist/client')
notify('Compiled client files')
}

// export is a reserved keyword for functions
export async function nextbuildstatic (task, opts) {
await task.source(opts.src || 'export/**/*.js').babel().target('dist/export')
notify('Compiled export files')
}

export async function copy (task) {
await task.source('pages/**/*.js').target('dist/pages')
}

export async function build (task) {
await task.serial(['copy', 'compile'])
}

export default async function (task) {
await task.start('build')
await task.watch('bin/*', 'bin')
await task.watch('pages/**/*.js', 'copy')
await task.watch('server/**/*.js', 'server')
await task.watch('build/**/*.js', 'nextbuild')
await task.watch('export/**/*.js', 'nextexport')
await task.watch('client/**/*.js', 'client')
await task.watch('lib/**/*.js', 'lib')
}

export async function release (task) {
await task.clear('dist').start('build')
}

// notification helper
function notify (msg) {
return notifier.notify({
title: '▲ Next',
message: msg,
icon: false
})
}

0 comments on commit b1c4f3a

Please sign in to comment.