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

amvn

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amvn - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

CHANGELOG.md

63

bin/cmd.js
#!/usr/bin/env node
var args = process.argv;
var kleur = require('kleur');
var which = require('which');
if (/node(js)?(\.exe)?$/.test(args[0])) {
args = args.slice(2);
}
// or use another library to detect support
kleur.enabled = require('color-support').level > 0;
var {
AwesomeMaven,
log,
logError
} = require('..');
var args = process.argv.slice(2);
function parseOptions(args) {

@@ -19,12 +26,12 @@

if (/^(--help)$/.test(a)) {
console.log();
console.log('usage: amvn [special options] [maven arguments...]'.yellow);
console.log();
console.log('Special Options: '.yellow);
console.log(' -w,--watch Watch src/main/resources for changes and'.yellow);
console.log(' update target directory'.yellow);
console.log(' -r,--reload Reload app on src/main/java changes'.yellow);
console.log(' --poll Use polling during watch'.yellow);
console.log();
console.log('mvn help follows...'.yellow);
log();
log('usage: amvn [special options] [maven arguments...]');
log();
log('Special Options: ');
log(' -w,--watch Watch src/main/resources for changes and');
log(' update target directory');
log(' -r,--reload Reload app on src/main/java changes');
log(' --poll Use polling during watch');
log();
log('mvn help follows...');
}

@@ -56,17 +63,23 @@

var which = require('which'),
amvn = require('../');
var options = parseOptions(args);
which('mvn', function(err, mvnPath) {
async function run() {
if (err) {
console.error('failed to grab mvn. do you have maven on your path?'.red);
console.error(err.message);
return process.exit(1);
try {
const mvnPath = await which('mvn');
log('make maven awesome');
AwesomeMaven(mvnPath, options);
} catch (err) {
logError('failed to grab mvn. do you have maven on your path?');
logError(err);
process.exit(1);
}
}
console.log('[AMVN] make maven awesome'.yellow);
amvn(mvnPath, options);
});
run().catch(err => {
logError(err);
process.exit(1);
});
'use strict';
var JAVA_SOURCES = 'src/main/java',

@@ -8,2 +7,4 @@ JAVA_RESOURCES = 'src/main/resources',

var color = require('kleur');
var spawn = require('child_process').spawn;

@@ -13,9 +14,25 @@ var path = require('path');

var chokidar = require('chokidar'),
colors = require('colors'),
cp = require('cp'),
mkdirp = require('mkdirp');
var prefix = '[AMVN]';
var log = console.log.bind(console);
function log(msg, ...args) {
if (!arguments.length) {
console.log();
}
console.log(color.yellow(`${prefix} ${msg}`), ...args);
}
function logError(msg, ...args) {
if (msg instanceof Error) {
console.error(msg, ...args);
} else {
console.error(color.red(`${prefix} ${msg}`), ...args);
}
}
function now() {

@@ -40,3 +57,3 @@ return new Date().getTime();

if (!cleanStart) {
log('[AMVN] restarting mvn...'.yellow);
log('restarting mvn...');
}

@@ -50,3 +67,3 @@

if (code && code !== 143) {
log('[AMVN] mvn exited unexpectedly (code=%s)'.red, code);
logError('mvn exited unexpectedly (code=%s)', code);

@@ -71,3 +88,3 @@ process.exit(1);

if (mvn) {
log('[AMVN] sending KILL to mvn...'.yellow);
log('sending KILL to mvn...');

@@ -77,3 +94,3 @@ try {

} catch (e) {
log(('[AMVN] received <' + e.message + '>. Already dead?').yellow);
log('received <' + e.message + '>. Already dead?');
}

@@ -86,5 +103,6 @@ }

} catch (e) {
// does not exist
log('[AMVN] mvn gone'.yellow);
log('mvn gone');

@@ -103,3 +121,3 @@ // clear timer

log('[AMVN] watching for %s changes...'.yellow, JAVA_RESOURCES);
log('watching for %s changes...', JAVA_RESOURCES);

@@ -115,3 +133,3 @@ var watcher = chokidar.watch(JAVA_RESOURCES + '/**/*', { usePolling: options.poll });

log('[AMVN] %s changed, updating in %s'.yellow, srcPath, JAVA_CLASSES);
log('%s changed, updating in %s', srcPath, JAVA_CLASSES);

@@ -127,3 +145,3 @@ mkdirp.sync(targetDirectory);

function registerReload() {
log('[AMVN] reloading mvn on %s changes...'.yellow, JAVA_SOURCES);
log('reloading mvn on %s changes...', JAVA_SOURCES);

@@ -137,3 +155,2 @@ // One-liner for current directory, ignores .dotfiles

if (options.watch) {

@@ -150,2 +167,6 @@ registerWatch();

module.exports = AwesomeMaven;
module.exports = {
log,
logError,
AwesomeMaven
};
{
"name": "amvn",
"description": "A Maven wrapper adding change detection and automatic rebuild",
"keywords": [
"maven",
"java",
"wrapper",
"development",
"tool",
"live-reload",
"change detection"
],
"version": "0.2.2",
"version": "0.3.0",
"scripts": {
"test": "echo \"Error: no test specified\""
"all": "run-s lint test",
"lint": "eslint .",
"test": "node bin/cmd.js --version"
},

@@ -26,11 +19,28 @@ "bin": {

},
"bugs": "https://github.com/nikku/amvn/issues",
"keywords": [
"maven",
"java",
"wrapper",
"development",
"tool",
"live-reload",
"change detection"
],
"dependencies": {
"chokidar": "^1.0.5",
"colors": "^1.1.2",
"chokidar": "^3.5.3",
"color-support": "^1.1.3",
"cp": "^0.2.0",
"debounce": "^1.0.0",
"mkdirp": "^0.5.1",
"which": "^1.1.1"
}
"kleur": "^4.1.4",
"mkdirp": "^1.0.4",
"which": "^2.0.2"
},
"devDependencies": {
"eslint": "^8.18.0",
"eslint-plugin-bpmn-io": "^0.14.0",
"npm-run-all": "^4.1.5"
},
"files": [
"bin",
"index.js"
]
}

@@ -1,20 +0,10 @@

# amvn (read: _awesome maven_)
# amvn
`amvn` is a small wrapper around [Maven](https://maven.apache.org/) that adds change detection and automatic rebuild to your projects.
[![CI](https://github.com/nikku/amvn/actions/workflows/CI.yml/badge.svg)](https://github.com/nikku/amvn/actions/workflows/CI.yml)
Use it to get faster feedback on changes in your project.
`amvn` (awesome maven) wraps [Maven](https://maven.apache.org/) to add change detection and automatic rebuild.
## How it works
## Installation
`amvn` keeps the running application in sync with your sources
* keeping `target/classes` up to date with `src/main/resources`
* reloading the underlying `mvn` instance on changes in `src/main/java`
Use it with modern web development stacks such as [Dropwizard](https://dropwizard.github.io/dropwizard/) that bootstrap _fast_.
## Get it
Install the library via [npm](https://www.npmjs.com):

@@ -33,3 +23,2 @@

[AMVN] watching for src/main/resources changes...
[AMVN] starting mvn...
[INFO] Scanning for projects...

@@ -49,4 +38,14 @@ [INFO]

## How it works
`amvn` keeps the running application in sync with your sources
* keeping `target/classes` up to date with `src/main/resources`
* reloading the underlying `mvn` instance on changes in `src/main/java`
Use it with modern web development stacks that bootstrap _fast_.
## License
MIT
MIT
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