New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

navy

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navy - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0-rc

lib/cli/updates.js

18

lib/cli/develop.js

@@ -130,10 +130,14 @@ 'use strict';

_context.next = 26;
return navy.kill([service]);
return navy.emitAsync('cli.develop.beforeLaunch');
case 26:
_context.next = 28;
return navy.launch([service], { noDeps: true });
return navy.kill([service]);
case 28:
_context.next = 30;
return navy.launch([service], { noDeps: true });
case 30:
console.log('🚧 ' + service + ' has now restarted in development 🚧');

@@ -143,6 +147,6 @@ console.log(_chalk2.default.dim('-----------'));

_context.next = 33;
_context.next = 35;
return navy.ps();
case 33:
case 35:
_context.t1 = function (_service) {

@@ -155,3 +159,3 @@ return _service.name === service;

if (container) {
_context.next = 37;
_context.next = 39;
break;

@@ -162,3 +166,3 @@ }

case 37:
case 39:
containerId = container.id;

@@ -177,3 +181,3 @@

case 39:
case 41:
case 'end':

@@ -180,0 +184,0 @@ return _context.stop();

@@ -27,3 +27,3 @@ 'use strict';

var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(services, opts) {
var env, serviceNames, launchedServiceNames, choices, _ref, selectedServices;
var env, navyFile, serviceNames, launchedServiceNames, selectedServiceNames, choices, _ref, selectedServices;

@@ -36,28 +36,46 @@ return _regenerator2.default.wrap(function _callee$(_context) {

_context.next = 3;
return env.getNavyFile();
case 3:
_context.t0 = _context.sent;
if (_context.t0) {
_context.next = 6;
break;
}
_context.t0 = {};
case 6:
navyFile = _context.t0;
_context.next = 9;
return env.ensurePluginsLoaded();
case 3:
_context.next = 5;
case 9:
_context.next = 11;
return env.getAvailableServiceNames();
case 5:
case 11:
serviceNames = _context.sent;
_context.next = 8;
_context.next = 14;
return env.getLaunchedServiceNames();
case 8:
case 14:
launchedServiceNames = _context.sent;
selectedServiceNames = launchedServiceNames.length > 0 ? launchedServiceNames : navyFile.launchDefaults || [];
if (!(!services || services.length === 0)) {
_context.next = 16;
_context.next = 23;
break;
}
choices = serviceNames.map(function (name) {
choices = serviceNames.sort(function (name) {
return selectedServiceNames.indexOf(name) === -1 ? 100 : -1;
}).map(function (name) {
return {
name: name,
checked: launchedServiceNames.indexOf(name) !== -1
checked: selectedServiceNames.indexOf(name) !== -1
};
});
_context.next = 13;
_context.next = 20;
return _inquirer2.default.prompt([{

@@ -70,3 +88,3 @@ type: 'checkbox',

case 13:
case 20:
_ref = _context.sent;

@@ -78,5 +96,5 @@ selectedServices = _ref.services;

case 16:
case 23:
if (!(services.length === 0)) {
_context.next = 18;
_context.next = 25;
break;

@@ -87,16 +105,16 @@ }

case 18:
_context.next = 20;
case 25:
_context.next = 27;
return env.emitAsync('cli.before.launch');
case 20:
case 27:
(0, _driverLogging.startDriverLogging)('Launching services...');
_context.next = 23;
_context.next = 30;
return env.launch(services);
case 23:
case 30:
(0, _driverLogging.stopDriverLogging)();
case 24:
case 31:
case 'end':

@@ -103,0 +121,0 @@ return _context.stop();

@@ -86,22 +86,34 @@ 'use strict';

process.on('unhandledRejection', function (ex) {
(0, _driverLogging.stopDriverLogging)({ success: false });
if (ex instanceof _errors.NavyError) {
ex.prettyPrint();
} else {
console.error(ex.stack);
}
process.exit();
});
if (driverLogging) (0, _driverLogging.startDriverLogging)(loadingLabelMap[fnName]);
navy = getNavy(envName);
_context.next = 9;
_context.next = 10;
return navy.ensurePluginsLoaded();
case 9:
_context.next = 11;
case 10:
_context.next = 12;
return navy.emitAsync('cli.before.' + fnName, fnName);
case 11:
_context.next = 13;
return wrapper(navy[fnName].apply(navy, [Array.isArray(maybeServices) && maybeServices.length === 0 ? undefined : maybeServices].concat((0, _toConsumableArray3.default)(otherArgs))));
case 12:
_context.next = 14;
return navy[fnName].apply(navy, [Array.isArray(maybeServices) && maybeServices.length === 0 ? undefined : maybeServices].concat((0, _toConsumableArray3.default)(otherArgs)));
case 13:
case 14:
returnVal = _context.sent;
_context.next = 16;
_context.next = 17;
return navy.emitAsync('cli.after.' + fnName, fnName);
case 16:
case 17:

@@ -111,3 +123,3 @@ if (driverLogging) (0, _driverLogging.stopDriverLogging)();

if (!Array.isArray(returnVal)) {
_context.next = 19;
_context.next = 20;
break;

@@ -118,3 +130,3 @@ }

case 19:
case 20:

@@ -125,3 +137,3 @@ if (returnVal != null) {

case 20:
case 21:
case 'end':

@@ -178,2 +190,4 @@ return _context.stop();

_commander2.default.command('updates').option('-e, --navy [env]', 'set the navy name to be used [' + defaultNavy + ']', defaultNavy).description('Checks for updates for all the launched services').action(lazyRequire('./updates'));
_commander2.default.command('logs [services...]').option('-e, --navy [env]', 'set the navy name to be used [' + defaultNavy + ']', defaultNavy).description('Streams logs for the given services').action(lazyRequire('./logs'));

@@ -180,0 +194,0 @@

@@ -8,2 +8,6 @@ 'use strict';

var _getIterator2 = require('babel-runtime/core-js/get-iterator');
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _regenerator = require('babel-runtime/regenerator');

@@ -92,6 +96,8 @@

var _composeProjects = require('../util/compose-projects');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getStatus(service, state) {
var statusString = service.status;
var statusString = service.status === 'exited' ? _chalk2.default.red(service.status) : service.status;

@@ -115,3 +121,4 @@ if (state && state.services && state.services[service.name]) {

var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(opts) {
var navies;
var navies, navyNames, launchedComposeProjects, notImportedProjects, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, projectName;
return _regenerator2.default.wrap(function _callee2$(_context2) {

@@ -126,5 +133,69 @@ while (1) {

navies = _context2.sent;
navyNames = navies.map(function (navy) {
return navy.name;
});
_context2.next = 6;
return (0, _composeProjects.fetchLaunchedComposeProjects)();
case 6:
launchedComposeProjects = _context2.sent;
notImportedProjects = launchedComposeProjects.filter(function (projectName) {
return navyNames.indexOf(projectName) === -1;
});
if (!(notImportedProjects.length > 0)) {
_context2.next = 28;
break;
}
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context2.prev = 12;
for (_iterator = (0, _getIterator3.default)(notImportedProjects); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
projectName = _step.value;
console.log();
console.log(' ' + _chalk2.default.underline(projectName) + ' ' + _chalk2.default.dim('(not imported)'));
console.log();
console.log(_chalk2.default.dim(' Import with ') + _chalk2.default.bold.white('$ navy import -e ' + projectName) + _chalk2.default.dim(' from the directory where your Docker Compose config is.'));
console.log();
}
_context2.next = 20;
break;
case 16:
_context2.prev = 16;
_context2.t0 = _context2['catch'](12);
_didIteratorError = true;
_iteratorError = _context2.t0;
case 20:
_context2.prev = 20;
_context2.prev = 21;
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
case 23:
_context2.prev = 23;
if (!_didIteratorError) {
_context2.next = 26;
break;
}
throw _iteratorError;
case 26:
return _context2.finish(23);
case 27:
return _context2.finish(20);
case 28:
if (!(navies.length === 0)) {
_context2.next = 6;
_context2.next = 31;
break;

@@ -136,3 +207,3 @@ }

case 6:
case 31:

@@ -143,3 +214,3 @@ navies.forEach(function (navy) {

case 7:
case 32:
case 'end':

@@ -149,3 +220,3 @@ return _context2.stop();

}
}, _callee2, this);
}, _callee2, this, [[12, 16, 20, 28], [21,, 23, 27]]);
}));

@@ -152,0 +223,0 @@ return function (_x3) {

@@ -386,9 +386,21 @@ 'use strict';

_context6.next = 2;
return this.isInitialised();
case 2:
if (_context6.sent) {
_context6.next = 4;
break;
}
throw new _errors.NavyNotInitialisedError(this.name);
case 4:
_context6.next = 6;
return this.getConfigProvider();
case 2:
case 6:
configProvider = _context6.sent;
if (configProvider) {
_context6.next = 5;
_context6.next = 9;
break;

@@ -399,17 +411,17 @@ }

case 5:
_context6.next = 7;
case 9:
_context6.next = 11;
return configProvider.getNavyFilePath();
case 7:
case 11:
navyFilePath = _context6.sent;
_context6.prev = 8;
_context6.prev = 12;
return _context6.abrupt('return', require(navyFilePath));
case 12:
_context6.prev = 12;
_context6.t0 = _context6['catch'](8);
case 16:
_context6.prev = 16;
_context6.t0 = _context6['catch'](12);
return _context6.abrupt('return', null);
case 15:
case 19:
case 'end':

@@ -419,3 +431,3 @@ return _context6.stop();

}
}, _callee6, this, [[8, 12]]);
}, _callee6, this, [[12, 16]]);
}));

@@ -422,0 +434,0 @@

@@ -57,3 +57,5 @@ 'use strict';

case 10:
_context2.next = 12;
pluginPaths = void 0;
_context2.prev = 11;
_context2.next = 14;
return _promise2.default.all(navyFile.plugins.map(function () {

@@ -79,6 +81,14 @@ var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(pluginName) {

case 12:
case 14:
pluginPaths = _context2.sent;
_context2.next = 20;
break;
case 17:
_context2.prev = 17;
_context2.t0 = _context2['catch'](11);
throw new Error('Couldn\'t resolve some of the plugins: ' + navyFile.plugins);
case 20:
// $FlowIgnore: entry point to plugin has to be dynamic

@@ -88,7 +98,11 @@ plugins = pluginPaths.map(function (pluginPath) {

});
return _context2.abrupt('return', plugins.map(function (Plugin) {
return _context2.abrupt('return', plugins.map(function (Plugin, index) {
if (typeof Plugin !== 'function') {
throw new Error(navyFile.plugins[index] + ' doesn\'t export a function as the entrypoint');
}
return Plugin(navy);
}));
case 15:
case 22:
case 'end':

@@ -98,3 +112,3 @@ return _context2.stop();

}
}, _callee2, this);
}, _callee2, this, [[11, 17]]);
}));

@@ -101,0 +115,0 @@ return function loadPlugins(_x, _x2) {

{
"name": "navy",
"version": "2.1.0",
"description": "Docker Compose wrapper to allow for easy development workflows",
"version": "2.2.0-rc",
"description": "A tool for easy multi-service development powered by Docker Compose",
"main": "lib/index.js",

@@ -40,4 +40,5 @@ "bin": {

"rimraf": "^2.5.2",
"simple-docker-registry-client": "^1.1.0",
"zygon": "^0.1.0"
}
}
navy
====
> Docker Compose wrapper to allow for easy development workflows
> A tool for easy multi-service development powered by Docker Compose
Navy is a command line tool and Node library to help make working on your application easier when it has many services,
perfect if you have a microservice-like architecture.
Navy is a command line tool and NodeJS library to help make working on your application easier when it has many services or backing services.
It adds additional functionality on top of Docker Compose which means it's super easy to get started if you're already familiar with the Docker ecosystem.
It builds on top of Docker Compose which means it's super easy to get started if you're already familiar with the Docker ecosystem. Simply point Navy at your existing `docker-compose.yml` and then you're good to go. With a single command, you can launch all of your services from your configuration and go on to manage those services and debug them.
We're very much early days with Navy, and lots of the functionality we are using in our team internally hasn't been open sourced here yet!
Navy is great for development as it allows you to put a service into "development mode" from the command line, which automatically mounts your local source code into the container. This is great for quickly working on multiple services without having to change any configuration.
Navy is also great for testing and CI as you can bring up your environment before your test run and even get information like host and ports of various services using the NodeJS API.
You can customise the functionality of Navy by writing Javascript plugins which can add workflow commands or control your service configuration at runtime using middleware.
## Features

@@ -31,3 +35,3 @@

Easily launch and manage environments from your code. Useful for if you want to spin up an environment at the start of a test run.
Easily launch and manage environments from your code. Useful for if you want to spin up an environment at the start of a test run or extract the host and port of a running service.

@@ -40,25 +44,10 @@ - **Plugin system**

## Installation
## Getting started
Navy can be installed globally as a CLI tool, or locally in your application so you can use the API to manage environments from code.
### CLI installation
```sh
$ npm install -g navy
$ navy help
```
### Package installation
[Read more of the documentation on our GitHub](https://github.com/momentumft/navy)
```sh
$ npm install --save-dev navy
```
## Getting started
- [Guide to using the CLI](../../docs/using-the-cli.md)
- [Introduction to the NodeJS API](../../docs/api-intro.md)
## License

@@ -65,0 +54,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