You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2019. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+21-15
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ You can read more about the organizational strategy used in this app in [this Me
9
9
We incorporate an ESLint configuration and follow strictly the [AirBnb JS & JSX style guides](https://github.com/airbnb/javascript).
10
10
11
11
# What is Feature First?
12
-
In most projects and frameworks, files are organized in a File type first fashion. For example, your tests exist in a test folder, your styles in a styles folder. This boilerplate takes a different approach.
12
+
In most projects and frameworks, files are organized in a File type first fashion. For example, your tests exist in a test folder, your styles in a styles folder. This boilerplate takes a different approach.
13
13
14
14
We encourage encapsulation of features by asking that you organize each feature into a seperate folder (feature-first). In React, this means that your containers and components exist in their own folders, along with literally every other file that pertains to that one component. Your actions, reducers, tests, styles, and everything else are all internal to the component they represent. By decoupling your features from the rest of your app, you set yourself up to reuse your UI components in future projects. You can thank us later!
15
15
@@ -40,13 +40,16 @@ To try the example application out or to use the project, follow the instruction
40
40
41
41
npm run start
42
42
43
-
Development server should be running at http://localhost:8080/
43
+
Your app will be served at:http://0.0.0.0:1337/
44
44
45
-
4.**Make build**
45
+
## Deployment
46
+
In order to deploy the app, a demo express server setup has been included. If you peak inside the server folder, you will see an example setup. The public folder includes all of the files that are generated when running the: `npm run deploy` script. This includes the production minified bundle.js, index.html and an app folder that includes all image assets.
46
47
47
-
npm run build
48
+
The express server can be run with `npm run serve:bundle`. This will start a static express server and serve the generated assets, just like you would in production. A Procfile is included, that will run the node server on [Heroku](https://heroku.com) automatically if you push your project to Heroku after running the `npm run deploy` command.
48
49
49
-
### File Structure
50
+
NOTE: the deployment script will place all your generated assets in the `server/public` folder, where they can be served in production.
51
+
52
+
## File Structure
50
53
* Some files left out for brevity. Please reference the files in the [Scalable React Boilerplate](https://github.com/RyanCCollins/feature-first-react-boilerplate) project for an example of the file structure. The application will ultimately be in use in a production web application project and more info will be posted here when we have production level examples.
51
54
```
52
55
.
@@ -93,30 +96,31 @@ To try the example application out or to use the project, follow the instruction
93
96
94
97
## Scripts
95
98
-**npm run setup**
96
-
97
-
Installs the application's dependencies
99
+
+ Installs the application's dependencies
98
100
99
101
-**npm run test**
102
+
+ Runs unit tests
100
103
101
-
Runs unit tests
102
104
-**npm run test:watch**
105
+
+ Watches for changes to run unit tests
103
106
104
-
Watches for changes to run unit tests
105
107
-**npm run build**
108
+
+ Bundles the application
106
109
107
-
Bundles the application
108
110
-**npm run dev**
111
+
+ Starts webpack development server
109
112
110
-
Starts webpack development server
111
113
-**npm run lint**
114
+
+ Runs the linter
112
115
113
-
Runs the linter
114
116
-**npm run deploy**
117
+
+ Creates the production ready files within the `/server/public` folder
115
118
116
-
Creates the production ready files
117
119
-**npm run clean**
120
+
+ Removes the bundled code and the production ready files
118
121
119
-
Removes the bundled code and the production ready files
122
+
-**npm run serve:bundle**
123
+
+ Serve production assets from the `/server/public` folder.
120
124
121
125
## Generators
122
126
The boilerplate contains generators for easy project scaffolding. At the moment, the generator has the following scaffold generating commands built in:
@@ -155,7 +159,7 @@ where <type_of_component> is one of: component, container or page.
155
159
156
160
The generators use the same feature-first file organization as the rest of the project, encapsulating components within their own folder.
157
161
158
-
####**Gotchas**
162
+
### **Gotchas**
159
163
In order to get the import / export to work, the generator does some pattern matching of the comments in the files to place the new imports. Just don't delete the comments within the root level index.js file in each directory and things will work fine!
160
164
161
165
From `app/src/container/index.js` or `app/src/component/index.js`
@@ -226,6 +230,8 @@ which will pick up any file with the .test.js postfix and run it through Karma /
226
230
*[x] Add [Grommet](grommet.io) as an optional starter component library
227
231
*[x] Add Webpack stats plugin
228
232
*[x] Dogfood the project and iterate on suggestions
0 commit comments