Skip to content

Commit 4aa2fdb

Browse files
committed
Move to a mono-repo structure
wip Add gitignore and edit rollup config Update gitignore Wip WIP Get rid of older json files and use js files to extend across pkgs later Make test:native work again, thanks to @SimenB No haste and get integration test to work Update husky Update package.json Update travis and appveyor Add lint script Update sandbox Update yarn version Move eslint into sc package Remove unnecessary files Update lint-staged Update CONTRIBUTING.md Update version in lerna.json Update contributing Update scripts Update contributing Update contributing Update contributing.md and publish script Update contributing v4.1.4-alpha.0 Update package json Update lerna version v4.1.4-alpha.0 v4.1.4-alpha.1 Independent version for sandbox and styled-components Yarn instead of npm Add readme to styled-components package to show up on npm Publish - [email protected] Update prepublisOnly and contributing Update gitignore Publish - [email protected] Test without readme Remove readme Publish - [email protected] Copy readme prepublishOnly Publish - [email protected]
1 parent 8cf278b commit 4aa2fdb

File tree

382 files changed

+13701
-1071
lines changed

Some content is hidden

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

382 files changed

+13701
-1071
lines changed

.gitignore

-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
node_modules
22
dist
33
.DS_Store
4-
bundle-stats.html
5-
.vscode
6-
__diff_output__
7-
lib
8-
sandbox/node_modules
94
*.log
10-
test-results.json
11-
mount-deep-tree-trace.json
12-
mount-wide-tree-trace.json
13-
update-dynamic-styles-trace.json
145
package-lock.json

.jest.integration.json

-4
This file was deleted.

.jest.native.json

-7
This file was deleted.

.jest.primitives.json

-8
This file was deleted.

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ env:
1717
node_js:
1818
- '8'
1919
- '10'
20+
before_install:
21+
- curl -o- -L https://yarnpkg.com/install.sh | bash
22+
- export PATH="$HOME/.yarn/bin:$PATH"
2023
install: yarn --frozen-lockfile
2124
script:
2225
- node --version

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ _The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
88

