From a2046d2fcd9d221b974594034ec0ffedd37f5e62 Mon Sep 17 00:00:00 2001 From: Mara Kim Date: Fri, 5 Aug 2016 01:34:38 -0500 Subject: [PATCH] Add .gitignore --- .gitignore | 33 +++++++++++++++++++++++++++++++++ index.js | 14 ++++++++++---- package.json | 8 ++++++-- 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e920c16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +node_modules + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history diff --git a/index.js b/index.js index 8afe1d6..108329f 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ let path = require('path'); let fs = require('fs'); -let targz = require('tar.gz'); +let archiver = require('archiver'); function WebpackArchivePlugin(options) { } @@ -10,9 +10,15 @@ WebpackArchivePlugin.prototype.apply = function(compiler) { let output = compiler.options.output.path; // Create tarfile - let read = targz().createReadStream(output); - let write = fs.createWriteStream(`${output}.tar.gz`); - read.pipe(write); + let tar = archiver('tar'); + tar.pipe(fs.createWriteStream(`${output}.tar.gz`)); + + for(let asset in compiler.assets) { + console.log(asset); + tar.append(fs.createReadStream(file1), {name: 'file1.txt'}); + } + + tar.finalize(); callback(); }); diff --git a/package.json b/package.json index b276a3f..8533a83 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,14 @@ "name": "webpack-archive-plugin", "version": "1.0.0", "description": "Webpack plugin to create archives of emitted files", + "repository": "git+https://github.com/autochthe/webpack-archive-plugin.git", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "", - "license": "GPL-3.0" + "author": "Mara Kim", + "license": "GPL-3.0", + "dependencies": { + "archiver": "^1.0.1" + } }