Skip to content

Commit 8961cf2

Browse files
authored
Merge pull request #54 from neonexus/master
Updated Docker to use Node.js 16.14. Deps update.
2 parents e88251a + f3fdd48 commit 8961cf2

File tree

8 files changed

+123
-152
lines changed

8 files changed

+123
-152
lines changed

.dockerignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
node_modules
2+
config/local.js
23
.git
4+
.github
35
.gitignore
4-
config/local.js
5-
.tmp
66
.idea
7-
.github
87
.editorconfig
8+
.eslintignore
9+
.eslintrc
10+
.tmp
911

1012
README.md
1113
CHANGELOG.md

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## [v3.0.0-beta](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v2.0.0...v3.0.0-beta.6) (2022-04-05)
3+
## [v3.0.0-beta](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v2.0.0...v3.0.0-beta.7) (2022-04-13)
44

55
### Features
66

@@ -12,7 +12,7 @@
1212

1313
### Breaking Changes
1414

15-
* Updated to React v18. See: [the upgrade guid to React 18](https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html).
15+
* Updated to React v18. See: [the upgrade guide to React 18](https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html).
1616
* Updated to React Router DOM v6. See: [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5). This requires a **MAJOR** overhaul of how routes are handled.
1717
* Moved some controllers into a "common" folder, instead of the "admin" folder (as they could be used outside of admin controls).
1818

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:16.13
1+
FROM node:16.14
22
MAINTAINER NeoNexus DeMortis
33

44
RUN apt-get update && apt-get upgrade -y
@@ -7,7 +7,7 @@ RUN mkdir /var/www && mkdir /var/www/myapp
77
WORKDIR /var/www/myapp
88

99
EXPOSE 1337
10-
# REMEMBER! NEVER STORE SECRETS, DEK's, PASSWORDS, OR ANYTHING OF A SENSITIVE NATURE IN SOURCE CONTROL! USE ENVIRONMENT VARIABLES!
10+
# REMEMBER! NEVER STORE SECRETS, DEK's, PASSWORDS, OR ANYTHING OF A SENSITIVE NATURE IN SOURCE CONTROL (INCLUDING THIS FILE)! USE ENVIRONMENT VARIABLES!
1111
ENV PORT=1337 DB_HOSTNAME=localhost DB_USERNAME=root DB_PASSWORD=mypass DB_NAME=myapp DB_PORT=3306 DB_SSL=true DATA_ENCRYPTION_KEY=1234abcd4321asdf0987lkjh SESSION_SECRET=0987poiuqwer1234zxcvmnbv
1212

1313
# This keeps builds more efficient, because we can use Docker cache more effectively.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ The `master` branch is experimental, and the [release branch](https://github.com
1212
**FINAL WARNING: DO NOT RELY ON THE MASTER BRANCH!**
1313

1414
# v3.0.0-beta Warning
15-
Moving from v5 -> v6 of the [React Router](https://reactrouter.com/) is a serious undertaking (see the [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5)).
15+
Moving from v5 -> v6 of the [React Router](https://reactrouter.com/) is a serious undertaking (see [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5)).
1616

17-
While basic features have been upgraded to the new standard of the new React Router, there are still some quarks while developing... When the assets are built for remote use (`npm run build` or `npm run build:dev`), everything works as expected; however, when working with the auto-reloading Webpack dev server, if you don't start from a "root" path (like "/admin" or "/main"), and refresh a path like "/admin/dashboard", things will not render.
17+
While basic features have been upgraded to the new standard of the new React Router, there are still some quirks while developing... When the assets are built for remote use (`npm run build` or `npm run build:dev`), everything works as expected; however, when working with the auto-reloading Webpack dev server, if you don't start from a "root" path (like "/admin" or "/main"), and refresh a path like "/admin/dashboard", things will not render.
1818

1919
I'm still working on a fix for this.
2020

2121
If you would like to use v5 of React Router, make sure you are cloning [v2 of this repo](https://github.com/neonexus/sails-react-bootstrap-webpack/tree/v2.0.0).
2222

23-
## Currently setup with
23+
## Current Dependencies
2424
* [Sails](https://sailsjs.com/) **v1**
2525
* [React](https://reactjs.org/) **v18**
2626
* [React Router](https://reactrouter.com/) **v6**
@@ -36,10 +36,10 @@ See the [`package.json` for more details](package.json).
3636
+ Setup for Webpack auto-reload dev server.
3737
+ Setup so Sails will serve Webpack-built bundles as separate apps (so, a marketing site, and an admin site can live side-by-side).
3838
+ Includes [react-bootstrap](https://www.npmjs.com/package/react-bootstrap) to make using Bootstrap styles / features with React easier.
39-
+ Schema validation and enforcement for `PRODUCTION`. This repo is setup for `MySQL`. If you plan to use a different datastore, you will likely want to disable the schema validation and enforcement feature inside [`config/bootstrap.js`](config/bootstrap.js). See [schema validation and enforcement](#schema-validation-and-enforcement) for more info.
39+
+ Schema validation and enforcement for `PRODUCTION`. This repo is set up for `MySQL`. If you plan to use a different datastore, you will likely want to disable the schema validation and enforcement feature inside [`config/bootstrap.js`](config/bootstrap.js). See [schema validation and enforcement](#schema-validation-and-enforcement) for more info.
4040

4141
## How to Use
42-
This repo is not installable via `npm`. Instead, Github provides a handy "Use this template" (green) button at the top of this page. That will create a special fork of this repo (so there is a single, init commit, instead of the commit history from this repo).
42+
This repo is not installable via `npm`. Instead, GitHub provides a handy "Use this template" (green) button at the top of this page. That will create a special fork of this repo (so there is a single, init commit, instead of the commit history from this repo).
4343

4444
### Configuration
4545
In the `config` folder, there is the `local.js.sample` file, which is meant to be copied to `local.js`. This file (`local.js` not the sample) is ignored by Git, and intended for use in local development, NOT remote servers. Generally one would use environment variables for remote server configuration (and this repo is already setup to handle environment variable configuration for both DEV and PROD). See: [config/env/development.js](config/env/development.js) and [config/env/production.js](config/env/production.js).

config/routes.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
* https://sailsjs.com/anatomy/config/routes-js
99
*/
1010

11-
const defaultStaticOptions = {
12-
maxAge: process.env.NODE_ENV !== 'production' ? 1 : 31557600000, // in production, a little over a year in milliseconds
13-
extensions: ['html'],
14-
dotfiles: 'ignore',
15-
redirect: false // prevents redirecting "/main" to "/main/"
16-
};
17-
1811
const path = require('path');
1912
const fs = require('fs');
2013
const serveStatic = require('serve-static');
@@ -30,7 +23,12 @@ module.exports.routes = {
3023
'GET /*': { // default route used to auto switch React apps
3124
skipAssets: false,
3225
fn: [
33-
serveStatic(path.resolve(__dirname, '../.tmp/public/'), defaultStaticOptions),
26+
serveStatic(path.resolve(__dirname, '../.tmp/public/'), {
27+
maxAge: process.env.NODE_ENV !== 'production' ? 1 : 31557600000, // in production, a little over a year in milliseconds
28+
extensions: ['html'],
29+
dotfiles: 'ignore',
30+
redirect: false // prevents redirecting "/main" to "/main/"
31+
}),
3432
async (req, res) => {
3533
// This will determine which React app we need to serve.
3634
const parts = req.url.split('/');

0 commit comments

Comments
 (0)