metalsmith-browserify
Advanced tools
Comparing version 0.3.0 to 1.0.0
{ | ||
"name": "metalsmith-browserify", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Metalsmith plugin to bundle JS with browserify", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "_mocha index.test.js" | ||
}, | ||
"repository": { | ||
@@ -24,18 +20,39 @@ "type": "git", | ||
"homepage": "https://github.com/kopa-app/metalsmith-browserify#readme", | ||
"devDependencies": { | ||
"browserify": "^13.1.1", | ||
"expect.js": "^0.3.1", | ||
"metalsmith": "^2.1.0", | ||
"mocha": "^2.3.4", | ||
"watchify": "^3.8.0" | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"precommit": "lint-staged", | ||
"lint:js": "eslint '**/*.js'", | ||
"lint:prettier": "prettier --list-different '**/*.js'", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls" | ||
}, | ||
"peerDependencies": { | ||
"browserify": "*", | ||
"metalsmith": "*", | ||
"watchify": "*" | ||
"jest": { | ||
"collectCoverageFrom": [ | ||
"lib/*.js" | ||
] | ||
}, | ||
"greenkeeper": { | ||
"ignore": [ | ||
"eslint", | ||
"eslint-plugin-import" | ||
] | ||
}, | ||
"dependencies": { | ||
"exorcist": "^0.4.0", | ||
"mkdirp": "^0.5.1" | ||
"debug": "^3.1.0", | ||
"browserify": "^16.1.0" | ||
}, | ||
"devDependencies": { | ||
"husky": "^0.14.3", | ||
"coveralls": "^3.0.0", | ||
"assert-dir-equal": "^1.1.0", | ||
"eslint": "^4.18.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"lint-staged": "^7.0.0", | ||
"jest": "^22.4.2", | ||
"metalsmith": "^2.3.0", | ||
"prettier": "^1.10.2", | ||
"rimraf": "^2.6.2" | ||
} | ||
} |
@@ -1,48 +0,42 @@ | ||
[![Build Status](https://travis-ci.org/kopa-app/metalsmith-browserify.svg)](https://travis-ci.org/kopa-app/metalsmith-browserify) | ||
# metalsmith-browserify | ||
# Metalsmith - Browserify | ||
[![npm version][version-badge]][version-url] | ||
[![build status][build-badge]][build-url] | ||
[![coverage status][coverage-badge]][coverage-url] | ||
[![greenkeeper][greenkeeper-badge]][greenkeeper-url] | ||
[![downloads][downloads-badge]][downloads-url] | ||
Metalsmith plugin to bundle JS with browserify | ||
> A metalsmith plugin to bundle javascript with browserify | ||
This plugin allows you to bundle your javscript with browserify. Pass it the entry points it should bundle, and it will replace those files with the resulting bundle on build. | ||
For support questions please use [stack overflow][stackoverflow-url] or our [slack channel][slack-url]. For browserify specific questions try [their documentation](https://github.com/browserify/browserify). | ||
## Installation | ||
```bash | ||
npm install metalsmith-browserify --save | ||
$ npm install metalsmith-browserify | ||
``` | ||
metalsmith-browserify does not bundle browserify. You need to install it yourself in your package. | ||
This is to avoid usage of an outdated browserify version with metalsmith-browserify. | ||
## Options | ||
## Usage | ||
You can pass options to `metalsmith-browserify` with the [Javascript API](https://github.com/segmentio/metalsmith#api) or [CLI](https://github.com/segmentio/metalsmith#cli). The options are: | ||
```javascript | ||
var metalsmith = require('metalsmith'); | ||
var browserify = require('metalsmith-browserify'); | ||
* [entries](#entries): required. The entry points that need to be browserified. Accepts an array of strings. | ||
* [browserifyOptions](#browserifyoptions): optional. These options will be passed on to browserify. See [this area of the browserify documentation](https://github.com/browserify/browserify#browserifyfiles--opts) for all available options. Note that it's possible to break stuff here, like overriding the entries, so use wisely. | ||
metalsmith(__dirname) | ||
.use(browserify({ | ||
dest: 'js/bundle.js', | ||
entries: ['./src/js/index.js'], | ||
sourcemaps: false, | ||
watch: false | ||
})) | ||
.build(function (err, files) { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
``` | ||
### `entries` | ||
See [browserify api](https://www.npmjs.com/package/browserify#api-example) for available options. | ||
The entry points that should be browserified. So this `metalsmith.json`: | ||
It can also be used with `metalsmith.json` by adding the plugin like this: | ||
```json | ||
{ | ||
"source": "src", | ||
"destination": "build", | ||
"plugins": { | ||
"metalsmith-browserify": { | ||
"dest": "javascripts/bundle.js", | ||
"entries": ["src/javascripts/index.js"], | ||
"sourcemaps": false, | ||
"watch": false | ||
"entries": [ | ||
"index.js", | ||
"another.js" | ||
] | ||
} | ||
@@ -53,10 +47,44 @@ } | ||
Or assume the defaults (dest: `bundle.js`, args: []): | ||
Would browserify both `./src/index.js` and `./src/another.js` and output them as `./build/index.js` and `./build/another.js` respectively. | ||
### `browserifyOptions` | ||
Use this to pass options to browserify. So this `metalsmith.json`: | ||
```json | ||
{ | ||
"source": "src", | ||
"destination": "build", | ||
"plugins": { | ||
"metalsmith-browserify": true | ||
"metalsmith-browserify": { | ||
"entries": ["index.js"], | ||
"browserifyOptions": { | ||
"debug": true | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
Would enable browserify's debug option and add a source map to the bundle. | ||
## Errors and debugging | ||
If you're encountering problems you can use [debug](https://www.npmjs.com/package/debug) to enable verbose logging. To enable `debug` prefix your build command with `DEBUG=metalsmith-browserify`. So if you normally run `metalsmith` to build, use `DEBUG=metalsmith-browserify metalsmith` (on windows the syntax is [slightly different](https://www.npmjs.com/package/debug#windows-note)). | ||
## License | ||
MIT | ||
[build-badge]: https://travis-ci.org/kopa-app/metalsmith-browserify.svg?branch=master | ||
[build-url]: https://travis-ci.org/kopa-app/metalsmith-browserify | ||
[downloads-badge]: https://img.shields.io/npm/dm/metalsmith-browserify.svg | ||
[downloads-url]: https://www.npmjs.com/package/metalsmith-browserify | ||
[version-badge]: https://img.shields.io/npm/v/metalsmith-browserify.svg | ||
[version-url]: https://www.npmjs.com/package/metalsmith-browserify | ||
[greenkeeper-badge]: https://badges.greenkeeper.io/kopa-app/metalsmith-browserify.svg | ||
[greenkeeper-url]: https://greenkeeper.io/ | ||
[coverage-badge]: https://coveralls.io/repos/github/kopa-app/metalsmith-browserify/badge.svg?branch=master | ||
[coverage-url]: https://coveralls.io/github/kopa-app/metalsmith-browserify?branch=master | ||
[slack-url]: http://metalsmith-slack.herokuapp.com/ | ||
[stackoverflow-url]: http://stackoverflow.com/questions/tagged/metalsmith |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11439
2
9
138
0
90
0
12
1
+ Addedbrowserify@^16.1.0
+ Addeddebug@^3.1.0
+ Addedbrowserify@16.5.2(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addedevents@2.1.0(transitive)
+ Addedhas@1.0.4(transitive)
+ Addedjson-stable-stringify@0.0.1(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedpath-browserify@0.0.1(transitive)
+ Addedshasum@1.0.2(transitive)
+ Addedstream-browserify@2.0.2(transitive)
- Removedexorcist@^0.4.0
- Removedmkdirp@^0.5.1
- Removedanymatch@3.1.3(transitive)
- Removedargparse@1.0.10(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedbinary-extensions@2.3.0(transitive)
- Removedbraces@3.0.3(transitive)
- Removedbrowserify@17.0.1(transitive)
- Removedchokidar@3.6.0(transitive)
- Removedco@3.1.0(transitive)
- Removedcommander@10.0.1(transitive)
- Removeddebug@4.3.7(transitive)
- Removedesprima@4.0.1(transitive)
- Removedevents@3.3.0(transitive)
- Removedexorcist@0.4.0(transitive)
- Removedextend-shallow@2.0.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfsevents@2.3.3(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedgray-matter@4.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-binary-path@2.1.0(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-extendable@0.1.1(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-typed-array@1.1.13(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedkind-of@6.0.3(transitive)
- Removedlodash.clonedeepwith@4.5.0(transitive)
- Removedmetalsmith@2.6.3(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedminimist@0.0.5(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedmold-source-map@0.4.1(transitive)
- Removednave@0.5.3(transitive)
- Removednormalize-path@3.0.0(transitive)
- Removedoutpipe@1.1.1(transitive)
- Removedpath-browserify@1.0.1(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedreaddirp@3.6.0(transitive)
- Removedsection-matter@1.0.0(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstat-mode@1.0.0(transitive)
- Removedstream-browserify@3.0.0(transitive)
- Removedstrip-bom-string@1.0.0(transitive)
- Removedthrough@2.2.7(transitive)
- Removedthrough2@4.0.2(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedutil@0.12.5(transitive)
- Removedware@1.3.0(transitive)
- Removedwatchify@4.0.0(transitive)
- Removedwhich-typed-array@1.1.15(transitive)
- Removedwrap-fn@0.1.5(transitive)