Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

maven-deploy

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maven-deploy - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

48

index.js
var fs = require('fs');
var path = require('path');
var walk = require('fs-walk');
var JSZip = require('jszip');
var extend = require('util-extend');

@@ -9,2 +8,3 @@ var exec = require('child_process').exec;

var semver = require('semver');
var archiver = require('archiver');

@@ -14,3 +14,4 @@ var config = {

finalName: '{name}',
type: 'war'
type: 'war',
fileEncoding: 'utf-8'
},

@@ -22,3 +23,4 @@ validateConfig = defineOpts({

config.finalName + '"',
type : '?|string - "jar" or "war". default "' + config.type + '".'
type : '?|string - "jar" or "war". default "' + config.type + '".',
fileEncoding : '?|string - valid file encoding. default "' + config.fileEncoding + '"'
}),

@@ -32,3 +34,3 @@ validateRepos = defineOpts({

}),
pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
pkg = JSON.parse(fs.readFileSync('./package.json', config.fileEncoding));

@@ -47,3 +49,3 @@ function filterConfig () {

function warPath () {
function archivePath () {
return path.join(config.buildDir, config.finalName + '.' + config.type);

@@ -53,5 +55,6 @@ }

function mvnArgs (repoId, isSnapshot) {
var pkg = JSON.parse(fs.readFileSync('./package.json', config.fileEncoding));
var args = {
packaging : config.type,
file : warPath(),
file : archivePath(),
groupId : config.groupId,

@@ -111,15 +114,26 @@ artifactId : pkg.name,

package: function (done) {
var war = new JSZip();
walk.walkSync(config.buildDir, function (base, file, stat) {
if (stat.isDirectory() || file.indexOf(config.finalName) >= 0) {
return;
}
var filePath = path.join(base, file);
var data = fs.readFileSync(filePath, {encoding: 'utf-8'});
war.file(path.relative(config.buildDir, filePath), data);
});
var output = fs.createWriteStream(archivePath());
var buffer = war.generate({type:"nodebuffer", compression:'DEFLATE'});
fs.writeFileSync(warPath(), buffer);
var archive;
switch(config.type) {
case 'war':
case 'jar':
archive = archiver('zip');
break;
case 'tar.gz':
archive = archiver('tar', { gzip: true });
break;
default:
archive = archiver(config.type);
};
archive.pipe(output);
archive.bulk([
{ expand: true, cwd: config.buildDir, src: ['**', '!' + config.finalName + '.' + config.type] }
]);
archive.finalize();
if (done) { done(); }

@@ -126,0 +140,0 @@ },

{
"name": "maven-deploy",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple Node.js module to create a war-/jar-package and install/deploy to a local/remote Maven repository",

@@ -28,5 +28,5 @@ "main": "index.js",

"define-options": "0.1.x",
"jszip": "2.x",
"semver": "2.x"
"semver": "2.x",
"archiver": "0.10.x"
}
}

@@ -18,2 +18,3 @@ # maven-deploy

"type" : "war", // type of package. "war" or "jar" supported.
"fileEncoding" : "utf-8" // file encoding when traversing the file system, default is UTF-8
"repositories" : [ // array of repositories, each with id and url to a Maven repository.

@@ -20,0 +21,0 @@ {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc