Skip to content

Commit b2d38ae

Browse files
author
Bogdan Olteanu
committed
Updated libraries
1 parent f797dc3 commit b2d38ae

12 files changed

+4441
-3366
lines changed

build_scripts/build-production.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/* eslint-disable no-console */
2-
import webpack from 'webpack';
3-
import chalk from 'chalk';
4-
import webpackConfig from '../webpack.config.prod';
2+
const webpack = require('webpack');
3+
const chalk = require('chalk');
4+
5+
const webpackConfig = require('../webpack.config.prod');
56

67
process.env.NODE_ENV = 'production';
7-
const log = console.log;
8+
const { log } = console;
89

910
log(chalk.blue('Generating minified bundle for production. This will take a moment...'));
1011

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import chalk from 'chalk';
1+
const chalk = require('chalk');
22

3-
const log = console.log;
3+
const { log } = console;
44

55
log(chalk.green('Starting the application in development mode...'));
6-

build_scripts/development-server.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import express from 'express';
2-
import path from 'path';
3-
import open from 'open';
4-
import webpack from 'webpack';
5-
import config from '../webpack.config.dev';
1+
const express = require('express');
2+
const path = require('path');
3+
const open = require('open');
4+
const webpack = require('webpack');
5+
const config = require('../webpack.config.dev');
66

77
process.env.NODE_ENV = 'development';
88

99
const port = 3000;
1010
const app = express();
1111
const compiler = webpack(config);
12-
const log = console.log;
12+
const { log } = console;
1313

