Skip to content

Commit 9b388da

Browse files
committed
init
0 parents  commit 9b388da

File tree

6 files changed

+163
-0
lines changed

6 files changed

+163
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Dependency directory
26+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27+
node_modules

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
node_js:
3+
- 8
4+
- 6
5+
- 4
6+
cache:
7+
directories:
8+
- ~/.npm

LICENSE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0)
2+
3+
Copyright 2017 Renée Kooi <[email protected]>
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
> http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.

index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var packFlat = require('browser-pack-flat/plugin')
2+
var commonShake = require('common-shakeify')
3+
var unassertify = require('unassertify')
4+
var uglify = require('minify-stream')
5+
var envify = require('envify/custom')
6+
var uglifyify = require('uglifyify')
7+
8+
module.exports = function (b, opts) {
9+
var env = Object.assign({
10+
NODE_ENV: 'production'
11+
}, process.env)
12+
13+
// Remove `assert()` calls.
14+
b.transform(unassertify, { global: true })
15+
// Replace `process.env.NODE_ENV` with "production".
16+
b.transform(envify(env), { global: true })
17+
// Remove dead code.
18+
b.transform(uglifyify, {
19+
global: true,
20+
toplevel: true,
21+
// No need to mangle here, will do that at the end.
22+
mangle: false
23+
})
24+
25+
// Output a flat bundle, without function wrappers for each module.
26+
b.plugin(packFlat)
27+
// Remove unused exports from modules.
28+
b.plugin(commonShake)
29+
30+
// Minify the final output.
31+
var uglifyOpts = {}
32+
if (!b._options.debug) {
33+
uglifyOpts.sourceMap = false
34+
}
35+
b.pipeline.get('pack').push(uglify(uglifyOpts))
36+
}

package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "tinyify",
3+
"description": "a browserify plugin that runs various optimizations, so you don't have to install them all manually.",
4+
"version": "0.0.0",
5+
"author": "Renée Kooi <[email protected]>",
6+
"bugs": {
7+
"url": "https://github.com/goto-bus-stop/tinyify/issues"
8+
},
9+
"dependencies": {
10+
"browser-pack-flat": "^2.7.2",
11+
"common-shakeify": "^0.4.1",
12+
"envify": "^4.1.0",
13+
"minify-stream": "^1.1.0",
14+
"uglifyify": "^4.0.4",
15+
"unassertify": "^2.0.4"
16+
},
17+
"devDependencies": {
18+
"standard": "^10.0.3"
19+
},
20+
"homepage": "https://github.com/goto-bus-stop/tinyify",
21+
"keywords": [
22+
"browserify",
23+
"minify",
24+
"optimize",
25+
"tree-shaking",
26+
"uglify"
27+
],
28+
"license": "Apache-2.0",
29+
"main": "index.js",
30+
"repository": {
31+
"type": "git",
32+
"url": "https://github.com/goto-bus-stop/tinyify.git"
33+
},
34+
"scripts": {
35+
"test": "standard"
36+
}
37+
}

readme.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# tinyify
2+
3+
a browserify plugin that runs various optimizations, so you don't have to install them all manually.
4+
5+
[![npm][npm-image]][npm-url]
6+
[![travis][travis-image]][travis-url]
7+
[![standard][standard-image]][standard-url]
8+
9+
[npm-image]: https://img.shields.io/npm/v/browserify-tiny.svg?style=flat-square
10+
[npm-url]: https://www.npmjs.com/package/browserify-tiny
11+
[travis-image]: https://img.shields.io/travis/goto-bus-stop/browserify-tiny.svg?style=flat-square
12+
[travis-url]: https://travis-ci.org/goto-bus-stop/browserify-tiny
13+
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
14+
[standard-url]: http://npm.im/standard
15+
16+
```bash
17+
npm install --saved-dev tinyify
18+
19+
browserify -p tinyify app.js
20+
```
21+
22+
## Included
23+
24+
- [unassertify][] - Remove `assert()` calls
25+
- [envify][] - Replace environment variables—by default, replaces `NODE_ENV` with `"production"`
26+
- [uglifyify][] - Remove dead code from modules
27+
- [common-shakeify][] - Remove unused exports from modules
28+
- [browser-pack-flat][] - Output a "flat" bundle, with all modules in a single scope
29+
- [minify-stream][] - Uglify the final bundle
30+
31+
## License
32+
33+
[Apache-2.0](./LICENSE.md)
34+
35+
[unassertify]: https://github.com/unassert-js/unassertify
36+
[envify]: https://github.com/hughsk/envify
37+
[uglifyify]: https://github.com/hughsk/uglifyify
38+
[common-shakeify]: https://github.com/goto-bus-stop/common-shakeify
39+
[browser-pack-flat]: https://github.com/goto-bus-stop/browser-pack-flat
40+
[minify-stream]: https://github.com/goto-bus-stop/minify-stream

0 commit comments

Comments
 (0)