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
Updated request logger feature to use new .bigint(), since .hrtime() is deprecated. Various improvements to QOL (including a few more comments). Updated Bootstrap version; MANY breaking changes (see: https://react-bootstrap.github.io/migrating/). Added Github CodeQL config. Built a couple more tests.
This changelog is incomplete, as it was not started until **v2** (and rehashing that far back in the past is a lot of work for very little gain). I've gone as far back as this template became "popular" (people other than me began to clone it).
* Updated to Bootstrap v5. There are several **breaking changes** between [Bootstrap v4](https://getbootstrap.com/docs/4.6) and [Bootstrap v5](https://getbootstrap.com/docs/5.1), see the [migration documentation](https://getbootstrap.com/docs/5.1/migration/) for the complete list of breaking changes.
10
+
* Updated all dependencies to most recent versions.
Copy file name to clipboardExpand all lines: README.md
+12-8
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# sails-react-bootstrap-webpack
2
2
3
-
This is an opinionated base [Sails v1](https://sailsjs.com) application, using Webpack to handle Bootstrap (SASS) and React builds. It is designed such that, one can build multiple React frontends (an admin panel, and a customer site maybe), that use the same API backend. This allows developers to easily share React components across different frontends / applications. Also, because the backend and frontend are in the same repo (and the frontend is compiled before it is handed to the end user), they can share NPM libraries, like [Moment.js](https://momentjs.com)
3
+
This is an opinionated base [Sails v1](https://sailsjs.com) application, using [Webpack](https://webpack.js.org) to handle [Bootstrap](https://getbootstrap.com) (using [SASS](https://sass-lang.com)) and [React](https://reactjs.org) builds. It is designed such that, one can build multiple React frontends (an admin panel, and a customer site maybe), that use the same API backend. This allows developers to easily share React components across different frontends / applications. Also, because the backend and frontend are in the same repo (and the frontend is compiled before it is handed to the end user), they can share [NPM](http://npmjs.com) libraries, like [Moment.js](https://momentjs.com)
4
4
5
5
Need help? Want to hire me to build your next app or prototype? You can contact me any time via Gitter: [](https://gitter.im/sails-react-bootstrap-webpack/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
6
@@ -13,7 +13,7 @@ The `master` branch is experimental, and the [release branch](https://github.com
13
13
14
14
## Main Features
15
15
16
-
+ Automatic (incoming) request logging, via Sails models / hooks.
+ Setup so Sails will serve Webpack-built bundles as separate apps (so, a marketing site, and an admin site can live side-by-side).
19
19
+ Includes [react-bootstrap](https://www.npmjs.com/package/react-bootstrap) to make using Bootstrap styles / features with React easier.
@@ -62,25 +62,25 @@ Automatic incoming request logging, is a 2 part process. First, the [`request-lo
62
62
63
63
## Using Webpack
64
64
#### Local Dev
65
-
The script `npm run open:client` will start the auto-reloading Webpack development server, and open a browser window.
65
+
The script `npm run open:client` will start the auto-reloading Webpack development server, and open a browser window. When you save changes to assets (React files mainly), it will auto-compile the update, then refresh the browser automatically.
66
66
67
67
#### Remote Builds
68
68
The script `npm run build` will make Webpack build all the proper assets into the `.tmp/public` folder. Sails will serve assets from this folder.
69
69
70
70
If you want to build assets, but retain spaces / tabs for debugging, you can use `npm run build:dev`.
71
71
72
72
#### Configuration
73
-
The webpack configuration can be found in the `webpack` folder. The majority of the configuration can be found in [`common.config.js`](webpack/common.config.js). Then, the other 3 files, such as [`dev.config.js`](webpack/dev.config.js) extend the `common.config.js` file.
73
+
The webpack configuration can be found in the [`webpack`](webpack) folder. The majority of the configuration can be found in [`common.config.js`](webpack/common.config.js). Then, the other 3 files, such as [`dev.config.js`](webpack/dev.config.js) extend the `common.config.js` file.
74
74
75
75
## Building with React
76
76
React source files live in the `assets/src` folder. It is structured in such a way, where the `index.jsx` is really only used for local development (to help Webpack serve up the correct "app"). Then, there are the individual "apps", [main](assets/src/main.jsx) and [admin](assets/src/admin.jsx). These files are used as Webpack "[entry points](https://webpack.js.org/concepts/entry-points/)", to create 2 separate application bundles.
77
77
78
-
In a remote environment, Sails will look at the first subdirectory requested, and use that to determine which `index.html` file it needs to actually return. So, in this case, the "main" application will get built in `.tmp/public/main`, where the CSS is `.tmp/public/main/bundle.css`, the JavaScript is `.tmp/public/main/bundle.js`, and the HTML is `.tmp/public/main/index.html`. To view the main application, one would just go to `http://mydomain/` which gets redirected to `/main` (because we need to know what application we are using, we need a subdirectory), and now Sails will serve the `main` application. Whereas, if one were to go to `http://mydomain/admin`, Sails would now serve the `admin` application bundle (aka `.tmp/public/admin/index.html`).
78
+
In a remote environment, Sails will look at the first subdirectory requested, and use that to determine which `index.html` file it needs to actually return. So, in this case, the "main" application will get built in `.tmp/public/main`, where the CSS is `.tmp/public/main/bundle.css`, the JavaScript is `.tmp/public/main/bundle.js`, and the HTML is `.tmp/public/main/index.html`. To view the main application, one would just go to `http://mydomain/` which gets redirected to `/main` (because we need to know what application we are using, we need a subdirectory), and now Sails will serve the `main` application. Whereas, if one were to go to `http://mydomain/admin`, Sails would now serve the `admin` application bundle (aka `.tmp/public/admin/index.html`, `.tmp/public/admin/bundle.css`, etc...).
79
79
80
80
## Schema Validation and Enforcement
81
-
Inside [`config/bootstrap.js`](config/bootstrap.js) is a bit of logic (**HEAVILY ROOTED IN NATIVE `MySQL` QUERIES**), which validates column types in the `PRODUCTION` database (aka `sails.config.models.migrate === 'safe'`), then will validate foreign key indexes. If there are too many columns, or there is a missing index, or incorrect column type, the logic will `console.error` any issues, then `process.exit(1)` (kill) the Sails server. The idea here, is that if anything is out of alignment, Sails will fail to lift, which will mean failure to deploy on AWS.
81
+
Inside [`config/bootstrap.js`](config/bootstrap.js) is a bit of logic (**HEAVILY ROOTED IN NATIVE `MySQL` QUERIES**), which validates column types in the `PRODUCTION` database (aka `sails.config.models.migrate === 'safe'`), then will validate foreign key indexes. If there are too many columns, or there is a missing index, or incorrect column type, the logic will `console.error` any issues, then `process.exit(1)` (kill) the Sails server. The idea here, is that if anything is out of alignment, Sails will fail to lift, which will mean failure to deploy on PRODUCTION, preventing accidental, invalid live deployments; a final safety net if you will.
82
82
83
-
### If you do not want schema validation
83
+
### If you DO NOT want schema validation
84
84
... then you have 2 options:
85
85
* Set `sails.config.models.validateOnBootstrap = false` at the bottom of [`config/models.js`](config/models.js).
86
86
* OR replace the contents of `config/bootstrap.js` with the following:
@@ -102,7 +102,9 @@ middleware: {
102
102
'cookieParser',
103
103
'session',
104
104
'bodyParser',
105
-
'prerender', // reference our custom middleware found below
105
+
'prerender', // reference our custom middleware found below;
106
+
// we run this before compression and routing,
107
+
// because it is a proxy, saving time a resources
106
108
'compress',
107
109
'router',
108
110
'assetLog',
@@ -132,7 +134,9 @@ This app was originally generated on Fri Mar 20 2020 17:39:04 GMT-0500 (Central
132
134
133
135
<!-- Internally, Sails used [`sails-generate@1.16.13`](https://github.com/balderdashy/sails-generate/tree/v1.16.13/lib/core-generators/new). -->
134
136
137
+
#### Code Coverage
135
138
139
+
The current code coverage [can be viewed here](https://htmlpreview.github.io/?https://github.com/neonexus/sails-react-bootstrap-webpack/blob/release/test/coverage/index.html).
136
140
137
141
<!--
138
142
Note: Generators are usually run using the globally-installed `sails` CLI (command-line interface). This CLI version is _environment-specific_ rather than app-specific, thus over time, as a project's dependencies are upgraded or the project is worked on by different developers on different computers using different versions of Node.js, the Sails dependency in its package.json file may differ from the globally-installed Sails CLI release it was originally generated with. (Be sure to always check out the relevant [upgrading guides](https://sailsjs.com/upgrading) before upgrading the version of Sails used by your app. If you're stuck, [get help here](https://sailsjs.com/support).)
0 commit comments