Skip to content

Commit

Permalink
fix(wordmap): mapping doesn't work in other directories as a package
Browse files Browse the repository at this point in the history
  • Loading branch information
drawnepicenter committed Jan 29, 2017
1 parent 749cefd commit 17b01e1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/commands/wordmap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"lodash": "^4.17.4",
"moment": "^2.17.1",
"noon": "^1.0.13",
"ora": "^1.0.0",
"ora": "^1.1.0",
"random-word": "^2.0.0",
"term-size": "^0.1.0",
"wrap-ansi": "^2.1.0",
Expand All @@ -57,17 +57,17 @@
"yargs": "git+https://github.com/yargs/yargs.git"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.21.0",
"babel-cli": "^6.22.2",
"babel-core": "^6.22.1",
"babel-plugin-istanbul": "^3.1.2",
"babel-plugin-lodash": "^3.2.11",
"babel-preset-latest": "^6.16.0",
"babel-register": "^6.18.0",
"babel-preset-latest": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"codeclimate-test-reporter": "^0.4.0",
"cross-env": "^3.1.4",
"cz-conventional-changelog": "^1.2.0",
"eslint": "^3.14.0",
"eslint": "^3.14.1",
"ink-docstrap": "^1.3.0",
"mocha": "^3.2.0",
"npm-check-updates": "^2.8.9",
Expand Down
10 changes: 9 additions & 1 deletion src/commands/wordmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ exports.handler = (argv) => {
if (config.verbose) themes.label(theme, 'down', 'Wordmap')
const word = argv.word
const l = argv.l
const bin = `${process.cwd()}/bin/leximaven.js`
let bin = ''
let dirExists = null
try {
fs.statSync('bin/leximaven.js')
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
dirExists ? bin = 'bin/leximaven.js' : bin = `${process.env.NODE_PATH}/leximaven/bin/leximaven.js`
child.spawnSync('node', [bin, 'rbrain', 'combine', `-m${l}`, `${word}`], { stdio: 'inherit' })
child.spawnSync('node', [bin, 'rbrain', 'info', `${word}`], { stdio: 'inherit' })
child.spawnSync('node', [bin, 'rbrain', 'rhyme', `-m${l}`, `${word}`], { stdio: 'inherit' })
Expand Down

0 comments on commit 17b01e1

Please sign in to comment.