Remove webpack devDependencies and drop IE11 support for the homepage

This commit is contained in:
typicode
2020-02-12 02:51:18 +01:00
committed by GitHub
parent 0dab72e161
commit fa9aa517f9
8 changed files with 29 additions and 2794 deletions

3
.gitignore vendored
View File

@ -2,7 +2,6 @@
node_modules
tmp
lib
dist
.DS_Store
.idea
db.json
db.json

View File

@ -703,18 +703,18 @@ describe('Server', () => {
.expect(200))
})
describe('GET /main.js', () => {
describe('GET /script.js', () => {
test('should respond with js', () =>
request(server)
.get('/main.js')
.get('/script.js')
.expect('Content-Type', /javascript/)
.expect(200))
})
describe('GET /main.css', () => {
describe('GET /style.css', () => {
test('should respond with css', () =>
request(server)
.get('/main.css')
.get('/style.css')
.expect('Content-Type', /css/)
.expect(200))
})

2765
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,10 @@
},
"scripts": {
"test": "npm run build && cross-env NODE_ENV=test jest && npm run lint",
"start": "run-p start:**",
"start:babel-node": "babel-node src/cli/bin db.json -r routes.json",
"start:webpack": "webpack -d --watch",
"start": "babel-node src/cli/bin db.json -r routes.json",
"lint": "eslint . --ignore-path .gitignore",
"fix": "npm run lint -- --fix",
"build": "babel src -d lib && webpack -p",
"build": "babel src -d lib",
"toc": "markdown-toc -i README.md",
"prepublishOnly": "npm test && npm run build && pkg-ok"
},
@ -49,10 +47,7 @@
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"babel-loader": "^8.0.6",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^5.2.1",
"css-loader": "^3.2.0",
"eslint": "^6.3.0",
"eslint-config-prettier": "^6.1.0",
"eslint-config-standard": "^14.1.0",
@ -61,24 +56,18 @@
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"html-webpack-plugin": "^3.2.0",
"husky": "^3.0.5",
"jest": "^24.9.0",
"markdown-toc": "^1.2.0",
"mini-css-extract-plugin": "^0.8.0",
"mkdirp": "^0.5.1",
"npm-run-all": "^4.1.5",
"os-tmpdir": "^2.0.0",
"pkg-ok": "^2.3.1",
"prettier": "^1.18.2",
"promise-polyfill": "^8.1.3",
"rimraf": "^3.0.0",
"server-ready": "^0.3.1",
"supertest": "^4.0.2",
"temp-write": "^4.0.0",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7",
"whatwg-fetch": "^3.0.0"
"temp-write": "^4.0.0"
},
"repository": {
"type": "git",

View File

@ -6,6 +6,7 @@
integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="style.css" />
<title>JSON Server</title>
</head>
@ -78,5 +79,7 @@
</p>
</div>
</footer>
<script src="script.js"></script>
</body>
</html>

View File

@ -1,7 +1,3 @@
import 'promise-polyfill/src/polyfill'
import 'whatwg-fetch'
import './style.css'
function ResourceItem({ name, length }) {
return `
<li>

View File

@ -9,7 +9,7 @@ const bodyParser = require('./body-parser')
module.exports = function(opts) {
const userDir = path.join(process.cwd(), 'public')
const defaultDir = path.join(__dirname, '../../dist')
const defaultDir = path.join(__dirname, '../front')
const staticDir = fs.existsSync(userDir) ? userDir : defaultDir
opts = Object.assign({ logger: true, static: staticDir }, opts)

View File

@ -1,21 +0,0 @@
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = {
entry: './src/front/index.js',
module: {
rules: [
{ test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }
]
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
favicon: 'src/front/favicon.ico',
template: 'src/front/index.html'
}),
new MiniCssExtractPlugin()
]
}