Skip to content

Commit 01c619e

Browse files
authored
Merge pull request #1 from codevor/refactor/webpack-structure
Refactor: webpack structure
2 parents 86b5d6f + fd32d40 commit 01c619e

File tree

6 files changed

+96
-18
lines changed

6 files changed

+96
-18
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: helderburato, caian-gums
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Issues
2+
3+
Card issue(s): [ISSUE-XX](https://github.com/codevor/logger.js/issues/<id>)
4+
5+
## Description
6+
7+
You can provide a verbose description of what you've done or a step-by-step. Ex:
8+
9+
- Create JS for the given behavior

.npmignore

-6
This file was deleted.

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "js-library-boilerplate-description",
55
"main": "dist/js-library-boilerplate.js",
66
"unpkg": "dist/js-library-boilerplate.min.js",
7+
"files": [
8+
"dist"
9+
],
710
"scripts": {
811
"clean": "rimraf dist",
912
"dev": "NODE_ENV=dev webpack --progress --colors --watch",
@@ -12,7 +15,7 @@
1215
"test": "jest --coverage --expand",
1316
"test:watch": "jest --watch",
1417
"coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
15-
"prepublish": "yarn lint && yarn test && yarn clean && yarn build:umd",
18+
"prepublish": "yarn clean && yarn build:umd",
1619
"commit": "git-cz"
1720
},
1821
"keywords": [],
@@ -42,7 +45,7 @@
4245
"husky": "^3.0.9",
4346
"jest": "^24.9.0",
4447
"rimraf": "^3.0.0",
45-
"uglifyjs-webpack-plugin": "^2.2.0",
48+
"terser-webpack-plugin": "^2.2.3",
4649
"webpack": "^4.41.1",
4750
"webpack-cli": "^3.3.9"
4851
},

webpack.config.js

+24-10
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,63 @@
11
const path = require('path');
22
const webpack = require('webpack');
3-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
3+
const TerserPlugin = require('terser-webpack-plugin');
4+
5+
const {
6+
name,
7+
version,
8+
repository,
9+
author,
10+
license
11+
} = require('./package.json');
412

513
const isProduction = process.env.NODE_ENV === 'production';
6-
const mode = isProduction ? 'production' : 'development';
714

815
const libraryName = 'js-library-boilerplate';
916

17+
const banner = `
18+
${name} v${version}
19+
${repository.url}
20+
Copyright (c) ${author.replace(/ *\<[^)]*\> */g, ' ')}
21+
This source code is licensed under the ${license} license found in the
22+
LICENSE file in the root directory of this source tree.
23+
`;
24+
1025
module.exports = {
11-
mode,
26+
mode: isProduction ? 'production' : 'development',
1227
entry: {
1328
[libraryName]: path.resolve(__dirname, 'src/index.js'),
1429
[`${libraryName}.min`]: path.resolve(__dirname, 'src/index.js')
1530
},
16-
devtool: 'source-map',
1731
output: {
18-
path: path.resolve(__dirname, 'dist'),
1932
filename: '[name].js',
33+
path: path.resolve(__dirname, 'dist'),
2034
library: libraryName,
2135
libraryTarget: 'umd',
22-
umdNamedDefine: true,
2336
globalObject: "typeof self !== 'undefined' ? self : this"
2437
},
2538
module: {
2639
rules: [
2740
{
2841
test: /\.js$/,
42+
exclude: /node_modules/,
2943
use: {
3044
loader: 'babel-loader',
3145
options: {
3246
presets: ['@babel/preset-env']
3347
}
34-
},
35-
exclude: /node_modules/
48+
}
3649
}
3750
]
3851
},
3952
optimization: {
4053
minimize: true,
41-
minimizer: [new UglifyJsPlugin({ include: /\.min\.js$/ })]
54+
minimizer: [new TerserPlugin()]
4255
},
4356
plugins: [
4457
new webpack.DefinePlugin({
4558
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
46-
})
59+
}),
60+
new webpack.BannerPlugin(banner)
4761
],
4862
resolve: {
4963
extensions: ['.json', '.js']

0 commit comments

Comments
 (0)