Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas367 committed Dec 28, 2020
2 parents 496465e + 6f04f9e commit d1180f9
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules
/public/dist

package-lock.json
.env
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: node_js
node_js:
- 12.16.1
install:
- npm install
script:
- npm run build
deploy:
provider: heroku
api_key:
secure: W9q9s/yeiSdusYc+rtIRO093RDWoRktqdzIKqZ9xuuhXcJB2Ty6wW5mP6qn4vSUrnvgvllbtpiwW0hjyPB3cSspKJI3M8qunJJKkh91ve958GOVZt9KKNYrF8s/Wfo7MCGWg6EPCwGxAYMsZmkcfRxye+IhcQzTn6mykPK64CSOKABbkkGX50Cusw+kfiKZvfV0BA60l9LaLJx6VIpmNkZsYfd1Mv4R804KOn3diQf3J9z1n20heL0zxaevOIuNbWth0292KuvEpk7c9aGl2lS3MkD4jKaZD9v9hkdDDwgiE6O2B36HNKfXYn2NaE7C254m7TeBMt4mykNbJGkfQzEud5ZU2Bf9mpAiZQCqwUmLSoKtfEbg7X8wbkQAjuEpqPJPzITWsbzXPrf1voFN9G0cZ5IIU6Oqfev0Z0PB/iyjxqQQi7qknzIPTGGGUs+xOIrzkOWrGE0KRr1esxBlP7vIBSFMi2U6hu4SjZ740eHcncnIbUOdduh/WuszP97ICSTKte95ta/jjXj8JYSdTMC7owBdrgrho/3H6/cH9G7BJfKTsqTSjfv1Dhdj1cU5/6iaKHVX7Scw16HHil4dyYGobm3ISqfMFS6yGiHWsL+ySIzn0J8Cp7iYP8InTYUDRS3zqplKvNoB3Q3WeBp6OL7fXcDc6/+7pmYWV11m6cUo=
app: dev-connector-test
on:
branch: develop
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "nodedemo",
"version": "0.2.0",
"version": "1.0.0",
"description": "nodeDemo",
"main": "server.js",
"scripts": {
"build": "",
"start": "node src/server/server",
"build": "npm run build-styles && webpack --config ./webpack.config.prod.js --mode production",
"build-styles": "webpack --config ./webpack.config.styles.js",
"start": "node src/server/server.js",
"dev-client": "webpack-dev-server --config ./webpack.config.dev.js --mode development",
"dev-server": "nodemon src/server/server",
"dev": "concurrently \"npm run dev-server\" \"npm run dev-client\""
Expand All @@ -30,6 +31,7 @@
"axios": "^0.19.2",
"bcryptjs": "^2.4.3",
"classnames": "^2.2.6",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-validator": "^6.4.0",
"gravatar": "^1.8.0",
Expand All @@ -55,7 +57,6 @@
"clean-webpack-plugin": "^3.0.0",
"concurrently": "^5.1.0",
"css-loader": "^3.4.2",
"dotenv": "^8.2.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-airbnb-base": "^14.1.0",
Expand All @@ -66,11 +67,15 @@
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"file-loader": "^6.0.0",
"glob": "^7.1.6",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.13.1",
"nodemon": "^2.0.2",
"prettier": "^1.19.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<body>
<div id="root"></div>
<script src="./bundle.js"></script>
<script src="./dist/bundle.js"></script>
</body>

</html>
4 changes: 2 additions & 2 deletions src/client/app.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Register from 'client/components/auth/register/register.react';
import Dashboard from 'client/components/dashboard/dashboard.react';
import CreateProfile from 'client/components/profile/createOrUpdateProfile/createProfile.react';
import EditProfile from 'client/components/profile/createOrUpdateProfile/editProfile.react';
import AddExperienceProfile from 'client/components/profile/AddExperienceProfile/AddExperienceProfile.react';
import AddEducationProfile from 'client/components/profile/AddEducationProfile/AddEducationProfile.react';
import AddExperienceProfile from 'client/components/profile/addExperienceProfile/addExperienceProfile.react';
import AddEducationProfile from 'client/components/profile/addEducationProfile/addEducationProfile.react';
import PrivateRoute from 'client/components/routing/privateRoute.react';
import { Route, Switch } from 'react-router-dom';
import 'client/app.scss';
Expand Down
5 changes: 4 additions & 1 deletion src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ app.use(express.json({ extended: false }));

app.use('/api', routes);

app.use(express.static(__dirname));
app.use(express.static(path.join(__dirname, '../../public')));

app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, '../../public/index.html'));
res.sendFile(path.join(__dirname, '../../public', 'index.html'));
});