99
- Make the `GlobalStyleComponent` created by `createGlobalStyle` call the base constructor with `props` (see [#2321](https://github.com/styled-components/styled-components/pull/2321)).
1010

11+
- Move to Mono repository structure with lerna [@imbhargav5](https://github.com/imbhargav5) (see [#2326](https://github.com/styled-components/styled-components/pull/2326))
12+
1113
## [v4.1.3] - 2018-12-17
1214

1315
- Under the hood code cleanup of the Babel macro, by [@lucleray](https://github.com/lucleray) (see [#2286](https://github.com/styled-components/styled-components/pull/2286))

CONTRIBUTING.md

+30-27
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ We want contributors to provide ideas, keep the ship shipping and to take some o
3434

3535
The fact that you'll have push access will allow you to:
3636

37-
* Avoid having to fork the project if you want to submit other pull requests as you'll be able to create branches directly on the project.
38-
* Help triage issues, merge pull requests.
39-
* Pick up the project if other maintainers move their focus elsewhere.
37+
- Avoid having to fork the project if you want to submit other pull requests as you'll be able to create branches directly on the project.
38+
- Help triage issues, merge pull requests.
39+
- Pick up the project if other maintainers move their focus elsewhere.
4040

4141
It's up to you to use those superpowers or not though 😉
4242

@@ -62,47 +62,51 @@ Here is a quick guide to doing code contributions to the library.
6262

6363
3. Create a branch with a meaningful name for the issue: `git checkout -b fix-something`
6464

65-
4. Make your changes and commit: `git add` and `git commit`
65+
4. Install packages by running `yarn` in the root of the project.
6666

67-
5. Make sure that the tests still pass: `npm test` and `npm run flow` (for the type checks)
67+
5. Make your changes and commit: `git add` and `git commit`
6868

69-
6. Push your branch: `git push -u origin your-branch-name`
69+
6. Make sure that the tests still pass: `yarn test` and `yarn run flow` (for the type checks)
7070

71-
7. Submit a pull request to the upstream styled-components repository.
71+
7. Push your branch: `git push -u origin your-branch-name`
7272

73-
8. Choose a descriptive title and describe your changes briefly.
73+
8. Submit a pull request to the upstream styled-components repository.
7474

75-
9. Wait for a maintainer to review your PR, make changes if it's being recommended, and get it merged.
75+
9. Choose a descriptive title and describe your changes briefly.
7676

77-
10. Perform a celebratory dance! :dancer:
77+
10. Wait for a maintainer to review your PR, make changes if it's being recommended, and get it merged.
78+
79+
11. Perform a celebratory dance! :dancer:
7880

7981
### How do I set up the project?
8082

81-
Run [`yarn install`](https://yarnpkg.com/) and edit code in the `src/` folder. It's luckily very simple! :wink:
83+
Run [`yarn install`](https://yarnpkg.com/) and edit code in the `packages/styled-components/src/` folder. It's luckily very simple! :wink:
84+
85+
> We use yarn workspaces with [lerna](https://github.com/lerna/lerna) to make this work as a monorepo under the hood.
8286
8387
### How do I verify and test my changes?
8488

85-
To make development process easier we provide a Sandbox React application in this repo which automatically uses your local version of the `styled-components` library. That means when you make any changes in the `src/` folder they'll show up automatically there!
89+
To make development process easier we provide a Sandbox React application in this repo which automatically uses your local version of the `styled-components` library. That means when you make any changes in the `packages/styled-components/src/` folder they'll show up automatically there!
8690

8791
To use the sandbox, follow these steps:
8892

89-
1. Go to sandbox folder: `cd sandbox`
93+
1. Go to sandbox folder: `cd packages/sandbox`
9094

91-
2. Install all the dependencies: `yarn install` or `npm install`
95+
2. Install all the dependencies: `yarn install`. Since this repository uses `yarn` workspaces, avoid using `npm` where you can.
9296

93-
3. Run `yarn start` or `npm start` to start sandbox server
97+
3. Run `yarn start` to start sandbox server
9498

9599
Now you should have the sandbox running on `localhost:3000`. The Sandbox supports client-side and server-side rendering.
96100

97101
You can use an interactive editor, powered by [`react-live`](https://react-live.philpl.com/), to test your changes. But if you want more control, you can edit the sandbox itself too:
98102

99-
* Root `<App>` component is located at `styled-components/sandbox/src/App.js` file
103+
- Root `<App>` component is located at `packages/sandbox/src/App.js` file
100104

101-
* Client-side entry point is at `styled-components/sandbox/src/browser.js`
105+
- Client-side entry point is at `packages/sandbox/src/browser.js`
102106

103-
* Server-side entry point is at `styled-components/sandbox/src/server.js`
107+
- Server-side entry point is at `packages/sandbox/src/server.js`
104108

105-
In the sandbox source, `styled-components` is an alias to `styled-components/src` folder, so you can edit the source directly and dev-server will handle rebuilding the source and livereloading your sandbox after the build is done.
109+
In the sandbox source, `styled-components` is an alias to `packages/styled-components/src` folder, so you can edit the source directly and dev-server will handle rebuilding the source and livereloading your sandbox after the build is done.
106110

107111
When you commit our pre-commit hook will run, which executes `lint-staged`. It will run the linter automatically and warn you if the code you've written doesn't comply with our code style guidelines.
108112

@@ -112,6 +116,10 @@ We have three different benchmarks: mounting a deep tree, mounting a wide tree a
112116

113117
To run the benchmarks run:
114118

119+
```sh
120+
cd packages/styled-components`
121+
```
122+
115123
```sh
116124
yarn run benchmarks
117125
```
@@ -139,42 +147,37 @@ a git hook is already present.
139147

140148
[Core team members](./CORE_TEAM.md) have the responsibility of pushing new releases to npm. The release process is as follows:
141149

142-
1. Install `np` by Sindre Sorhus with `npm i -g np`. (note: you only have to do this once) `np` makes sure that everything is correct and runs tests and a build before it releases the new version for you.
143-
2. Make sure you have the latest changes and are on the master branch: `git checkout master && git pull origin master`
150+
1. Make sure you have the latest changes and are on the master branch: `git checkout master && git pull origin master`
151+
2. Install all the dependecies by running `yarn` in the root folder. This will also install `lerna`.
144152
3. Create a new branch based on the version number, for example `git checkout -b 3.4.1`
145153
4. Update the [CHANGELOG.md](./CHANGELOG.md) with the new version number, add a new Unreleased section at the top and edit the links at the bottom so everything is linked correctly
146154
5. Commit the Changelog changes with `git commit -m 'Update CHANGELOG'`
147155
6. Push the branch to the repo with `git push -u origin <branchname>`
148-
7. Run `np --any-branch` and follow its instructions
156+
7. Run `yarn run publish`. (Not `yarn publish`) This will run `test` cases, check for `flow` and `lint` errors and then start the `lerna publish` process. You will prompted to choose the next versions for all the packages including `styled-components`. (Note: Packages which are marked as `private` will not be published to `npm`, choose any version for them).
149157
8. Congratulations, you just published a new release of `styled-components`! :tada: Let everybody know on Twitter, in our community and all the other places
150158

151159
## Credits
152160

153161
These contribution guidelines are based on https://github.com/moya/contributors, big thanks to @alloy, @orta et al. for the inspiration and guidance.
154162

155-
156163
## Financial contributions
157164

158165
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/styled-components).
159166
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
160167

161-
162168
## Credits
163169

164-
165170
### Contributors
166171

167172
Thank you to all the people who have already contributed to styled-components!
168173
<a href="graphs/contributors"><img src="https://opencollective.com/styled-components/contributors.svg?width=890" /></a>
169174

170-
171175
### Backers
172176

173177
Thank you to all our backers! [[Become a backer](https://opencollective.com/styled-components#backer)]
174178

175179
<a href="https://opencollective.com/styled-components#backers" target="_blank"><img src="https://opencollective.com/styled-components/backers.svg?width=890"></a>
176180

177-
178181
### Sponsors
179182

180183
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/styled-components#sponsor))

lerna.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"npmClient": "yarn",
3+
"packages": [
4+
"packages/*"
5+
],
6+
"useWorkspaces": true,
7+
"version": "independent"
8+
}

package.json

+27-104
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,32 @@
11
{
2-
"name": "styled-components",
2+
"name": "styled-components-project",
3+
"private": true,
34
"version": "4.1.3",
4-
"description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
5-
"main": "dist/styled-components.cjs.js",
6-
"jsnext:main": "dist/styled-components.esm.js",
7-
"module": "dist/styled-components.esm.js",
8-
"react-native": "native/dist/styled-components.native.cjs.js",
9-
"browser": {
10-
"./dist/styled-components.esm.js": "./dist/styled-components.browser.esm.js",
11-
"./dist/styled-components.cjs.js": "./dist/styled-components.browser.cjs.js"
12-
},
13-
"sideEffects": false,
14-
"scripts": {
15-
"build": "rollup -c",
16-
"prebuild": "rimraf dist",
5+
"scripts":{
6+
"bs": "lerna bootstrap",
7+
"build": "lerna run build --stream --parallel",
8+
"clean":"lerna clean",
9+
"dev": "lerna run dev --stream --parallel",
10+
"flow": "lerna run flow --stream --parallel",
11+
"lint": "lerna run lint --stream --parallel",
12+
"size": "lerna run size --stream --parallel",
1713
"test": "run-s test:*",
18-
"test:web": "jest",
19-
"test:web:watch": "npm run test:web -- --watch",
20-
"test:native": "jest -c .jest.native.json",
21-
"test:native:watch": "npm run test:native -- --watch",
22-
"test:primitives": "jest -c .jest.primitives.json",
23-
"test:primitives:watch": "npm run test:primitives -- --watch",
24-
"test:integration": "jest -c .jest.integration.json --runInBand --forceExit",
25-
"size": "bundlesize",
26-
"flow": "flow check",
27-
"flow:watch": "flow-watch",
28-
"format": "eslint ./**/*.js --fix",
29-
"lint": "eslint src",
30-
"prettier": "prettier */**/*.js --write",
31-
"prepublishOnly": "run-s build",
32-
"lint-staged": "lint-staged",
33-
"dev": "cross-env BABEL_ENV=cjs babel-node example/startServer.js",
34-
"prebenchmarks": "yarn run build:benchmarks",
35-
"benchmarks": "node benchmarks/run-headless.js",
36-
"build:benchmarks": "(cd benchmarks && yarn && yarn run build)",
37-
"postinstall": "node ./scripts/postinstall.js || exit 0"
38-
},
39-
"repository": {
40-
"type": "git",
41-
"url": "git+https://github.com/styled-components/styled-components.git"
14+
"prepublishOnly": "yarn clean && yarn && yarn build && yarn test && cp README.md packages/styled-components",
15+
"publish": "lerna publish",
16+
"test:web": "jest -c scripts/jest/config.main.js",
17+
"test:web:watch": "yarn test:web -- --watch",
18+
"test:native": "jest -c scripts/jest/config.native.js",
19+
"test:native:watch": "yarn test:native -- --watch",
20+
"test:primitives": "jest -c scripts/jest/config.primitives.js",
21+
"test:primitives:watch": "yarn test:primitives -- --watch",
22+
"test:integration": "jest -c scripts/jest/config.integration.js --runInBand --forceExit"
4223
},
43-
"files": [
44-
"CODE_OF_CONDUCT.md",
45-
"CONTRIBUTING.md",
46-
"dist",
47-
"native",
48-
"primitives",
49-
"scripts",
50-
"test-utils",
51-
"macro"
52-
],
53-
"keywords": [
54-
"react",
55-
"css",
56-
"css-in-js",
57-
"styled-components",
58-
"babel-macro",
59-
"babel-macros",
60-
"styling"
61-
],
6224
"author": "Glen Maddern",
6325
"license": "MIT",
6426
"bugs": {
6527
"url": "https://github.com/styled-components/styled-components/issues"
6628
},
6729
"homepage": "https://styled-components.com",
68-
"dependencies": {
69-
"@babel/helper-module-imports": "^7.0.0",
70-
"@emotion/is-prop-valid": "^0.7.3",
71-
"@emotion/unitless": "^0.7.0",
72-
"babel-plugin-styled-components": ">= 1",
73-
"css-to-react-native": "^2.2.2",
74-
"memoize-one": "^5.0.0",
75-
"prop-types": "^15.5.4",
76-
"react-is": "^16.6.0",
77-
"stylis": "^3.5.0",
78-
"stylis-rule-sheet": "^0.0.10",
79-
"supports-color": "^5.5.0"
80-
},
8130
"devDependencies": {
8231
"babel-cli": "^6.22.2",
8332
"babel-core": "^6.17.0",
@@ -108,18 +57,13 @@
10857
"jest": "^23.6.0",
10958
"jest-image-snapshot": "^2.7.0",
11059
"jest-styled-components": "^6.3.1",
60+
"lerna": "^3.10.5",
11161
"lint-staged": "^8.0.4",
11262
"node-watch": "^0.5.0",
11363
"npm-run-all": "^4.1.2",
11464
"prettier": "^1.15.2",
11565
"puppeteer": "^1.10.0",
11666
"raf": "^3.4.1",
117-
"react": "^16.6.1",
118-
"react-dom": "^16.6.1",
119-
"react-frame-component": "^4.0.2",
120-
"react-native": "^0.56.0",
121-
"react-primitives": "^0.6.1",
122-
"react-test-renderer": "^16.6.1",
12367
"rimraf": "^2.6.1",
12468
"rollup": "^0.66.5",
12569
"rollup-plugin-babel": "^3.0.4",
@@ -131,24 +75,13 @@
13175
"rollup-plugin-sourcemaps": "^0.4.2",
13276
"rollup-plugin-terser": "^3.0.0"
13377
},
134-
"peerDependencies": {
135-
"react": ">= 16.3.0",
136-
"react-dom": ">= 16.3.0"
137-
},
138-
"jest": {
139-
"testURL": "http://localhost",
140-
"clearMocks": true,
141-
"roots": [
142-
"<rootDir>/src/"
78+
"workspaces": {
79+
"packages": [
80+
"packages/*"
14381
],
144-
"setupFiles": [
145-
"raf/polyfill",
146-
"<rootDir>/src/test/globals.js"
147-
],
148-
"setupTestFrameworkScriptFile": "<rootDir>/test-utils/setupTestFramework.js",
149-
"testPathIgnorePatterns": [
150-
"<rootDir>/src/native",
151-
"<rootDir>/src/primitives"
82+
"nohoist": [
83+
"**/react-*",
84+
"**/react-*/**"
15285
]
15386
},
15487
"lint-staged": {
@@ -162,19 +95,9 @@
16295
"**/test/*.js"
16396
]
16497
},
165-
"bundlesize": [
166-
{
167-
"path": "./dist/styled-components.min.js",
168-
"maxSize": "16kB"
169-
}
170-
],
171-
"collective": {
172-
"type": "opencollective",
173-
"url": "https://opencollective.com/styled-components"
174-
},
17598
"husky": {
17699
"hooks": {
177-
"pre-commit": "flow check && lint-staged"
100+
"pre-commit": "yarn flow && lint-staged"
178101
}
179102
}
180103
}
File renamed without changes.
File renamed without changes.

sandbox/package.json packages/sandbox/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "sandbox",
3-
"version": "1.0.0",
3+
"version": "4.1.4-alpha.0",
44
"main": "server/index.js",
5+
"private": true,
56
"license": "MIT",
67
"scripts": {
78
"start": "cross-env NODE_ENV=development micro-dev --ignore=\"(src|.build)\""
File renamed without changes.
File renamed without changes.
File renamed without changes.

sandbox/server/webpack.config.js packages/sandbox/server/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const createPlugins = () => [
6262

6363
new webpack.DefinePlugin({
6464
// eslint-disable-next-line global-require
65-
__VERSION__: JSON.stringify(require('../../package.json').version),
65+
__VERSION__: JSON.stringify(require('../../styled-components/package.json').version),
6666
}),
6767
];
6868

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

0 commit comments

Comments
 (0)