1414
app.use(require('webpack-dev-middleware')(compiler, {
1515
noInfo: true,

build_scripts/generate-mock-data.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*/
66

77
/* eslint-disable no-console */
8+
const jsf = require('json-schema-faker');
9+
const chalk = require('chalk');
10+
const fs = require('fs');
811

9-
import jsf from 'json-schema-faker';
10-
import fs from 'fs';
11-
import chalk from 'chalk';
12-
import { schema } from './mock-data-schema';
13-
12+
// import {schema} from './mock-data-schema';
13+
const schema = require('./mock-data-schema');
1414

1515
const json = JSON.stringify(jsf(schema));
16-
const log = console.log;
16+
const { log } = console;
1717

1818
fs.writeFile('./src/api/db.json', json, (err) => {
1919
if (err) {

build_scripts/mock-data-schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const schema = {
1+
const schema = module.exports = {
22
type: 'object',
33
properties: {
44
users: {

build_scripts/production-server.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import express from 'express';
2-
import path from 'path';
3-
import open from 'open';
4-
import compression from 'compression';
1+
const express = require('express');
2+
const path = require('path');
3+
const open = require('open');
4+
const compression = require('compression');
5+
56

67
const port = 3000;
78
const app = express();
8-
const log = console.log;
9+
const { log } = console;
910

1011
app.use(compression());
1112
app.use(express.static('dist'));

build_scripts/test-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file isn't transpiled, so must use CommonJS and ES5
22

33
// Register babel to transpile before our tests run.
4-
require('babel-register');
4+
require('@babel/register');
55

66
// Disable webpack features that Mocha doesn't understand.
77
require.extensions['.css'] = function () {};

package.json

+48-48
Original file line numberDiff line numberDiff line change
@@ -7,71 +7,71 @@
77
"author": "Bogdan Olteanu",
88
"license": "MIT",
99
"scripts": {
10-
"prestart": "babel-node build_scripts/development-server-start-message.js",
11-
"start": "npm-run-all --parallel security-check start:development:server lint:watch test:watch prestart:mock-api start:mock-api",
12-
"start:development:server": "babel-node build_scripts/development-server.js",
10+
"prestart": "node build_scripts/development-server-start-message.js",
11+
"start": "npm-run-all --parallel start:development:server lint:watch test:watch prestart:mock-api start:mock-api",
12+
"start:development:server": "node build_scripts/development-server.js",
1313
"start:production:server": "",
14-
"security-check": "nsp check",
14+
"security-check": "npm audit",
1515
"localtunnel": "lt --port 3001",
1616
"share:development": "npm-run-all --parallel start:development:server localtunnel",
1717
"lint": "esw webpack.config.* src build_scripts --fix --color",
1818
"lint:watch": "npm run lint -- --watch",
1919
"test": "mocha --reporter progress build_scripts/test-config.js \"src/**/*.test.js\"",
2020
"test:watch": "npm run test -- --watch",
21-
"generate-mock-data": "babel-node build_scripts/generate-mock-data",
21+
"generate-mock-data": "node build_scripts/generate-mock-data",
2222
"prestart:mock-api": "npm run generate-mock-data",
2323
"start:mock-api": "json-server --watch ./src/api/db.json --port 3001",
2424
"clean:dist": "rimraf ./dist && mkdir dist",
2525
"prebuild": "npm-run-all clean:dist test lint",
26-
"build": "babel-node build_scripts/build-production.js",
27-
"postbuild": "babel-node build_scripts/production-server"
26+
"build": "node build_scripts/build-production.js",
27+
"postbuild": "node build_scripts/production-server"
2828
},
2929
"dependencies": {
3030
"numeral": "^2.0.6",
31-
"postcss-loader": "^2.0.6",
32-
"whatwg-fetch": "^2.0.3"
31+
"postcss-loader": "^3.0.0",
32+
"whatwg-fetch": "^3.0.0"
3333
},
3434
"devDependencies": {
35-
"babel-cli": "^6.26.0",
36-
"babel-core": "^6.26.0",
37-
"babel-loader": "^7.1.2",
38-
"babel-preset-airbnb": "^2.4.0",
39-
"babel-preset-env": "^1.6.0",
40-
"babel-register": "^6.26.0",
41-
"chai": "^4.1.2",
42-
"chalk": "^2.1.0",
35+
"@babel/cli": "^7.2.3",
36+
"@babel/core": "^7.3.3",
37+
"@babel/preset-env": "^7.3.1",
38+
"@babel/register": "^7.0.0",
39+
"babel-loader": "^8.0.5",
40+
"babel-preset-airbnb": "^3.2.0",
41+
"chai": "^4.2.0",
42+
"chalk": "^2.4.2",
4343
"cheerio": "^1.0.0-rc.2",
44-
"compression": "^1.7.0",
45-
"cross-env": "^5.0.5",
46-
"css-loader": "^0.28.7",
47-
"eslint": "^4.7.2",
48-
"eslint-config-airbnb-base": "^12.0.0",
49-
"eslint-plugin-import": "^2.7.0",
50-
"eslint-watch": "^3.1.2",
51-
"express": "^4.15.4",
52-
"extract-text-webpack-plugin": "^3.0.0",
53-
"file-loader": "^1.1.3",
54-
"html-loader": "^0.5.1",
55-
"html-webpack-plugin": "^2.30.1",
56-
"jsdom": "^11.2.0",
57-
"json-schema-faker": "^0.5.0-rc11",
58-
"json-server": "^0.12.0",
59-
"less-loader": "^4.0.5",
60-
"localtunnel": "^1.8.3",
61-
"mocha": "^3.5.3",
62-
"nock": "^9.0.20",
63-
"node-sass": "^4.5.3",
64-
"npm-run-all": "^4.1.1",
65-
"nsp": "^2.8.0",
44+
"compression": "^1.7.3",
45+
"cross-env": "^5.2.0",
46+
"css-loader": "^2.1.0",
47+
"eslint": "^5.14.1",
48+
"eslint-config-airbnb-base": "^13.1.0",
49+
"eslint-plugin-import": "^2.16.0",
50+
"eslint-watch": "^4.0.2",
51+
"express": "^4.16.4",
52+
"extract-text-webpack-plugin": "^3.0.2",
53+
"file-loader": "^3.0.1",
54+
"html-loader": "^0.5.5",
55+
"html-webpack-plugin": "^3.2.0",
56+
"jsdom": "^13.2.0",
57+
"json-schema-faker": "^0.5.0-rc9",
58+
"json-server": "^0.14.2",
59+
"less-loader": "^4.1.0",
60+
"localtunnel": "^1.9.1",
61+
"mini-css-extract-plugin": "^0.5.0",
62+
"mocha": "^6.0.0",
63+
"nock": "^10.0.6",
64+
"node-sass": "^4.11.0",
65+
"npm-run-all": "^4.1.5",
6666
"open": "^0.0.5",
67-
"rimraf": "^2.6.2",
68-
"sass-loader": "^6.0.6",
69-
"source-map-loader": "^0.2.1",
70-
"style-loader": "^0.18.2",
71-
"url-loader": "^0.5.9",
72-
"webpack": "^3.6.0",
73-
"webpack-dev-middleware": "^1.12.0",
74-
"webpack-hot-middleware": "^2.19.1",
75-
"webpack-md5-hash": "^0.0.5"
67+
"rimraf": "^2.6.3",
68+
"sass-loader": "^7.1.0",
69+
"source-map-loader": "^0.2.4",
70+
"style-loader": "^0.23.1",
71+
"url-loader": "^1.1.2",
72+
"webpack": "^4.29.5",
73+
"webpack-dev-middleware": "^3.6.0",
74+
"webpack-hot-middleware": "^2.24.3",
75+
"webpack-md5-hash": "^0.0.6"
7676
}
7777
}

src/api/db.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"users":[{"id":21834736.16803863,"firstName":"aliquip exercitation elit ullamco","lastName":"in ipsum","email":"ipsum occaecat"},{"id":65745071.29525477,"firstName":"adipisicing ut dolore","lastName":"anim velit et Ut irure","email":"qui laborum nisi quis ad"},{"id":10137112.133459985,"firstName":"nostrud pariatur","lastName":"do","email":"ad nostrud culpa fugiat elit"},{"id":93443654.09144057,"firstName":"reprehenderit","lastName":"amet quis","email":"ipsum Ut laborum commodo"}]}
1+
{"users":[{"id":78349065.8349018,"firstName":"","lastName":"esse cillum","email":"velit consequat ex quis"},{"id":80352923.91890207,"firstName":"velit","lastName":"magna ipsum laborum","email":"adipisicing esse"},{"id":14828333.20826358,"firstName":"ad","lastName":"fugiat ad ea","email":"fugiat quis ut"}]}

webpack.config.dev.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import path from 'path';
2-
import webpack from 'webpack';
1+
const path = require('path');
2+
const webpack = require('webpack');
33

44
const HtmlWebpackPlugin = require('html-webpack-plugin');
55

6-
export default {
6+
module.exports = {
77
devtool: 'inline-source-map',
8+
mode: 'development',
89
entry: [
910
path.resolve(__dirname, 'src/index'),
1011
],
@@ -28,7 +29,7 @@ export default {
2829
}),
2930
],
3031
module: {
31-
loaders: [
32+
rules: [
3233
{
3334
test: /\.html$/,
3435
use: [
@@ -52,11 +53,6 @@ export default {
5253
},
5354
{
5455
loader: 'css-loader',
55-
options: {
56-
modules: true,
57-
minimize: false,
58-
sourceMap: true,
59-
},
6056
},
6157
],
6258
},

webpack.config.prod.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import path from 'path';
22
import webpack from 'webpack';
33

44
const HtmlWebpackPlugin = require('html-webpack-plugin');
5+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
56
const WebpackMd5Hash = require('webpack-md5-hash');
67
const ExtractTextPlugin = require('extract-text-webpack-plugin');
78

8-
export default {
9+
module.exports = {
910
devtool: 'source-map',
11+
mode: 'production',
1012
entry: {
1113
vendor: path.resolve(__dirname, 'src/vendor'),
1214
main: path.resolve(__dirname, 'src/index'),
@@ -27,7 +29,7 @@ export default {
2729
new webpack.optimize.CommonsChunkPlugin({
2830
name: 'vendor',
2931
}),
30-
// Create an HTML file that includes reference to bundled JS.
32+
// Create an options file that includes reference to bundled JS.
3133
new HtmlWebpackPlugin({
3234
template: 'src/index.html',
3335
minify: {
@@ -55,7 +57,7 @@ export default {
5557
}),
5658
],
5759
module: {
58-
loaders: [
60+
rules: [
5961
{
6062
test: /\.html$/,
6163
use: [
@@ -70,26 +72,26 @@ export default {
7072
},
7173
{
7274
test: /\.css$/,
73-
use: ExtractTextPlugin.extract({
75+
use: MiniCssExtractPlugin.loader({
7476
allChunks: true,
7577
fallback: 'style-loader',
76-
use: 'css-loader',
78+
options: 'css-loader',
7779
}),
7880
},
7981
{
8082
test: /\.scss$/,
81-
use: ExtractTextPlugin.extract({
83+
use: MiniCssExtractPlugin.loader({
8284
fallback: 'style-loader',
8385
// resolve-url-loader may be chained before sass-loader if necessary
84-
use: ['css-loader', 'sass-loader'],
86+
options: ['css-loader', 'sass-loader'],
8587
}),
8688
},
8789
{
8890
test: /\.less/,
89-
use: ExtractTextPlugin.extract({
91+
use: MiniCssExtractPlugin.loader({
9092
fallback: 'style-loader',
9193
// resolve-url-loader may be chained before sass-loader if necessary
92-
use: ['css-loader', 'less-loader'],
94+
options: ['css-loader', 'less-loader'],
9395
}),
9496
},
9597
{

0 commit comments

Comments
 (0)