-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make search-index module browserifiable #59
Conversation
This is a first step towards making search-index fully browserifiable. See #20. Note that currently version of levelup at the time of this writing depends on leveldown@0.10 (not 1.0).
search-index has been changed to accept a `db` property in its options, which should be a valid LevelUP-supported database (like level.js or memdown). search-index-browser.js is a browserify entry point that creates a level.js db and passes it in as an option to search-index.
The core browserify build is now working. Try it with: node_modules/.bin/beefy test/spec/0indexing-spec.js -- -i WNdb -i lapack (The two -i options are to ignore unused modules that are conditionally require()'d in NaturalNode, but not declared as dependnecies and thus not installed.) Still something not quite right with initializing the database, but getting close!
This is all very sensible, and that is a good plan! |
There seems to be a general issue with browserifying |
@fergiemcdowall Oh yeah, sorry! I meant to link that winston issue in the commit log. I basically resorted to the It occurs to me now that this could be even more localized if we moved all the |
Browserify (when used along with brfs transform) was failing on these when they were in a comma-separated `var` declaration. Just remove them since they're not being used.
Tests still failing in the browser, but they're running. Use: node_modules/.bin/beefy test/spec/0indexing-spec.js -- -i WNdb -i lapack And then browse to http://127.0.0.1:9966/test/index.html
A basic example showing that indexing and searching work in the browser. Run using beefy: `node_modules/.bin/beefy examples/basic.js -- -i WNdb -i lapack` and then browse to http://127.0.0.1:9966/examples/basic.html
@fergiemcdowall How would you feel about merging this? I haven't gotten all the tests working, but in the last commit (ff85429), there's a simple example working in the browser. Certainly worth getting all the tests running in the browser, too, but since there's already enough here for people to start playing around, maybe that could be filed as an issue for later? |
Thats a really great addition. Definitely worth merging this as a starting point and then extending, hardening and documenting before the next npm release. |
make search-index module browserifiable
Plan:
level
tolevelup
andleveldown
.level.js
for use in browserdb
property in theSearchIndex
options.search-index-browser.js
that exports same API assearch-index
, but creating and passing in alevel.js
db.