Skip to content

Commit 2c885b5

Browse files
committed
feat(all): initial commit
0 parents  commit 2c885b5

File tree

11 files changed

+192
-0
lines changed

11 files changed

+192
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
.idea
3+
.vscode
4+
npm-debug.log*
5+
/typings
6+
/dist

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/typings
2+
/.vscode

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
sudo: false
2+
language: node_js
3+
cache:
4+
directories:
5+
- node_modules
6+
notifications:
7+
email: false
8+
node_js:
9+
- 6
10+
before_install:
11+
- npm i -g npm
12+
before_script:
13+
- npm prune
14+
- npm install @easy-webpack/core webpack@beta
15+
after_success:
16+
- npm run semantic-release
17+
branches:
18+
except:
19+
- /^v\d+\.\d+\.\d+$/

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Bazyli Brzóska
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Whitespace-only changes.

package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "@easy-webpack/config-uglify",
3+
"description": "Easy Webpack configuration function for uglify",
4+
"main": "dist/index.js",
5+
"typings": "dist/index.d.ts",
6+
"scripts": {
7+
"test": "TS_NODE_FAST=true TS_NODE_NO_PROJECT=true ava",
8+
"postinstall": "typings install",
9+
"build": "rimraf dist && tsc -p .",
10+
"semantic-release": "npm run build && semantic-release pre && npm publish --access=public && semantic-release post"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/easy-webpack/config-uglify.git"
15+
},
16+
"keywords": [
17+
"uglify",
18+
"webpack",
19+
"easy",
20+
"configurator",
21+
"configuration",
22+
"config",
23+
"simple"
24+
],
25+
"author": "Bazyli Brzóska <[email protected]> (https://invent.life)",
26+
"license": "MIT",
27+
"bugs": {
28+
"url": "https://github.com/easy-webpack/config-uglify/issues"
29+
},
30+
"homepage": "https://github.com/easy-webpack/config-uglify#readme",
31+
"devDependencies": {
32+
"ava": "^0.15.2",
33+
"semantic-release": "^4.3.5",
34+
"ts-node": "^0.9.1",
35+
"tslint": "^3.11.0",
36+
"tslint-config-standard": "^1.2.2",
37+
"typescript": ">=1.9.0-dev.20160619-1.0 || ^2.0.0",
38+
"typings": "^1.3.0"
39+
},
40+
"dependencies": {},
41+
"peerDependencies": {
42+
"@easy-webpack/core": "*"
43+
},
44+
"ava": {
45+
"files": [
46+
"test/**/*.{ts,js}"
47+
],
48+
"tap": false,
49+
"require": [
50+
"ts-node/register"
51+
]
52+
}
53+
}

src/index.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import {WebpackConfig, get} from '@easy-webpack/core'
2+
import * as webpack from 'webpack'
3+
4+
/**
5+
* Plugin: UglifyJsPlugin
6+
* Description: Minimize all JavaScript output of chunks.
7+
* Loaders are switched into minimizing mode.
8+
*
9+
* See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
10+
*/
11+
export function uglify(debug = false) {
12+
return function uglify(this: WebpackConfig): WebpackConfig {
13+
const options = debug ? {
14+
beautify: true, //debug
15+
mangle: false, //debug
16+
dead_code: false, //debug
17+
unused: false, //debug
18+
deadCode: false, //debug
19+
compress: {
20+
screw_ie8: true,
21+
keep_fnames: true,
22+
drop_debugger: false,
23+
dead_code: false,
24+
unused: false
25+
}, // debug
26+
comments: true, //debug
27+
} : {
28+
beautify: false, //prod
29+
30+
mangle: {
31+
screw_ie8 : true,
32+
keep_fnames: true
33+
}, //prod
34+
35+
compress: {
36+
screw_ie8: true,
37+
warnings: false
38+
}, //prod
39+
40+
comments: false //prod
41+
}
42+
43+
return {
44+
plugins: get(this, 'plugins', []).concat([
45+
// NOTE: To debug prod builds uncomment //debug lines and comment //prod lines
46+
new webpack.optimize.UglifyJsPlugin(options),
47+
])
48+
}
49+
}
50+
}

test/config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import test from 'ava'
2+
import {assign} from '../src'
3+
4+
test(`dummy`, t => {
5+
t.true(true)
6+
})

tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"experimentalDecorators": true,
6+
"moduleResolution": "node",
7+
"allowJs": false,
8+
"declaration": true,
9+
"outDir": "dist",
10+
"rootDir": "src",
11+
"sourceMap": true,
12+
"lib": ["es6"]
13+
},
14+
"exclude": [
15+
"node_modules",
16+
"dist",
17+
"test",
18+
"example"
19+
]
20+
}

tslint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "tslint-config-standard"
3+
}

0 commit comments

Comments
 (0)