Skip to content

Commit 564e350

Browse files
committed
Initial commit
0 parents  commit 564e350

29 files changed

+20911
-0
lines changed

.babelrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": ["env"],
3+
"plugins": [
4+
"transform-object-rest-spread",
5+
"transform-react-jsx"
6+
]
7+
}

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# dependencies
2+
node_modules
3+
4+
# builds
5+
dist
6+
.rpt2_cache
7+
8+
# misc
9+
.DS_Store
10+
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src
2+
testbed
3+
.babelrc
4+
webpack.config.js

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# react-jetpack
2+
3+
> An opinionated toolkit for efficient React.js development
4+
5+
[![NPM](https://img.shields.io/npm/v/react-jetpack.svg)](https://www.npmjs.com/package/react-jetpack) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6+
7+
## Install
8+
9+
```bash
10+
npm install --save react-jetpack
11+
```
12+
13+
## License
14+
15+
MIT

package-lock.json

+6,543
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "react-jetpack",
3+
"version": "1.0.0-alpha.1",
4+
"description": "An opinionated toolkit for efficient React.js development",
5+
"main": "./",
6+
"source": "src/",
7+
"author": "thinkholic",
8+
"license": "MIT",
9+
"scripts": {
10+
"setup": "npm install && cd testbed/ && npm install",
11+
"build": "npm run build:webpack && npm run copy:assets && npm run symlink",
12+
"build:webpack": "webpack",
13+
"copy:assets": "cp package.json README.md dist/",
14+
"symlink": "cd dist/ && npm link && cd .. && cd testbed/ && npm link react-jetpack",
15+
"start": "concurrently \"npm run build:webpack:watch\" \"cd testbed/ && npm start\"",
16+
"build:webpack:watch": "webpack --watch"
17+
},
18+
"peerDependencies": {
19+
"react": "^16.0.0",
20+
"react-dom": "^16.0.0"
21+
},
22+
"devDependencies": {
23+
"babel-cli": "^6.26.0",
24+
"babel-core": "^6.21.0",
25+
"babel-loader": "^7.1.4",
26+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
27+
"babel-plugin-transform-react-jsx": "^6.24.1",
28+
"babel-preset-env": "^1.6.1",
29+
"concurrently": "^5.3.0",
30+
"path": "^0.12.7",
31+
"react": "^16.0.0",
32+
"react-dom": "^16.0.0",
33+
"webpack": "^4.5.0",
34+
"webpack-cli": "^3.2.1"
35+
},
36+
"files": [
37+
"dist"
38+
]
39+
}

src/index.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import utilsHandler from './utils';
3+
4+
const DummyComponent = () => {
5+
return (<p>Hello!</p>)
6+
}
7+
8+
export const utils = utilsHandler;
9+
10+
export default DummyComponent;

src/utils/createContext.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, { useReducer } from 'react'
2+
3+
export default (reducer = () => {}, actions = {}, initialState) => {
4+
const Context = React.createContext()
5+
6+
const Provider = ({ children }) => {
7+
const [state, dispatch] = useReducer(reducer, initialState)
8+
9+
const boundActions = {}
10+
for (const key in actions) {
11+
boundActions[key] = actions[key](dispatch)
12+
}
13+
14+
return (
15+
<Context.Provider value={{ state, ...boundActions }}>
16+
{children}
17+
</Context.Provider>
18+
)
19+
}
20+
21+
return { Context, Provider }
22+
}

src/utils/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import createContextHandler from './createContext';
2+
3+
export const createContext = createContextHandler;

testbed/.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

testbed/.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

testbed/README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br />
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
Launches the test runner in the interactive watch mode.<br />
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br />
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `npm run eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `npm run build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

0 commit comments

Comments
 (0)