提交 4aa2fdbb 编写于 作者: B Bhargav Ponnapalli

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

 - styled-components@4.1.4-alpha.2

Update prepublisOnly and contributing

Update gitignore

Publish

 - styled-components@4.1.4-alpha.3

Test without readme

Remove readme

Publish

 - styled-components@4.1.4-alpha.4

Copy readme prepublishOnly

Publish

 - styled-components@4.1.4-alpha.5
上级 8cf278bf
node_modules
dist
.DS_Store
bundle-stats.html
.vscode
__diff_output__
lib
sandbox/node_modules
*.log
test-results.json
mount-deep-tree-trace.json
mount-wide-tree-trace.json
update-dynamic-styles-trace.json
package-lock.json
\ No newline at end of file
{
"testRegex": "./integration-test/.*.js$",
"testURL": "http://localhost"
}
{
"rootDir": ".",
"testRegex": "./src/native/test/.*.js$",
"preset": "react-native",
"testURL": "http://localhost",
"testEnvironment": "jsdom"
}
{
"rootDir": ".",
"testRegex": "./src/primitives/test/.*.js$",
"moduleFileExtensions": ["ios.js", "js"],
"preset": "react-native",
"testURL": "http://localhost",
"testEnvironment": "jsdom"
}
......@@ -17,6 +17,9 @@ env:
node_js:
- '8'
- '10'
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
install: yarn --frozen-lockfile
script:
- node --version
......
......@@ -8,6 +8,8 @@ _The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
- Make the `GlobalStyleComponent` created by `createGlobalStyle` call the base constructor with `props` (see [#2321](https://github.com/styled-components/styled-components/pull/2321)).
- Move to Mono repository structure with lerna [@imbhargav5](https://github.com/imbhargav5) (see [#2326](https://github.com/styled-components/styled-components/pull/2326))
## [v4.1.3] - 2018-12-17
- 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))
......
......@@ -34,9 +34,9 @@ We want contributors to provide ideas, keep the ship shipping and to take some o
The fact that you'll have push access will allow you to:
* 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.
* Help triage issues, merge pull requests.
* Pick up the project if other maintainers move their focus elsewhere.
- 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.
- Help triage issues, merge pull requests.
- Pick up the project if other maintainers move their focus elsewhere.
It's up to you to use those superpowers or not though 😉
......@@ -62,47 +62,51 @@ Here is a quick guide to doing code contributions to the library.
3. Create a branch with a meaningful name for the issue: `git checkout -b fix-something`
4. Make your changes and commit: `git add` and `git commit`
4. Install packages by running `yarn` in the root of the project.
5. Make sure that the tests still pass: `npm test` and `npm run flow` (for the type checks)
5. Make your changes and commit: `git add` and `git commit`
6. Push your branch: `git push -u origin your-branch-name`
6. Make sure that the tests still pass: `yarn test` and `yarn run flow` (for the type checks)
7. Submit a pull request to the upstream styled-components repository.
7. Push your branch: `git push -u origin your-branch-name`
8. Choose a descriptive title and describe your changes briefly.
8. Submit a pull request to the upstream styled-components repository.
9. Wait for a maintainer to review your PR, make changes if it's being recommended, and get it merged.
9. Choose a descriptive title and describe your changes briefly.
10. Perform a celebratory dance! :dancer:
10. Wait for a maintainer to review your PR, make changes if it's being recommended, and get it merged.
11. Perform a celebratory dance! :dancer:
### How do I set up the project?
Run [`yarn install`](https://yarnpkg.com/) and edit code in the `src/` folder. It's luckily very simple! :wink:
Run [`yarn install`](https://yarnpkg.com/) and edit code in the `packages/styled-components/src/` folder. It's luckily very simple! :wink:
> We use yarn workspaces with [lerna](https://github.com/lerna/lerna) to make this work as a monorepo under the hood.
### How do I verify and test my changes?
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!
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!
To use the sandbox, follow these steps:
1. Go to sandbox folder: `cd sandbox`
1. Go to sandbox folder: `cd packages/sandbox`
2. Install all the dependencies: `yarn install` or `npm install`
2. Install all the dependencies: `yarn install`. Since this repository uses `yarn` workspaces, avoid using `npm` where you can.
3. Run `yarn start` or `npm start` to start sandbox server
3. Run `yarn start` to start sandbox server
Now you should have the sandbox running on `localhost:3000`. The Sandbox supports client-side and server-side rendering.
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:
* Root `<App>` component is located at `styled-components/sandbox/src/App.js` file
- Root `<App>` component is located at `packages/sandbox/src/App.js` file
* Client-side entry point is at `styled-components/sandbox/src/browser.js`
- Client-side entry point is at `packages/sandbox/src/browser.js`
* Server-side entry point is at `styled-components/sandbox/src/server.js`
- Server-side entry point is at `packages/sandbox/src/server.js`
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.
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.
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.
......@@ -112,6 +116,10 @@ We have three different benchmarks: mounting a deep tree, mounting a wide tree a
To run the benchmarks run:
```sh
cd packages/styled-components`
```
```sh
yarn run benchmarks
```
......@@ -139,42 +147,37 @@ a git hook is already present.
[Core team members](./CORE_TEAM.md) have the responsibility of pushing new releases to npm. The release process is as follows:
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.
2. Make sure you have the latest changes and are on the master branch: `git checkout master && git pull origin master`
1. Make sure you have the latest changes and are on the master branch: `git checkout master && git pull origin master`
2. Install all the dependecies by running `yarn` in the root folder. This will also install `lerna`.
3. Create a new branch based on the version number, for example `git checkout -b 3.4.1`
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
5. Commit the Changelog changes with `git commit -m 'Update CHANGELOG'`
6. Push the branch to the repo with `git push -u origin <branchname>`
7. Run `np --any-branch` and follow its instructions
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).
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
## Credits
These contribution guidelines are based on https://github.com/moya/contributors, big thanks to @alloy, @orta et al. for the inspiration and guidance.
## Financial contributions
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/styled-components).
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.
## Credits
### Contributors
Thank you to all the people who have already contributed to styled-components!
<a href="graphs/contributors"><img src="https://opencollective.com/styled-components/contributors.svg?width=890" /></a>
### Backers
Thank you to all our backers! [[Become a backer](https://opencollective.com/styled-components#backer)]
<a href="https://opencollective.com/styled-components#backers" target="_blank"><img src="https://opencollective.com/styled-components/backers.svg?width=890"></a>
### Sponsors
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))
......
{
"npmClient": "yarn",
"packages": [
"packages/*"
],
"useWorkspaces": true,
"version": "independent"
}
{
"name": "styled-components",
"name": "styled-components-project",
"private": true,
"version": "4.1.3",
"description": "Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress",
"main": "dist/styled-components.cjs.js",
"jsnext:main": "dist/styled-components.esm.js",
"module": "dist/styled-components.esm.js",
"react-native": "native/dist/styled-components.native.cjs.js",
"browser": {
"./dist/styled-components.esm.js": "./dist/styled-components.browser.esm.js",
"./dist/styled-components.cjs.js": "./dist/styled-components.browser.cjs.js"
},
"sideEffects": false,
"scripts": {
"build": "rollup -c",
"prebuild": "rimraf dist",
"scripts":{
"bs": "lerna bootstrap",
"build": "lerna run build --stream --parallel",
"clean":"lerna clean",
"dev": "lerna run dev --stream --parallel",
"flow": "lerna run flow --stream --parallel",
"lint": "lerna run lint --stream --parallel",
"size": "lerna run size --stream --parallel",
"test": "run-s test:*",
"test:web": "jest",
"test:web:watch": "npm run test:web -- --watch",
"test:native": "jest -c .jest.native.json",
"test:native:watch": "npm run test:native -- --watch",
"test:primitives": "jest -c .jest.primitives.json",
"test:primitives:watch": "npm run test:primitives -- --watch",
"test:integration": "jest -c .jest.integration.json --runInBand --forceExit",
"size": "bundlesize",
"flow": "flow check",
"flow:watch": "flow-watch",
"format": "eslint ./**/*.js --fix",
"lint": "eslint src",
"prettier": "prettier */**/*.js --write",
"prepublishOnly": "run-s build",
"lint-staged": "lint-staged",
"dev": "cross-env BABEL_ENV=cjs babel-node example/startServer.js",
"prebenchmarks": "yarn run build:benchmarks",
"benchmarks": "node benchmarks/run-headless.js",
"build:benchmarks": "(cd benchmarks && yarn && yarn run build)",
"postinstall": "node ./scripts/postinstall.js || exit 0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/styled-components/styled-components.git"
"prepublishOnly": "yarn clean && yarn && yarn build && yarn test && cp README.md packages/styled-components",
"publish": "lerna publish",
"test:web": "jest -c scripts/jest/config.main.js",
"test:web:watch": "yarn test:web -- --watch",
"test:native": "jest -c scripts/jest/config.native.js",
"test:native:watch": "yarn test:native -- --watch",
"test:primitives": "jest -c scripts/jest/config.primitives.js",
"test:primitives:watch": "yarn test:primitives -- --watch",
"test:integration": "jest -c scripts/jest/config.integration.js --runInBand --forceExit"
},
"files": [
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"dist",
"native",
"primitives",
"scripts",
"test-utils",
"macro"
],
"keywords": [
"react",
"css",
"css-in-js",
"styled-components",
"babel-macro",
"babel-macros",
"styling"
],
"author": "Glen Maddern",
"license": "MIT",
"bugs": {
"url": "https://github.com/styled-components/styled-components/issues"
},
"homepage": "https://styled-components.com",
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@emotion/is-prop-valid": "^0.7.3",
"@emotion/unitless": "^0.7.0",
"babel-plugin-styled-components": ">= 1",
"css-to-react-native": "^2.2.2",
"memoize-one": "^5.0.0",
"prop-types": "^15.5.4",
"react-is": "^16.6.0",
"stylis": "^3.5.0",
"stylis-rule-sheet": "^0.0.10",
"supports-color": "^5.5.0"
},
"devDependencies": {
"babel-cli": "^6.22.2",
"babel-core": "^6.17.0",
......@@ -108,18 +57,13 @@
"jest": "^23.6.0",
"jest-image-snapshot": "^2.7.0",
"jest-styled-components": "^6.3.1",
"lerna": "^3.10.5",
"lint-staged": "^8.0.4",
"node-watch": "^0.5.0",
"npm-run-all": "^4.1.2",
"prettier": "^1.15.2",
"puppeteer": "^1.10.0",
"raf": "^3.4.1",
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-frame-component": "^4.0.2",
"react-native": "^0.56.0",
"react-primitives": "^0.6.1",
"react-test-renderer": "^16.6.1",
"rimraf": "^2.6.1",
"rollup": "^0.66.5",
"rollup-plugin-babel": "^3.0.4",
......@@ -131,24 +75,13 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^3.0.0"
},
"peerDependencies": {
"react": ">= 16.3.0",
"react-dom": ">= 16.3.0"
},
"jest": {
"testURL": "http://localhost",
"clearMocks": true,
"roots": [
"<rootDir>/src/"
"workspaces": {
"packages": [
"packages/*"
],
"setupFiles": [
"raf/polyfill",
"<rootDir>/src/test/globals.js"
],
"setupTestFrameworkScriptFile": "<rootDir>/test-utils/setupTestFramework.js",
"testPathIgnorePatterns": [
"<rootDir>/src/native",
"<rootDir>/src/primitives"
"nohoist": [
"**/react-*",
"**/react-*/**"
]
},
"lint-staged": {
......@@ -162,19 +95,9 @@
"**/test/*.js"
]
},
"bundlesize": [
{
"path": "./dist/styled-components.min.js",
"maxSize": "16kB"
}
],
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/styled-components"
},
"husky": {
"hooks": {
"pre-commit": "flow check && lint-staged"
"pre-commit": "yarn flow && lint-staged"
}
}
}
{
"name": "sandbox",
"version": "1.0.0",
"version": "4.1.4-alpha.0",
"main": "server/index.js",
"private": true,
"license": "MIT",
"scripts": {
"start": "cross-env NODE_ENV=development micro-dev --ignore=\"(src|.build)\""
......
......@@ -62,7 +62,7 @@ const createPlugins = () => [
new webpack.DefinePlugin({
// eslint-disable-next-line global-require
__VERSION__: JSON.stringify(require('../../package.json').version),
__VERSION__: JSON.stringify(require('../../styled-components/package.json').version),
}),
];
......
......@@ -10,7 +10,7 @@ const SANDBOX_PATHS = {
appSrc: path.resolve(__dirname, 'src'),
serverApp: path.resolve(__dirname, 'src', 'server.js'),
clientApp: path.resolve(__dirname, 'src', 'browser.js'),
styledComponentsSrc: path.resolve(__dirname, '..', 'src'),
styledComponentsSrc: path.resolve(__dirname, '../styled-components', 'src'),
reactDOM: path.resolve(__dirname, 'node_modules', 'react-dom'),
indexHtml: path.resolve(__dirname, 'public', 'index.html'),
// build
......
node_modules
dist
.DS_Store
bundle-stats.html
.vscode
__diff_output__
lib
sandbox/node_modules
*.log
test-results.json
mount-deep-tree-trace.json
mount-wide-tree-trace.json
update-dynamic-styles-trace.json
package-lock.json
README.md
\ No newline at end of file