Skip to content

Commit 2646409

Browse files
fsongaearon
authored andcommitted
Set up a monorepo with Lerna
1 parent 36d6868 commit 2646409

Some content is hidden

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

46 files changed

+114
-94
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const clientESLintConfig = require('./config/eslint');
1+
const clientESLintConfig = require('./packages/react-scripts/config/eslint');
22

33
module.exports = Object.assign({}, clientESLintConfig, {
44
env: Object.assign({}, clientESLintConfig.env, {

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ build
44
*.tgz
55
my-app*
66
template/src/__tests__/__snapshots__/
7+
lerna-debug.log
8+
npm-debug.log

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_js:
55
- 6
66
cache:
77
directories:
8-
- global-cli/node_modules
98
- node_modules
9+
- packages/create-react-app/node_modules
10+
- packages/react-scripts/node_modules
1011
script: tasks/e2e.sh

CONTRIBUTING.md

+6-7

lerna.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"lerna": "2.0.0-beta.28",
3+
"version": "independent"
4+
}

package.json

+8-77
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,20 @@
11
{
2-
"name": "react-scripts",
3-
"version": "0.4.3",
4-
"description": "Configuration and scripts for Create React App.",
5-
"repository": "facebookincubator/create-react-app",
6-
"license": "BSD-3-Clause",
7-
"engines": {
8-
"node": ">=4"
9-
},
10-
"bugs": {
11-
"url": "https://github.com/facebookincubator/create-react-app/issues"
12-
},
2+
"private": true,
133
"scripts": {
14-
"build": "node scripts/build.js",
4+
"build": "node packages/react-scripts/scripts/build.js",
155
"create-react-app": "tasks/cra.sh",
166
"e2e": "tasks/e2e.sh",
17-
"start": "node scripts/start.js",
18-
"test": "node scripts/test.js --env=jsdom"
7+
"postinstall": "lerna bootstrap",
8+
"publish": "tasks/release.sh",
9+
"start": "node packages/react-scripts/scripts/start.js",
10+
"test": "node packages/react-scripts/scripts/test.js --env=jsdom"
1911
},
20-
"files": [
21-
"PATENTS",
22-
"bin",
23-
"config",
24-
"scripts",
25-
"template"
26-
],
27-
"bin": {
28-
"react-scripts": "./bin/react-scripts.js"
29-
},
30-
"dependencies": {
31-
"autoprefixer": "6.4.1",
32-
"babel-core": "6.14.0",
33-
"babel-eslint": "6.1.2",
34-
"babel-jest": "15.0.0",
35-
"babel-loader": "6.2.5",
36-
"babel-plugin-transform-class-properties": "6.11.5",
37-
"babel-plugin-transform-object-rest-spread": "6.8.0",
38-
"babel-plugin-transform-react-constant-elements": "6.9.1",
39-
"babel-plugin-transform-regenerator": "6.14.0",
40-
"babel-plugin-transform-runtime": "6.15.0",
41-
"babel-preset-latest": "6.14.0",
42-
"babel-preset-react": "6.11.1",
43-
"babel-runtime": "6.11.6",
44-
"case-sensitive-paths-webpack-plugin": "1.1.4",
45-
"chalk": "1.1.3",
46-
"connect-history-api-fallback": "1.3.0",
47-
"cross-spawn": "4.0.0",
48-
"css-loader": "0.24.0",
49-
"detect-port": "1.0.0",
12+
"devDependencies": {
5013
"eslint": "3.5.0",
51-
"eslint-loader": "1.5.0",
5214
"eslint-plugin-flowtype": "2.18.1",
5315
"eslint-plugin-import": "1.12.0",
5416
"eslint-plugin-jsx-a11y": "2.2.2",
5517
"eslint-plugin-react": "5.2.2",
56-
"extract-text-webpack-plugin": "1.0.1",
57-
"file-loader": "0.9.0",
58-
"filesize": "3.3.0",
59-
"find-cache-dir": "0.1.1",
60-
"fs-extra": "0.30.0",
61-
"gzip-size": "3.0.0",
62-
"html-loader": "0.4.3",
63-
"html-webpack-plugin": "2.22.0",
64-
"http-proxy-middleware": "0.17.1",
65-
"jest": "15.1.1",
66-
"json-loader": "0.5.4",
67-
"object-assign": "4.1.0",
68-
"opn": "4.0.2",
69-
"path-exists": "3.0.0",
70-
"postcss-loader": "0.13.0",
71-
"promise": "7.1.1",
72-
"recursive-readdir": "2.0.0",
73-
"rimraf": "2.5.4",
74-
"strip-ansi": "3.0.1",
75-
"style-loader": "0.13.1",
76-
"url-loader": "0.5.7",
77-
"webpack": "1.13.2",
78-
"webpack-dev-server": "1.16.1",
79-
"whatwg-fetch": "1.0.0"
80-
},
81-
"devDependencies": {
82-
"bundle-deps": "1.0.0",
83-
"react": "^15.3.0",
84-
"react-dom": "^15.3.0"
85-
},
86-
"optionalDependencies": {
87-
"fsevents": "1.0.14"
18+
"lerna": "2.0.0-beta.28"
8819
}
8920
}
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.

config/paths.js packages/react-scripts/config/paths.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = {
7070

7171
// @remove-on-publish-begin
7272
module.exports = {
73-
appBuild: resolveOwn('../build'),
73+
appBuild: resolveOwn('../../../build'),
7474
appHtml: resolveOwn('../template/index.html'),
7575
appIndexJs: resolveOwn('../template/src/index.js'),
7676
appPackageJson: resolveOwn('../package.json'),
File renamed without changes.

packages/react-scripts/package.json

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"name": "react-scripts",
3+
"version": "0.4.3",
4+
"description": "Configuration and scripts for Create React App.",
5+
"repository": "facebookincubator/create-react-app",
6+
"license": "BSD-3-Clause",
7+
"engines": {
8+
"node": ">=4"
9+
},
10+
"bugs": {
11+
"url": "https://github.com/facebookincubator/create-react-app/issues"
12+
},
13+
"files": [
14+
"bin",
15+
"config",
16+
"scripts",
17+
"template"
18+
],
19+
"bin": {
20+
"react-scripts": "./bin/react-scripts.js"
21+
},
22+
"dependencies": {
23+
"autoprefixer": "6.4.1",
24+
"babel-core": "6.14.0",
25+
"babel-eslint": "6.1.2",
26+
"babel-jest": "15.0.0",
27+
"babel-loader": "6.2.5",
28+
"babel-plugin-transform-class-properties": "6.11.5",
29+
"babel-plugin-transform-object-rest-spread": "6.8.0",
30+
"babel-plugin-transform-react-constant-elements": "6.9.1",
31+
"babel-plugin-transform-regenerator": "6.14.0",
32+
"babel-plugin-transform-runtime": "6.15.0",
33+
"babel-preset-latest": "6.14.0",
34+
"babel-preset-react": "6.11.1",
35+
"babel-runtime": "6.11.6",
36+
"case-sensitive-paths-webpack-plugin": "1.1.4",
37+
"chalk": "1.1.3",
38+
"connect-history-api-fallback": "1.3.0",
39+
"cross-spawn": "4.0.0",
40+
"css-loader": "0.24.0",
41+
"detect-port": "1.0.0",
42+
"eslint": "3.5.0",
43+
"eslint-loader": "1.5.0",
44+
"eslint-plugin-flowtype": "2.18.1",
45+
"eslint-plugin-import": "1.12.0",
46+
"eslint-plugin-jsx-a11y": "2.2.2",
47+
"eslint-plugin-react": "5.2.2",
48+
"extract-text-webpack-plugin": "1.0.1",
49+
"file-loader": "0.9.0",
50+
"filesize": "3.3.0",
51+
"find-cache-dir": "0.1.1",
52+
"fs-extra": "0.30.0",
53+
"gzip-size": "3.0.0",
54+
"html-loader": "0.4.3",
55+
"html-webpack-plugin": "2.22.0",
56+
"http-proxy-middleware": "0.17.1",
57+
"jest": "15.1.1",
58+
"json-loader": "0.5.4",
59+
"object-assign": "4.1.0",
60+
"opn": "4.0.2",
61+
"path-exists": "3.0.0",
62+
"postcss-loader": "0.13.0",
63+
"promise": "7.1.1",
64+
"recursive-readdir": "2.0.0",
65+
"rimraf": "2.5.4",
66+
"strip-ansi": "3.0.1",
67+
"style-loader": "0.13.1",
68+
"url-loader": "0.5.7",
69+
"webpack": "1.13.2",
70+
"webpack-dev-server": "1.16.1",
71+
"whatwg-fetch": "1.0.0"
72+
},
73+
"devDependencies": {
74+
"bundle-deps": "1.0.0",
75+
"react": "^15.3.0",
76+
"react-dom": "^15.3.0"
77+
},
78+
"optionalDependencies": {
79+
"fsevents": "1.0.14"
80+
}
81+
}
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.

tasks/cra.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ scripts_path=$clean_path/`npm pack`
8585

8686
# Go back to the root directory and run the command from here
8787
cd $root_path
88-
node global-cli/index.js --scripts-version=$scripts_path "$@"
88+
node packages/create-react-app/index.js --scripts-version=$scripts_path "$@"
8989

9090
# Cleanup
9191
cleanup

tasks/e2e.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function cleanup {
1818
echo 'Cleaning up.'
1919
cd $root_path
2020
# Uncomment when snapshot testing is enabled by default:
21-
# rm ./template/src/__snapshots__/App.test.js.snap
21+
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
2222
rm -rf $temp_cli_path $temp_app_path $clean_path
2323
}
2424

@@ -85,8 +85,7 @@ npm start -- --smoke-test
8585
# ******************************************************************************
8686

8787
# Pack CLI (it doesn't need cleaning)
88-
cd global-cli
89-
npm install
88+
cd packages/create-react-app
9089
cli_path=$PWD/`npm pack`
9190

9291
# Packing react-scripts takes more work because we want to clean it up first.

tasks/release.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'`
4646
# Copy some of the project files to the temporary folder.
4747
# Exclude folders that definitely won’t be part of the package from processing.
4848
# We will strip the dev-only code there, and publish from it.
49-
rsync -av --exclude='.git' --exclude=$clean_path\
49+
rsync -av --exclude=$clean_path\
5050
--exclude='node_modules' --exclude='build'\
5151
'./' $clean_path >/dev/null
5252
cd $clean_path
@@ -64,6 +64,7 @@ rm -rf ~/.npm
6464
npm cache clear
6565
npm install
6666

67+
cd packages/react-scripts
6768
# Force dedupe
6869
npm dedupe
6970

@@ -72,10 +73,12 @@ npm dedupe
7273
rm -rf node_modules/fsevents
7374

7475
# This modifies $clean_path/package.json to copy all dependencies to bundledDependencies
75-
node $root_path/node_modules/.bin/bundle-deps
76+
node ./node_modules/.bin/bundle-deps
77+
78+
cd $clean_path
7679

7780
# Go!
78-
npm publish "$@"
81+
./node_modules/.bin/lerna publish --independent "$@"
7982

8083
# cleanup
8184
cd ..

0 commit comments

Comments
 (0)