Socket
Socket
Sign inDemoInstall

leximaven

Package Overview
Dependencies
266
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.3.1

2

bin/commands/configuration/init.js

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

'use strict';var themes=require('../../themes');var chalk=require('chalk');var fs=require('fs');var noon=require('noon');var CFILE=process.env.HOME+'/.leximaven.noon';var PKGDIR=process.env.NODE_PATH+'/leximaven/';exports.command='init';exports.desc='Initialize config file';exports.builder={force:{alias:'f',desc:'Force overwriting configuration file',default:false,type:'boolean'}};exports.handler=function(argv){var obj=null;var configExists=null;var dirExists=null;try{fs.statSync('default.config.noon');configExists=true;}catch(e){if(e.code==='ENOENT')configExists=false;}if(configExists){obj=noon.load('default.config.noon');}else{try{fs.statSync(PKGDIR);dirExists=true;}catch(e){if(e.code==='ENOENT'){dirExists=false;}}if(dirExists){obj=noon.load(PKGDIR+'default.config.noon');}else{throw new Error('Package dir not found, set NODE_PATH per documentation.');}}obj.dmuse.date.stamp=new Date().toJSON();obj.onelook.date.stamp=new Date().toJSON();obj.rbrain.date.stamp=new Date().toJSON();obj.wordnik.date.stamp=new Date().toJSON();var fileExists=null;try{fs.statSync(CFILE);fileExists=true;}catch(e){if(e.code==='ENOENT'){fileExists=false;}}if(fileExists){if(argv.f){var _config=noon.load(CFILE);obj.dmuse.date.stamp=_config.dmuse.date.stamp;obj.dmuse.date.remain=_config.dmuse.date.remain;obj.onelook.date.stamp=_config.onelook.date.stamp;obj.onelook.date.remain=_config.onelook.date.remain;obj.rbrain.date.stamp=_config.rbrain.date.stamp;obj.rbrain.date.remain=_config.rbrain.date.remain;obj.wordnik.date.stamp=_config.wordnik.date.stamp;obj.wordnik.date.remain=_config.wordnik.date.remain;noon.save(CFILE,obj);console.log('Overwrote '+chalk.white.bold(CFILE)+'.');}else{console.log('Using configuration at '+chalk.white.bold(CFILE)+'.');}}else if(!fileExists){noon.save(CFILE,obj);console.log('Created '+chalk.white.bold(CFILE)+'.');}var config=noon.load(CFILE);var theme=themes.loadTheme(config.theme);if(argv.v){themes.label(theme,'down','Configuration');console.log('Your current configuration is:');console.log(noon.stringify(config,{indent:2,align:true,maxalign:32,sort:true,colors:true}));console.log('');}};
'use strict';var themes=require('../../themes');var chalk=require('chalk');var fs=require('fs');var noon=require('noon');var os=require('os');var CFILE=process.env.HOME+'/.leximaven.noon';var PKGDIR=process.env.NODE_PATH+'/leximaven/';exports.command='init';exports.desc='Initialize config file';exports.builder={force:{alias:'f',desc:'Force overwriting configuration file',default:false,type:'boolean'}};exports.handler=function(argv){var obj=null;var configExists=null;var dirExists=null;try{fs.statSync('default.config.noon');configExists=true;}catch(e){if(e.code==='ENOENT')configExists=false;}if(configExists){obj=noon.load('default.config.noon');}else{try{fs.statSync(PKGDIR);dirExists=true;}catch(e){if(e.code==='ENOENT'){dirExists=false;}}if(dirExists){obj=noon.load(PKGDIR+'default.config.noon');}else{throw new Error('Package dir not found, set NODE_PATH per documentation.');}}obj.dmuse.date.stamp=new Date().toJSON();obj.onelook.date.stamp=new Date().toJSON();obj.rbrain.date.stamp=new Date().toJSON();obj.wordnik.date.stamp=new Date().toJSON();var fileExists=null;try{fs.statSync(CFILE);fileExists=true;}catch(e){if(e.code==='ENOENT'){fileExists=false;}}if(fileExists){if(argv.f){var _config=noon.load(CFILE);obj.dmuse.date.stamp=_config.dmuse.date.stamp;obj.dmuse.date.remain=_config.dmuse.date.remain;obj.onelook.date.stamp=_config.onelook.date.stamp;obj.onelook.date.remain=_config.onelook.date.remain;obj.rbrain.date.stamp=_config.rbrain.date.stamp;obj.rbrain.date.remain=_config.rbrain.date.remain;obj.wordnik.date.stamp=_config.wordnik.date.stamp;obj.wordnik.date.remain=_config.wordnik.date.remain;noon.save(CFILE,obj);console.log('Overwrote '+chalk.white.bold(CFILE)+'.');}else{console.log('Using configuration at '+chalk.white.bold(CFILE)+'.');}}else if(!fileExists){noon.save(CFILE,obj);console.log('Created '+chalk.white.bold(CFILE)+'.');}var config=noon.load(CFILE);var theme=themes.loadTheme(config.theme);if(os.platform()==='windows')themes.label(theme,'right','Notice','Please see the README for best user experience on Windows.');if(argv.v){themes.label(theme,'down','Configuration');console.log('Your current configuration is:');console.log(noon.stringify(config,{indent:2,align:true,maxalign:32,sort:true,colors:true}));console.log('');}};

