temp fix for #19 - npm@5 issue

This commit is contained in:
Moos 2017-06-12 09:21:24 -07:00
parent 85cc97fdb1
commit 3c88deba7f
3 changed files with 36 additions and 5 deletions

View File

@ -289,6 +289,9 @@ See [bench/README](bench).
## Changes
1.1.3
- temporary fix for #19 issue with npm@5
1.1.2
- Fix DeprecationWarning for node 7.x (1.1.1)
- Fix occasional error for large offsets during seek

View File

@ -1,5 +1,7 @@
{
"name": "wordpos",
"version": "1.1.3",
"description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.",
"author": "Moos <mooster@42at.com>",
"keywords": [
"natural",
@ -10,8 +12,6 @@
"adverbs",
"verbs"
],
"description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.",
"version": "1.1.2",
"homepage": "https://github.com/moos/wordpos",
"engines": {
"node": ">=0.12"

View File

@ -40,18 +40,43 @@
* read index file between the two offsets
* binary search read data O(log avg)
*
* Copyright (c) 2012-2016 mooster@42at.com
* Copyright (c) 2012-2017 mooster@42at.com
* https://github.com/moos/wordpos
*
* Released under MIT license
*/
var
fs = require('fs'),
path = require('path'),
dictPath = path.resolve(__dirname, '..', 'node_modules', 'wordnet-db', 'dict');
// TEMP fix for https://github.com/moos/wordpos/issues/19
// Ensure /dict file before continuing
var timer = setInterval(check, 750);
var tries = 10;
process.stdout.write('checking ' + dictPath);
function check() {
if (fs.existsSync(dictPath)) {
clearInterval(timer);
process.stdout.write(' ready\n');
main();
} else if (--tries <= 0) {
console.log('\n%s not ready -- see https://github.com/moos/wordpos/issues/19. Abandoning!', dictPath)
process.exit(1);
}
process.stdout.write(' ' + tries);
}
function main() {
var
WNdb = require('../src/wordpos').WNdb,
util = require('util'),
BufferedReader = require ('./buffered-reader'),
_ = require('underscore')._,
fs = require('fs'),
path = require('path'),
KEY_LENGTH = 3,
stats = true,
eofKey = '_EOF_'; // should be unique
@ -62,6 +87,7 @@ if (process.argv.length < 3) {
process.exit(1);
}
_(process.argv.slice(2)).filter(function(arg){
// disable writing stats file
if (arg == '--no-stats') {
@ -153,3 +179,5 @@ _(process.argv.slice(2)).filter(function(arg){
})
.read();
});
}