Skip to content

Commit 6ad119e

Browse files
author
Kent C. Dodds
committed
get things ready for workshopping
1 parent bbba94c commit 6ad119e

26 files changed

+4970
-18
lines changed

.all-contributorsrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"projectName": "advanced-component-patterns-v2",
3+
"projectOwner": "kentcdodds",
4+
"repoType": "github",
5+
"files": [
6+
"README.md"
7+
],
8+
"imageSize": 100,
9+
"commit": false,
10+
"contributors": [
11+
{
12+
"login": "kentcdodds",
13+
"name": "Kent C. Dodds",
14+
"avatar_url": "https://avatars.githubusercontent.com/u/1500684?v=3",
15+
"profile": "https://kentcdodds.com",
16+
"contributions": [
17+
"code",
18+
"doc",
19+
"infra",
20+
"test"
21+
]
22+
}
23+
]
24+
}

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
language: node_js
3+
node_js: 8
4+
install: echo "Installation happens in the setup script"
5+
cache:
6+
directories:
7+
- node_modules
8+
notifications:
9+
email: false
10+
branches:
11+
only:
12+
- master
13+
script:
14+
- npm run setup
15+
after_success:
16+
- npx codecov

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contributing
2+
3+
Thanks for being willing to contribute!
4+
5+
**Working on your first Pull Request?** You can learn how from this _free_ series
6+
[How to Contribute to an Open Source Project on GitHub][egghead]
7+
8+
## Project setup
9+
10+
1. Fork and clone the repo
11+
2. Run `npm run setup -s` to install dependencies and run validation
12+
3. Create a branch for your PR with `git checkout -b pr/your-branch-name`
13+
14+
> Tip: Keep your `master` branch pointing at the original repository and make
15+
> pull requests from branches on your fork. To do this, run:
16+
>
17+
> ```
18+
> git remote add upstream https://github.com/kentcdodds/advanced-component-patterns-v2.git
19+
> git fetch upstream
20+
> git branch --set-upstream-to=upstream/master master
21+
> ```
22+
>
23+
> This will add the original repository as a "remote" called "upstream,"
24+
> Then fetch the git information from that remote, then set your local `master`
25+
> branch to use the upstream master branch whenever you run `git pull`.
26+
> Then you can make all of your pull request branches based on this `master`
27+
> branch. Whenever you want to update your version of `master`, do a regular
28+
> `git pull`.
29+
30+
## Add yourself as a contributor
31+
32+
This project follows the [all contributors][all-contributors] specification.
33+
To add yourself to the table of contributors on the `README.md`, please use the
34+
automated script as part of your PR:
35+
36+
```console
37+
npm run contributors:add
38+
```
39+
40+
Follow the prompt and commit `.all-contributorsrc` and `README.md` in the PR.
41+
If you've already added yourself to the list and are making
42+
a new type of contribution, you can run it again and select the added
43+
contribution type.
44+
45+
Next you'll need to regenerate the table:
46+
47+
```console
48+
npm run contributors:generate
49+
```
50+
51+
## Committing and Pushing changes
52+
53+
Please make sure to run the tests before you commit your changes. You can run
54+
`npm run test:update` which will update any snapshots that need updating.
55+
Make sure to include those changes (if they exist) in your commit.
56+
57+
## Help needed
58+
59+
Please checkout the [the open issues][issues]
60+
61+
Also, please watch the repo and respond to questions/bug reports/feature
62+
requests! Thanks!
63+
64+
[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
65+
[all-contributors]: https://github.com/kentcdodds/all-contributors
66+
[issues]: https://github.com/kentcdodds/advanced-component-patterns-v2/issues

README.md

Lines changed: 167 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,167 @@
1-
# Advance React Patterns v2
2-
3-
### Patterns 🔥🔥🔥🔥🔥
4-
1. [Compound Component](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F02.js)
5-
2. [Flexible Compound Components with context](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F03.js)
6-
3. [render props](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F04.js)
7-
4. [prop collections](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F05.js)
8-
5. [Prop getters](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F06.js)
9-
6. [State Initializers](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F07.js)
10-
7. [State Reducer](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F08.js)
11-
8. [state reducer with types](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F09.js)
12-
9. [Control Props](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F10-primer.js)
13-
10. [Control Props + with a state reducer](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F10.js)
14-
11. [Provider Pattern](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F11.js)
15-
12. [Higher Order Components](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F12.js)
16-
13. [Rendux](https://codesandbox.io/embed/github/kentcdodds/advanced-react-patterns-v2/tree/master/?module=%2Fsrc%2Fexercises-final%2F13.js)
1+
# Advanced React Patterns v2
2+
3+
👋 hi there! My name is [Kent C. Dodds](https://kentcdodds.com)! This is a
4+
workshop repo to teach you about using React Component Patterns to make your
5+
react components more useful and reusable without sacrificing simplicity.
6+
7+
[![chat-badge][chat-badge]][chat]
8+
[![Build Status][build-badge]][build]
9+
[![AppVeyor Build Status][win-build-badge]][win-build]
10+
[![Code Coverage][coverage-badge]][coverage]
11+
[![MIT License][license-badge]][license]
12+
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
13+
14+
[![PRs Welcome][prs-badge]][prs]
15+
[![Code of Conduct][coc-badge]][coc]
16+
[![Watch on GitHub][github-watch-badge]][github-watch]
17+
[![Star on GitHub][github-star-badge]][github-star]
18+
[![Tweet][twitter-badge]][twitter]
19+
20+
## System Requirements
21+
22+
* [git][git] v2.14.1 or greater
23+
* [NodeJS][node] v8.9.4 or greater
24+
* [npm][npm] v5.6.0 or greater
25+
26+
All of these must be available in your `PATH`. To verify things are set up
27+
properly, you can run this:
28+
29+
```
30+
git --version
31+
node --version
32+
npm --version
33+
```
34+
35+
If you have trouble with any of these, learn more about the PATH environment
36+
variable and how to fix it here for [windows][win-path] or
37+
[mac/linux][mac-path].
38+
39+
## Setup
40+
41+
You may be able to work through the entire workshop in the browser. Go to
42+
[this codesandbox](https://codesandbox.io/s/github/kentcdodds/advanced-react-patterns-v2)
43+
and you should be good to go.
44+
45+
If you'd rather be able to work through the workshop on your own computer, then
46+
follow the following instructions.
47+
48+
After you've made sure to have the correct things (and versions) installed, you
49+
should be able to just run a few commands to get set up:
50+
51+
```
52+
git clone https://github.com/kentcdodds/advanced-react-patterns-v2.git
53+
cd advanced-react-patterns-v2
54+
npm run setup --silent
55+
```
56+
57+
This may take a few minutes. **It will ask you for your email.** This is
58+
optional and just automatically adds your email to the links in the project to
59+
make filling out some forms easier If you get any errors, please read through
60+
them and see if you can find out what the problem is. You may also want to look
61+
at [Troubleshooting](#troubleshooting). If you can't work it out on your own
62+
then please [file an issue][issue] and provide _all_ the output from the
63+
commands you ran (even if it's a lot).
64+
65+
## Running the app
66+
67+
To get the app up and running (and really see if it worked), run:
68+
69+
```shell
70+
npm start
71+
```
72+
73+
This should start up your browser. If you're familiar, this is a standard
74+
[react-scripts](https://github.com/facebook/create-react-app) application.
75+
76+
## Running the tests
77+
78+
```shell
79+
npm test
80+
```
81+
82+
This will start [Jest](http://facebook.github.io/jest) in watch mode. Read the
83+
output and play around with it.
84+
85+
**Your goal will be to go into each test, swap the final version for the
86+
exercise version in the import, and make the tests pass**
87+
88+
## Troubleshooting
89+
90+
<details>
91+
92+
<summary>"npm run setup" command not working</summary>
93+
94+
Here's what the setup script does. If it fails, try doing each of these things
95+
individually yourself:
96+
97+
```
98+
# verify your environment will work with the project
99+
node ./scripts/verify
100+
101+
# install dependencies
102+
npm install
103+
104+
# verify the project is ready to run
105+
npm run build
106+
npm run test:coverage
107+
```
108+
109+
If any of those scripts fail, please try to work out what went wrong by the
110+
error message you get. If you still can't work it out, feel free to
111+
[open an issue][issue] with _all_ the output from that script. I will try to
112+
help if I can.
113+
114+
</details>
115+
116+
## Contributors
117+
118+
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
119+
120+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
121+
122+
<!-- prettier-ignore -->
123+
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/advanced-component-patterns-v2/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/advanced-component-patterns-v2/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/advanced-component-patterns-v2/commits?author=kentcdodds "Tests") |
124+
| :---: |
125+
126+
<!-- ALL-CONTRIBUTORS-LIST:END -->
127+
128+
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
129+
130+
## License
131+
132+
This material is available for private, non-commercial use under the
133+
[GPL version 3](http://www.gnu.org/licenses/gpl-3.0-standalone.html). If you
134+
would like to use this material to conduct your own workshop, please contact me
135+
136+
137+
[npm]: https://www.npmjs.com/
138+
[node]: https://nodejs.org
139+
[git]: https://git-scm.com/
140+
[chat]: https://gitter.im/kentcdodds/advanced-react-patterns-v2
141+
[chat-badge]: https://img.shields.io/gitter/room/kentcdodds/advanced-react-patterns-v2.js.svg?style=flat-square&logo=gitter-white
142+
[build-badge]: https://img.shields.io/travis/kentcdodds/advanced-react-patterns-v2.svg?style=flat-square&logo=travis
143+
[build]: https://travis-ci.org/kentcdodds/advanced-react-patterns-v2
144+
[license-badge]: https://img.shields.io/badge/license-GPL%203.0%20License-blue.svg?style=flat-square
145+
[license]: https://github.com/kentcdodds/advanced-react-patterns-v2/blob/master/README.md#license
146+
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
147+
[prs]: http://makeapullrequest.com
148+
[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
149+
[donate]: http://kcd.im/donate
150+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
151+
[coc]: https://github.com/kentcdodds/advanced-react-patterns-v2/blob/master/CODE_OF_CONDUCT.md
152+
[github-watch-badge]: https://img.shields.io/github/watchers/kentcdodds/advanced-react-patterns-v2.svg?style=social
153+
[github-watch]: https://github.com/kentcdodds/advanced-react-patterns-v2/watchers
154+
[github-star-badge]: https://img.shields.io/github/stars/kentcdodds/advanced-react-patterns-v2.svg?style=social
155+
[github-star]: https://github.com/kentcdodds/advanced-react-patterns-v2/stargazers
156+
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20advanced-react-patterns-v2%20by%20@kentcdodds%20https://github.com/kentcdodds/advanced-react-patterns-v2%20%F0%9F%91%8D
157+
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/kentcdodds/advanced-react-patterns-v2.svg?style=social
158+
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
159+
[all-contributors]: https://github.com/kentcdodds/all-contributors
160+
[win-path]: https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/
161+
[mac-path]: http://stackoverflow.com/a/24322978/971592
162+
[issue]: https://github.com/kentcdodds/advanced-react-patterns-v2/issues/new
163+
[win-build-badge]: https://img.shields.io/appveyor/ci/kentcdodds/advanced-react-patterns-v2.svg?style=flat-square&logo=appveyor
164+
[win-build]: https://ci.appveyor.com/project/kentcdodds/advanced-react-patterns-v2
165+
[coverage-badge]: https://img.shields.io/codecov/c/github/kentcdodds/advanced-react-patterns-v2.svg?style=flat-square
166+
[coverage]: https://codecov.io/github/kentcdodds/advanced-react-patterns-v2
167+
[watchman]: https://facebook.github.io/watchman/docs/install.html

appveyor.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
environment:
2+
matrix:
3+
- node_version: "8"
4+
5+
branches:
6+
only:
7+
- master
8+
9+
install:
10+
- ps: Install-Product node $env:node_version
11+
12+
test_script:
13+
- node ./scripts/make-appveyor-work.js
14+
- npm run setup
15+
16+
cache:
17+
- ./node_modules -> package.json
18+
19+
build: off

0 commit comments

Comments
 (0)