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

gobble-cli

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gobble-cli - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

9

lib/build.js
module.exports = function ( command, gobblefile, gobbledir ) {
var path = require( 'path' ),
chalk = require( 'chalk' ),
stevedore = require( 'stevedore' ),

@@ -9,7 +10,5 @@ logger = require( './utils/logger' ),

require( 'colors' );
targetDir = command.args[1];
if ( !targetDir ) {
logger.error( 'You must specify an output folder, e.g. ' + 'gobble build dist'.magenta );
logger.error( 'You must specify an output folder, e.g. ' + chalk.magenta( 'gobble build dist' ) );
process.exit( 1 );

@@ -33,3 +32,3 @@ }

if ( err.code === 'DIR_NOT_EMPTY' ) {
logger.error( 'destination directory (%s) is not empty! Use ' + '--force'.cyan + ' or ' + '-f'.cyan + ' to continue anyway', err.path );
logger.error( 'destination directory (%s) is not empty! Use ' + chalk.cyan( '--force' ) + ' or ' + chalk.cyan( '-f' ) + ' to continue anyway', err.path );
process.exit( 1 );

@@ -53,3 +52,3 @@ }

plugin = err.plugin;
logger.info( 'could not load %s plugin. Have you installed it? ' + 'npm install --save-dev gobble-%s'.cyan, plugin, plugin );
logger.info( 'could not load %s plugin. Have you installed it? ' + chalk.cyan( 'npm install --save-dev gobble-%s' ), plugin, plugin );

@@ -56,0 +55,0 @@ tryInstallPlugin( plugin, function ( err, result ) {

#!/usr/bin/env node
var findup = require( 'findup-sync' ),
resolve = require( 'resolve' ),
var Liftoff = require( 'liftoff' ),
interpret = require( 'interpret' ),
v8flags = require ( 'v8flags' ),
path = require( 'path' ),
chalk = require( 'chalk' ),
parseOptions = require( './utils/parseOptions' ),
serve = require( './serve' ),
build = require( './build' ),
help = require( './help' ),
gobblefile,
gobbledir,
cwd;
help = require( './help' );
require( 'colors' );
var command = parseOptions({

@@ -24,38 +21,68 @@ p: 'port',

if ( command.options.version ) {
return console.log( require( '../package.json' ).version );
}
var cli = new Liftoff({
name: 'gobble',
extensions: interpret.jsVariants,
nodeFlags: v8flags.fetch()
});
if ( command.options.help ) {
return help( command );
}
cli.on('require', function (name) {
console.log( 'Requiring external module:', chalk.cyan( name ) );
});
// find nearest gobblefile
gobblefile = findup( 'gobblefile.js', { nocase: true });
cli.on('requireFail', function (name) {
console.log( 'Failed to load external module:', chalk.red( name ) );
});
if ( !gobblefile ) {
console.log( 'You must have a gobblefile.js in your project\'s root folder in order to use gobble from the command line.\n\nSee ' + 'https://github.com/gobblejs/gobble/wiki/How-to-write-a-gobblefile'.cyan + ' for help getting started' );
process.exit( 1 );
}
cli.on('respawn', function (flags, child) {
var nodeFlags = flags.join(', ');
var pid = String(child.pid);
console.log('Node flags detected:', chalk.cyan( nodeFlags ) );
console.log('Respawned to PID:', chalk.cyan( pid ) );
});
cwd = path.dirname( gobblefile );
process.chdir( cwd );
cli.launch({
/*
configPath: argv.gobblefile,
cwd: argv.cwd,
require: argv.require
*/
}, function (env) {
if ( !resolve.sync( 'gobble', { basedir: cwd }) ) {
console.log( 'Could not find a local copy of gobble. You should probably install it with ' + 'npm install --save-dev gobble'.cyan );
}
var gobbledir;
gobbledir = path.join( cwd, '.gobble' );
if ( command.options.version ) {
return console.log( require( '../package.json' ).version );
}
if ( command.options.help ) {
return help( command );
}
// Execute command
if ( command.args[0] === 'build' ) {
process.env.GOBBLE_ENV = command.options.env || 'production';
return build( command, gobblefile, gobbledir );
}
if ( !env.modulePath ) {
console.log( 'Could not find a local copy of gobble. You should probably install it with ' + chalk.cyan( 'npm install --save-dev gobble' ) );
process.exit( 1 );
}
if ( !command.args[0] || command.args[0] === 'serve' ) {
return serve( command, gobblefile, gobbledir );
}
if ( !env.configPath ) {
console.log( 'You must have a gobblefile.js in your project\'s root folder in order to use gobble from the command line.\n\nSee ' + chalk.cyan( 'https://github.com/gobblejs/gobble/wiki/How-to-write-a-gobblefile' ) + ' for help getting started' );
process.exit( 1 );
}
return help( command );
if (process.cwd() !== env.cwd) {
process.chdir(env.cwd);
}
gobbledir = path.join( process.cwd(), '.gobble' );
// Execute command
if ( command.args[0] === 'build' ) {
process.env.GOBBLE_ENV = command.options.env || 'production';
return build( command, env.configPath, gobbledir );
}
if ( !command.args[0] || command.args[0] === 'serve' ) {
return serve( command, env.configPath, gobbledir );
}
return help( command );
});
module.exports = function ( command, gobblefile, gobbledir ) {
var path = require( 'path' ),
chokidar = require( 'graceful-chokidar' ),
chalk = require( 'chalk' ),
tryInstallPlugin = require( './utils/tryInstallPlugin' ),

@@ -73,3 +74,3 @@ logger = require( './utils/logger' ),

plugin = err.plugin;
logger.info( 'could not load %s plugin. Have you installed it? ' + 'npm install --save-dev gobble-%s'.cyan, plugin, plugin );
logger.info( 'could not load %s plugin. Have you installed it? ' + chalk.cyan( 'npm install --save-dev gobble-%s' ), plugin, plugin );

@@ -76,0 +77,0 @@ tryInstallPlugin( plugin, function ( err, result ) {

@@ -1,2 +0,2 @@

require( 'colors' );
var chalk = require( 'chalk' );

@@ -18,4 +18,4 @@ module.exports = [

return frame.replace( /∙+/g, function ( match ) {
return match.grey;
}).replace( '◦', '◦'.green );
return chalk.grey( match );
}).replace( '◦', chalk.green( '◦' ) );
});
/*global console */
var util = require( 'util' ),
chalk = require( 'chalk' ),
messages = '',

@@ -10,7 +11,7 @@ logger;

info: function () {
log( 'INFO', 'GOBBLE INFO '.cyan, util.format.apply( util, arguments ) );
log( 'INFO', chalk.cyan( 'GOBBLE INFO ' ), util.format.apply( util, arguments ) );
},
warn: function () {
log( 'WARNING', 'GOBBLE WARNING'.magenta, util.format.apply( util, arguments ) );
log( 'WARNING', chalk.magenta( 'GOBBLE WARNING' ), util.format.apply( util, arguments ) );
},

@@ -21,3 +22,3 @@

if ( typeof err !== 'object' ) {
log( 'ERROR', 'GOBBLE ERROR '.red, util.format.apply( util, arguments ) );
log( 'ERROR', chalk.red( 'GOBBLE ERROR ' ), util.format.apply( util, arguments ) );
return;

@@ -28,23 +29,23 @@ }

if ( err.gobble && err.code === 'TRANSFORMATION_FAILED' ) {
log( 'ERROR', 'GOBBLE ERROR '.red, node.id + ' transformation failed' );
log( 'ERROR', chalk.red( 'GOBBLE ERROR ' ), node.id + ' transformation failed' );
console.log( '============'.grey );
console.log( chalk.grey( '============' ) );
console.log( ( err.original.message || err.original ).trim() );
console.log( '------------'.grey );
console.log( chalk.grey( '------------' ) );
console.log( 'stack trace:' );
console.log( err.stack );
console.log( '============\n\n'.grey );
console.log( chalk.grey( '============\n\n' ) );
}
else if ( err.code === 'PORT_IN_USE' ) {
log( 'ERROR', 'GOBBLE ERROR '.red, 'port ' + err.port + ' is already in use. Are you already running gobble? You can specify a different port with e.g. ' + 'gobble -p 5678'.cyan );
log( 'ERROR', chalk.red( 'GOBBLE ERROR ' ), 'port ' + err.port + ' is already in use. Are you already running gobble? You can specify a different port with e.g. ' + chalk.cyan( 'gobble -p 5678' ) );
}
else {
log( 'ERROR', 'GOBBLE ERROR '.red, ( err.message || err ).trim() );
log( 'ERROR', chalk.red( 'GOBBLE ERROR ' ), ( err.message || err ).trim() );
console.log( '============'.grey );
console.log( chalk.grey( '============' ) );
console.log( 'stack trace:' );
console.log( err.stack );
console.log( '============\n\n'.grey );
console.log( chalk.grey( '============\n\n' ) );
}

@@ -51,0 +52,0 @@ },

{
"name": "gobble-cli",
"description": "Command line interface for gobble",
"version": "0.2.7",
"version": "0.2.8",
"author": "Rich Harris",

@@ -11,9 +11,10 @@ "repository": "https://github.com/gobblejs/gobble-cli",

"dependencies": {
"findup-sync": "~0.1.3",
"colors": "~0.6.2",
"resolve": "~1.0.0",
"chalk": "^0.5.1",
"cli-spinner": "~0.1.5",
"graceful-chokidar": "~0.1.0",
"interpret": "^0.3.7",
"liftoff": "^0.13.2",
"prompt": "~0.2.13",
"cli-spinner": "~0.1.5",
"stevedore": "~0.1.3",
"graceful-chokidar": "~0.1.0"
"v8flags": "^1.0.1"
},

@@ -20,0 +21,0 @@ "files": [

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