Skip to content

Commit b1c4f3a

Browse files
authored
Monorepo (vercel#5341)
- Implements Lerna - Moves all source code into `packages/next` - Keeps integration tests in the root directory
1 parent 08c71a4 commit b1c4f3a

File tree

123 files changed

+239
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+239
-194
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ jobs:
77
steps:
88
- checkout
99
- run: yarn install
10+
- run: yarn bootstrap
1011
- run: yarn test

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
before_cache: [
2121
"rm -rf node_modules/.cache"
2222
],
23+
before_script: ["npm run bootstrap"],
2324
after_script: ["npm run coveralls"],
2425
deploy: {
2526
provider: "npm",

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ install:
1010
- ps: Install-Product node $env:nodejs_version x64
1111
# install modules
1212
- npm install
13+
- npm run bootstrap
1314

1415
# Post-install test scripts.
1516
test_script:

lerna.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"npmClient": "yarn",
3+
"useWorkspaces": true,
4+
"packages": [
5+
"packages/*"
6+
],
7+
"command": {
8+
"publish": {
9+
"allowBranch": "canary",
10+
"registry": "https://registry.npmjs.org/"
11+
}
12+
},
13+
"version": "0.0.0"
14+
}

package.json

+21-105
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,26 @@
11
{
2-
"name": "next",
3-
"version": "7.0.1",
4-
"description": "Minimalistic framework for server-rendered React applications",
5-
"main": "./dist/server/next.js",
6-
"license": "MIT",
7-
"repository": "zeit/next.js",
8-
"bugs": "https://github.com/zeit/next.js/issues",
9-
"homepage": "https://github.com/zeit/next.js",
10-
"files": [
11-
"dist",
12-
"app.js",
13-
"asset.js",
14-
"babel.js",
15-
"client.js",
16-
"config.js",
17-
"constants.js",
18-
"document.js",
19-
"dynamic.js",
20-
"error.js",
21-
"head.js",
22-
"link.js",
23-
"prefetch.js",
24-
"router.js"
2+
"name": "nextjs-project",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
256
],
26-
"bin": {
27-
"next": "./dist/bin/next"
28-
},
297
"scripts": {
30-
"build": "taskr",
31-
"release": "taskr release",
8+
"lerna": "lerna",
9+
"bootstrap": "lerna bootstrap",
3210
"pretestonly": "taskr pretest",
3311
"testonly": "cross-env NODE_PATH=test/lib jest \\.test.js",
3412
"posttestonly": "taskr posttest",
3513
"testall": "npm run testonly -- --coverage --forceExit --runInBand --verbose --bail",
36-
"pretest": "npm run lint && npm run flow",
14+
"pretest": "npm run lint",
3715
"test": "cross-env npm run testall || npm run testall",
3816
"coveralls": "nyc --instrument=false --source-map=false report --temp-directory=./coverage --reporter=text-lcov | coveralls",
39-
"flow": "flow check",
40-
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
41-
"prepublish": "npm run release",
42-
"precommit": "lint-staged"
17+
"precommit": "lint-staged",
18+
"lint": "lerna run lint",
19+
"prepublish": "lerna run prepublish"
4320
},
44-
"taskr": {
45-
"requires": [
46-
"./taskfile-babel.js"
47-
]
21+
"lint-staged": {
22+
"*.js": "standard",
23+
"bin/*": "standard"
4824
},
4925
"standard": {
5026
"parser": "babel-eslint",
@@ -55,73 +31,22 @@
5531
"**/examples/with-mobx/**"
5632
]
5733
},
58-
"lint-staged": {
59-
"*.js": "standard",
60-
"bin/*": "standard"
34+
"jest": {
35+
"testEnvironment": "node",
36+
"roots": [
37+
"test/"
38+
]
6139
},
62-
"dependencies": {
63-
"@babel/core": "7.0.0",
64-
"@babel/plugin-proposal-class-properties": "7.0.0",
40+
"devDependencies": {
6541
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
66-
"@babel/plugin-syntax-dynamic-import": "7.0.0",
67-
"@babel/plugin-transform-runtime": "7.0.0",
68-
"@babel/preset-env": "7.0.0",
6942
"@babel/preset-react": "7.0.0",
70-
"@babel/runtime": "7.0.0",
71-
"@babel/runtime-corejs2": "7.0.0",
72-
"@babel/template": "7.0.0",
73-
"ansi-html": "0.0.7",
74-
"autodll-webpack-plugin": "0.4.2",
75-
"babel-core": "7.0.0-bridge.0",
76-
"babel-loader": "8.0.2",
77-
"babel-plugin-react-require": "3.0.0",
78-
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
79-
"case-sensitive-paths-webpack-plugin": "2.1.2",
80-
"cross-spawn": "5.1.0",
81-
"del": "3.0.0",
82-
"etag": "1.8.1",
83-
"event-source-polyfill": "0.0.12",
84-
"find-up": "2.1.0",
85-
"fresh": "0.5.2",
86-
"friendly-errors-webpack-plugin": "1.7.0",
87-
"glob": "7.1.2",
88-
"hoist-non-react-statics": "2.5.5",
89-
"htmlescape": "1.1.1",
90-
"http-errors": "1.6.2",
91-
"http-status": "1.0.1",
92-
"launch-editor": "2.2.1",
93-
"loader-utils": "1.1.0",
94-
"minimist": "1.2.0",
95-
"mkdirp-then": "1.2.0",
96-
"nanoid": "1.2.1",
97-
"path-to-regexp": "2.1.0",
98-
"prop-types": "15.6.2",
99-
"prop-types-exact": "1.2.0",
100-
"react-error-overlay": "4.0.0",
101-
"recursive-copy": "2.0.6",
102-
"resolve": "1.5.0",
103-
"send": "0.16.1",
104-
"source-map": "0.5.7",
105-
"strip-ansi": "3.0.1",
106-
"styled-jsx": "3.1.0",
107-
"terser-webpack-plugin": "1.0.2",
108-
"unfetch": "3.0.0",
109-
"url": "0.11.0",
110-
"webpack": "4.20.2",
111-
"webpack-dev-middleware": "3.4.0",
112-
"webpack-hot-middleware": "2.22.3",
113-
"webpack-sources": "1.2.0",
114-
"webpackbar": "2.6.3",
115-
"write-file-webpack-plugin": "4.3.2"
116-
},
117-
"devDependencies": {
118-
"@babel/preset-flow": "7.0.0",
11943
"@taskr/clear": "1.1.0",
12044
"@taskr/esnext": "1.1.0",
12145
"@taskr/watch": "1.1.0",
12246
"@zeit/next-css": "0.2.1-canary.1",
12347
"@zeit/next-sass": "0.2.1-canary.1",
12448
"@zeit/next-typescript": "1.1.0",
49+
"babel-core": "7.0.0-bridge.0",
12550
"babel-eslint": "9.0.0",
12651
"babel-jest": "23.4.2",
12752
"babel-plugin-transform-define": "1.3.0",
@@ -138,6 +63,7 @@
13863
"get-port": "3.2.0",
13964
"husky": "0.14.3",
14065
"jest-cli": "21.2.0",
66+
"lerna": "^3.4.0",
14167
"lint-staged": "4.2.3",
14268
"micro": "9.1.0",
14369
"mkdirp": "0.5.1",
@@ -151,15 +77,5 @@
15177
"standard": "11.0.1",
15278
"taskr": "1.1.0",
15379
"wd": "1.10.3"
154-
},
155-
"peerDependencies": {
156-
"react": "^16.0.0",
157-
"react-dom": "^16.0.0"
158-
},
159-
"jest": {
160-
"testEnvironment": "node",
161-
"roots": [
162-
"test/"
163-
]
16480
}
16581
}
-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
[ignore]
2-
<PROJECT_ROOT>/examples/.*
32
<PROJECT_ROOT>/.*.json

README.md packages/next/README.md

app.js packages/next/app.js

File renamed without changes.

asset.js packages/next/asset.js

File renamed without changes.
File renamed without changes.

babel.js packages/next/babel.js

File renamed without changes.

bin/next packages/next/bin/next

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.

client.js packages/next/client.js

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.

config.js packages/next/config.js

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

error.js packages/next/error.js

File renamed without changes.
File renamed without changes.
File renamed without changes.

head.js packages/next/head.js

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.

link.js packages/next/link.js

File renamed without changes.

packages/next/package.json

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"name": "next",
3+
"version": "7.0.1",
4+
"description": "Minimalistic framework for server-rendered React applications",
5+
"main": "./dist/server/next.js",
6+
"license": "MIT",
7+
"repository": "zeit/next.js",
8+
"bugs": "https://github.com/zeit/next.js/issues",
9+
"homepage": "https://github.com/zeit/next.js",
10+
"files": [
11+
"dist",
12+
"app.js",
13+
"asset.js",
14+
"babel.js",
15+
"client.js",
16+
"config.js",
17+
"constants.js",
18+
"document.js",
19+
"dynamic.js",
20+
"error.js",
21+
"head.js",
22+
"link.js",
23+
"prefetch.js",
24+
"router.js"
25+
],
26+
"bin": {
27+
"next": "./dist/bin/next"
28+
},
29+
"scripts": {
30+
"build": "taskr",
31+
"release": "taskr release",
32+
"flow": "flow check",
33+
"lint": "standard 'bin/*' 'client/**/*.js' 'examples/**/*.js' 'lib/**/*.js' 'pages/**/*.js' 'server/**/*.js' 'build/**/*.js' 'test/**/*.js'",
34+
"prepublish": "npm run release"
35+
},
36+
"taskr": {
37+
"requires": [
38+
"./taskfile-babel.js"
39+
]
40+
},
41+
"standard": {
42+
"parser": "babel-eslint",
43+
"ignore": [
44+
"**/node_modules/**",
45+
"**/examples/with-ioc/**",
46+
"**/examples/with-kea/**",
47+
"**/examples/with-mobx/**"
48+
]
49+
},
50+
"dependencies": {
51+
"@babel/core": "7.1.2",
52+
"@babel/plugin-proposal-class-properties": "7.1.0",
53+
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
54+
"@babel/plugin-syntax-dynamic-import": "7.0.0",
55+
"@babel/plugin-transform-runtime": "7.1.0",
56+
"@babel/preset-env": "7.1.0",
57+
"@babel/preset-react": "7.0.0",
58+
"@babel/runtime": "7.1.2",
59+
"@babel/runtime-corejs2": "7.1.2",
60+
"@babel/template": "7.1.2",
61+
"ansi-html": "0.0.7",
62+
"autodll-webpack-plugin": "0.4.2",
63+
"babel-core": "7.0.0-bridge.0",
64+
"babel-loader": "8.0.2",
65+
"babel-plugin-react-require": "3.0.0",
66+
"babel-plugin-transform-react-remove-prop-types": "0.4.15",
67+
"case-sensitive-paths-webpack-plugin": "2.1.2",
68+
"cross-spawn": "5.1.0",
69+
"del": "3.0.0",
70+
"etag": "1.8.1",
71+
"event-source-polyfill": "0.0.12",
72+
"find-up": "2.1.0",
73+
"fresh": "0.5.2",
74+
"friendly-errors-webpack-plugin": "1.7.0",
75+
"glob": "7.1.2",
76+
"hoist-non-react-statics": "2.5.5",
77+
"htmlescape": "1.1.1",
78+
"http-errors": "1.6.2",
79+
"http-status": "1.0.1",
80+
"launch-editor": "2.2.1",
81+
"loader-utils": "1.1.0",
82+
"minimist": "1.2.0",
83+
"mkdirp-then": "1.2.0",
84+
"nanoid": "1.2.1",
85+
"path-to-regexp": "2.1.0",
86+
"prop-types": "15.6.2",
87+
"prop-types-exact": "1.2.0",
88+
"react-error-overlay": "4.0.0",
89+
"recursive-copy": "2.0.6",
90+
"resolve": "1.5.0",
91+
"send": "0.16.1",
92+
"source-map": "0.5.7",
93+
"strip-ansi": "3.0.1",
94+
"styled-jsx": "3.1.0",
95+
"terser-webpack-plugin": "1.0.2",
96+
"unfetch": "3.0.0",
97+
"url": "0.11.0",
98+
"webpack": "4.20.2",
99+
"webpack-dev-middleware": "3.4.0",
100+
"webpack-hot-middleware": "2.22.3",
101+
"webpack-sources": "1.2.0",
102+
"webpackbar": "2.6.3",
103+
"write-file-webpack-plugin": "4.3.2"
104+
},
105+
"peerDependencies": {
106+
"react": "^16.0.0",
107+
"react-dom": "^16.0.0"
108+
},
109+
"devDependencies": {
110+
"@babel/preset-flow": "7.0.0",
111+
"@taskr/clear": "1.1.0",
112+
"@taskr/watch": "1.1.0"
113+
}
114+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

router.js packages/next/router.js

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.

packages/next/taskfile.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const notifier = require('node-notifier')
2+
3+
export async function compile (task) {
4+
await task.parallel(['bin', 'server', 'nextbuild', 'nextbuildstatic', 'lib', 'client'])
5+
}
6+
7+
export async function bin (task, opts) {
8+
await task.source(opts.src || 'bin/*').babel().target('dist/bin', {mode: '0755'})
9+
notify('Compiled binaries')
10+
}
11+
12+
export async function lib (task, opts) {
13+
await task.source(opts.src || 'lib/**/*.js').babel().target('dist/lib')
14+
notify('Compiled lib files')
15+
}
16+
17+
export async function server (task, opts) {
18+
await task.source(opts.src || 'server/**/*.js').babel().target('dist/server')
19+
notify('Compiled server files')
20+
}
21+
22+
export async function nextbuild (task, opts) {
23+
await task.source(opts.src || 'build/**/*.js').babel().target('dist/build')
24+
notify('Compiled build files')
25+
}
26+
27+
export async function client (task, opts) {
28+
await task.source(opts.src || 'client/**/*.js').babel().target('dist/client')
29+
notify('Compiled client files')
30+
}
31+
32+
// export is a reserved keyword for functions
33+
export async function nextbuildstatic (task, opts) {
34+
await task.source(opts.src || 'export/**/*.js').babel().target('dist/export')
35+
notify('Compiled export files')
36+
}
37+
38+
export async function copy (task) {
39+
await task.source('pages/**/*.js').target('dist/pages')
40+
}
41+
42+
export async function build (task) {
43+
await task.serial(['copy', 'compile'])
44+
}
45+
46+
export default async function (task) {
47+
await task.start('build')
48+
await task.watch('bin/*', 'bin')
49+
await task.watch('pages/**/*.js', 'copy')
50+
await task.watch('server/**/*.js', 'server')
51+
await task.watch('build/**/*.js', 'nextbuild')
52+
await task.watch('export/**/*.js', 'nextexport')
53+
await task.watch('client/**/*.js', 'client')
54+
await task.watch('lib/**/*.js', 'lib')
55+
}
56+
57+
export async function release (task) {
58+
await task.clear('dist').start('build')
59+
}
60+
61+
// notification helper
62+
function notify (msg) {
63+
return notifier.notify({
64+
title: '▲ Next',
65+
message: msg,
66+
icon: false
67+
})
68+
}

readme.md

+1

0 commit comments

Comments
 (0)