Bootstrapping repository for building a react app or component library
Clone this repository to a new directory that's named what you want your project to be
git clone [email protected]:msarchet/reactor <app>
Change the branch to master
git checkout -b master
Edit the project.json
to reflect your project.
Change the remote origin in git to point at your repository
git remote set-url origin <your-repo-url>
I'm trying to eliminate all the bike shedding I find myself doing when I want to start a new project. So I built this project as a heavily opinonated easy to use starting point for building new projects or for trying new things.
I'm open to pull requests against this repository, but it shouldn't replace anything, unless it's a direct improvement of a dependency
One command to do the builds, as well as dev server, linting. Lots of good stuff here
jest test runner
No reason to use anything else
enzyme test helpers
Removes much of the boiler plate for writing tests
sinon mocking
Very simple mocking with lots of functionality
CSS Modules just really make sense when you're writing components. Used via react-css-modules as it provides some patterns that make using css modules easier
src/
- Where the code lives
__tests__
- Where tests live (this is a jest convention, no need to change it)
src/index.js
- Main entry point
src/components
- Where all the components live
src/components/styles
- Where component styles live
src/compnents/styles/__mocks__
- Where mock styles live
Due to how CSS Modules works and the fact that Jest doesn't run webpack before testing, the css styles need to be mocked as a module.
/* main.css */
.main {
width: 100%;
height: 100%;
}
// __mocks__/main.css
module.exports = {
main: 'main'
}
Copyright (c) 2016 Michael Sarchet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.