File tree Expand file tree Collapse file tree 6 files changed +60
-5
lines changed
Expand file tree Collapse file tree 6 files changed +60
-5
lines changed Original file line number Diff line number Diff line change 1+ lib
2+ ** /node_modules
3+ ** /webpack.config.js
Original file line number Diff line number Diff line change 11node_modules
2- coverage
2+ * .log
33.DS_Store
4+ dist
5+ lib
6+ coverage
47yarn.lock
58package-lock.json
Original file line number Diff line number Diff line change 1+ .DS_Store
2+ * .log
3+ src
4+ __tests__
5+ coverage
Original file line number Diff line number Diff line change 22 "name" : " js-http-status" ,
33 "version" : " 0.1.0" ,
44 "description" : " [![License][license-badge]][license-url]" ,
5- "main" : " index.js" ,
5+ "main" : " lib/ index.js" ,
66 "scripts" : {
7- "lint" : " yarn eslint src/**/*.js" ,
8- "test" : " jest"
7+ "clean" : " rimraf lib dist" ,
8+ "build" : " babel src --out-dir lib" ,
9+ "build:umd" : " NODE_ENV=production webpack src/index.js" ,
10+ "lint" : " eslint src" ,
11+ "test" : " jest" ,
12+ "prepublish" : " yarn lint && yarn test && yarn clean && yarn build && yarn build:umd"
913 },
1014 "repository" : {
1115 "type" : " git" ,
1923 },
2024 "homepage" : " https://github.com/codevor/js-http-status#readme" ,
2125 "devDependencies" : {
26+ "@babel/cli" : " ^7.6.4" ,
2227 "@babel/core" : " ^7.6.4" ,
2328 "@babel/preset-env" : " ^7.6.3" ,
2429 "babel-jest" : " ^24.9.0" ,
30+ "babel-loader" : " ^8.0.6" ,
2531 "eslint" : " ^6.5.1" ,
2632 "eslint-config-airbnb-base" : " ^14.0.0" ,
2733 "eslint-config-prettier" : " ^6.4.0" ,
2834 "eslint-plugin-import" : " ^2.18.2" ,
2935 "husky" : " ^3.0.9" ,
30- "jest" : " ^24.9.0"
36+ "jest" : " ^24.9.0" ,
37+ "rimraf" : " ^3.0.0" ,
38+ "uglifyjs-webpack-plugin" : " ^2.2.0" ,
39+ "webpack" : " ^4.41.1" ,
40+ "webpack-cli" : " ^3.3.9"
3141 }
3242}
Original file line number Diff line number Diff line change 1+ const path = require ( 'path' ) ;
2+ const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
3+
4+ const isProduction = process . env . NODE_ENV === 'production' ;
5+ const mode = isProduction ? 'production' : 'development' ;
6+
7+ module . exports = {
8+ mode,
9+ entry : {
10+ main : path . resolve ( __dirname , 'src/index.js' ) ,
11+ } ,
12+ output : {
13+ path : path . resolve ( __dirname , 'dist' ) ,
14+ filename : isProduction ? 'http-status.min.js' : 'http-status.js' ,
15+ library : 'HttpStatus' ,
16+ libraryTarget : 'umd' ,
17+ } ,
18+ module : {
19+ rules : [
20+ {
21+ test : / \. j s $ / ,
22+ loader : 'babel-loader' ,
23+ exclude : / n o d e _ m o d u l e s / ,
24+ }
25+ ]
26+ } ,
27+ optimization : {
28+ minimize : isProduction ,
29+ minimizer : [ new UglifyJsPlugin ( ) ]
30+ } ,
31+ resolve : {
32+ extensions : [ ".js" ]
33+ }
34+ } ;
You can’t perform that action at this time.
0 commit comments