@@ -9,7 +9,7 @@ 'use strict';/* eslint max-len:0 */var _=require('lodash');var chalk=require('chalk');var fs=require('fs');var glob=require('glob');var noon=require('noon');var TDIR=null;var themeDirExists=null;try{fs.statSync('themes');themeDirExists=true;}catch(e){if(e.code==='ENOENT')themeDirExists=false;}themeDirExists?TDIR='themes/':TDIR=process.env.NODE_PATH+'/leximaven/themes/';/**

* @return {Object} load The style to use
*/exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}if(!dirExists)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
*/exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.leximaven.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
* Gets themes for list command
* @public
* @return {Array} List of theme names
*/exports.getThemes=function(){var list=[];var dirExists=null;var files=[];try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}if(!dirExists)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));files=glob.sync(TDIR+'*.noon');for(var i=0;i<=files.length-1;i++){list.push(files[i].replace(/[a-z0-9/_.]*themes\//,'').replace(/\.noon/,''));}return list;};/**
*/exports.getThemes=function(){var list=[];var dirExists=null;var files=[];try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.leximaven.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));files=glob.sync(TDIR+'*.noon');for(var i=0;i<=files.length-1;i++){list.push(files[i].replace(/[a-z0-9/_.]*themes\//,'').replace(/\.noon/,''));}return list;};/**
* Prints label, connector, and content

@@ -16,0 +16,0 @@ * @public

@@ -5,2 +5,13 @@ # Change Log

<a name="2.3.1"></a>
## [2.3.1](https://github.com/drawnepicenter/leximaven/compare/v2.3.0...v2.3.1) (2017-01-25)
### Bug Fixes
* **project:** config init error ([8b0bfa1](https://github.com/drawnepicenter/leximaven/commit/8b0bfa1))
* **themes:** control fallback msg with verbose ([9e3de72](https://github.com/drawnepicenter/leximaven/commit/9e3de72)), closes [#16](https://github.com/drawnepicenter/leximaven/issues/16)
<a name="2.3.0"></a>

@@ -7,0 +18,0 @@ # [2.3.0](https://github.com/drawnepicenter/leximaven/compare/v2.2.0...v2.3.0) (2017-01-23)

{
"name": "leximaven",
"version": "2.3.0",
"version": "2.3.1",
"description": "A command line tool for searching word-related APIs.",

@@ -21,4 +21,4 @@ "author": "Andrew Prentice",

"climate": "codeclimate-test-reporter < lcov.info",
"cover": "cross-env BABEL_ENV=test babel src -d bin && redrun test lcov clean bin",
"lcov": "nyc report -r text-lcov > lcov.info",
"cover": "cross-env BABEL_ENV=test babel src -d bin",
"lcov": "nyc report -r text-lcov > lcov.info && npm run clean && npm run bin",
"lint": "standard --fix src",

@@ -25,0 +25,0 @@ "pretest": "cross-env BABEL_ENV=test babel test/test.es6 -o test/test.js",

@@ -13,6 +13,18 @@ # leximaven

## Installation
## Platform
To initialize the config file and load themes, your NODE_PATH environment variable must point to the **lib/node_modules** directory of the Node.js installation. You can set this path automatically like this:
Looking for testers on OSX. Developed and tested on Linux. Works on Windows, see [Windows](#windows-installation) below.
Supported Node.js versions:
- 7.x
- 6.x
- 5.x
- 4.x - Works but it's really slow
## Install
### Linux installation
To initialize the config file and load themes, your NODE_PATH environment variable must point to the **node_modules** directory of the Node.js installation. You can set this path automatically like this:
export NP=$(which node)

@@ -32,2 +44,8 @@ export BP=${NP%bin/node} #this replaces the string '/bin/node'

### Windows installation
I highly recommend using [nodist](https://github.com/marcelklehr/nodist) to install Node.js on Windows. It automatically sets %NODE_PATH% for you, though you may have to edit it to make sure it doesn't contain itself (i.e. C:\...\...\node_modules;%NODE_PATH%). If you install Node.js manually, `npm install --global leximaven` will install the package in C:\Users\username\AppData\Roaming\npm\node_modules. And if you just do `npm install leximaven` then it will install the package to a subfolder of the Node.js installation, but that won't be the NODE_PATH folder unless you manually set it. Either way, you're going to have to mess around with Windows environment variables to get it to work. And don't forget to put your [Wordnik API key](http://developer.wordnik.com/) into an environment variable **WORDNIK**
As for getting the ANSI color escape codes to work, [Cmder](http://cmder.net/) seems to be the easiest way. It doesn't install a full linux environment like Cygwin, but you can still use some linux commands like **which**, **cat**, and **ls**.
## Usage

@@ -34,0 +52,0 @@

@@ -6,2 +6,3 @@ const themes = require('../../themes')

const noon = require('noon')
const os = require('os')

@@ -83,2 +84,3 @@ const CFILE = `${process.env.HOME}/.leximaven.noon`

const theme = themes.loadTheme(config.theme)
if (os.platform() === 'windows') themes.label(theme, 'right', 'Notice', 'Please see the README for best user experience on Windows.')
if (argv.v) {

@@ -85,0 +87,0 @@ themes.label(theme, 'down', 'Configuration')

@@ -38,3 +38,5 @@ /* eslint max-len:0 */

}
if (!dirExists) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
const CFILE = `${process.env.HOME}/.leximaven.noon`
const config = noon.load(CFILE)
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
load = noon.load(`${TDIR}${theme}.noon`)

@@ -59,3 +61,5 @@ return load

}
if (!dirExists) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
const CFILE = `${process.env.HOME}/.leximaven.noon`
const config = noon.load(CFILE)
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
files = glob.sync(`${TDIR}*.noon`)

@@ -62,0 +66,0 @@ for (let i = 0; i <= files.length - 1; i++) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc