diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..53c37a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist \ No newline at end of file diff --git a/README.md b/README.md index 84e5111..23bdcb3 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,22 @@ Usage Guide The easiest way to interface with it is by using pakmanager. Include the package from pakmanager in your html, and then in you javascript: - var Tar = require('tar'), - tape = new Tar(); +```javascript +const Tar = require('tar'); +const tape = new Tar(); +``` + +Or require script from unpkg.com cdn inside of your html page: + +```html + +``` + +and use: + +```javascript +var tape = new Tar(); +``` Then all you got to do is call `tape.append` with your params and it'll be added to the archive. That's it! diff --git a/package.json b/package.json index 1382253..6045b07 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,23 @@ }, "author": "T. Jameson Little ", "main": "lib/tar.js", - "keywords": ["tar", "browser", "client", "offline"], + "keywords": [ + "tar", + "browser", + "client", + "offline" + ], "directories": { "lib": "lib" }, - "dependencies": { + "dependencies": {}, + "devDependencies": { + "webpack": "^2.6.1" + }, + "scripts": { + "prepublish": "npm run build", + "build": "npm run build:dev && npm run build:prod", + "build:dev": "webpack", + "build:prod": "NODE_ENV=production webpack" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..3b30538 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,19 @@ +const webpack = require('webpack'); + +const debug = process.env.NODE_ENV !== 'production'; +const filename = debug ? 'tar.js' : 'tar.min.js'; + +module.exports = { + entry: __dirname + '/lib/tar.js', + output: { + path: __dirname + '/dist', + filename, + library: 'Tar', + }, + module: { + loaders: [], + }, + plugins: debug ? [] : [ + new webpack.optimize.UglifyJsPlugin(), + ], +};