const PORT = process.env.PORT || 5000;
Expand Down
19 changes: 16 additions & 3 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './src/client/index.react.js',
Expand Down Expand Up @@ -57,8 +57,8 @@ module.exports = {
]
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['dist']
new HtmlWebpackPlugin({
template: './public/index.html'
})
],
devServer: {
Expand All @@ -69,5 +69,18 @@ module.exports = {
proxy: {
'/api/*': 'http://localhost:5000'
}
},
stats: {
modules: false,
usedExports: false,
children: false,
entrypoints: true,
maxModules: 0,
errors: true,
warnings: true,
moduleTrace: false,
errorDetails: false,
colors: true,
performance: false
}
};
81 changes: 81 additions & 0 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
entry: './src/client/index.react.js',
output: {
path: path.join(__dirname, '/public/dist'),
filename: 'bundle.js',
publicPath: '/'
},
resolve: {
modules: [
path.resolve(process.cwd(), 'src'),
path.resolve(process.cwd(), 'node_modules'),
path.resolve(process.cwd(), 'assets')
]
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader']
},
{
test: /\.[s]css$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[hash:base64:5]'
},
sourceMap: false
}
},
{
loader: 'sass-loader',
options: {
sourceMap: false
}
}
]
},
{
test: /\.png|jpg$/,
loader: 'file-loader',
options: {
outputPath: 'images/',
publicPath: '/dist/images'
}
}
]
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['dist']
}),
new UglifyJSPlugin()
],
stats: {
modules: false,
usedExports: false,
children: false,
entrypoints: true,
maxModules: 0,
errors: true,
warnings: true,
moduleTrace: false,
errorDetails: false,
colors: true,
performance: false
}
};
77 changes: 77 additions & 0 deletions webpack.config.styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const path = require('path');
const glob = require('glob');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
mode: 'production',
entry: glob.sync(path.resolve(process.cwd(), 'src/**/*.scss')),
output: {
path: path.join(__dirname, '/public/dist'),
filename: 'bundle.js'
},
resolve: {
modules: [
path.resolve(process.cwd(), 'src'),
path.resolve(process.cwd(), 'node_modules'),
path.resolve(process.cwd(), 'assets')
]
},
module: {
rules: [
{
test: /\.[s]css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[hash:base64:5]'
},
sourceMap: false
}
},
{
loader: 'sass-loader',
options: {
sourceMap: false
}
}
]
},
{
test: /\.png|jpg$/,
loader: 'file-loader',
options: {
outputPath: 'images/',
publicPath: '/dist/images'
}
}
]
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [path.join(__dirname, '/public/dist')],
cleanAfterEveryBuildPatterns: [path.join(__dirname, '/public/dist', 'bundle.js')]
}),
new UglifyJSPlugin(),
new MiniCssExtractPlugin({
filename: 'styles.css'
})
],
stats: {
modules: false,
usedExports: false,
children: false,
entrypoints: true,
maxModules: 0,
errors: true,
warnings: true,
moduleTrace: false,
errorDetails: false,
colors: true,
performance: false
}
};

0 comments on commit d1180f9

Please sign in to comment.