Skip to content

Browser support (again!)#23

Merged
mcollina merged 15 commits intomasterfrom
browser
Jul 9, 2013
Merged

Browser support (again!)#23
mcollina merged 15 commits intomasterfrom
browser

Conversation

@refset
Copy link
Copy Markdown
Collaborator

@refset refset commented Jun 30, 2013

All bar 2 tests are working now. I stopped "should order two conditions based on their size (bis)" from running in the browser altogether. I've given up on the variablesMask approach for now - I'm not sure it would have actually worked for that particular test anyway.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 1, 2013

The thing is, that test is depending on approximateSize. You cannot really make it run without approximateSize.
The big question is why it was not passing in the first place :(.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 1, 2013

So, we need:

  • fix these two tests due to level.js discrepancy on del.
  • implement a good approximateSize based on variablesMask.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 1, 2013

This was referenced Jul 1, 2013
@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 2, 2013

Ok, it is now completely working:

# tests 76 
# pass 76
# fail 0 

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 2, 2013

What is also missing is:

  • a complete in-browser example.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 2, 2013

@jez0990 could you please mess with the Makefile to write an automated build of the package?
Maybe something that also produces a minified version and a minified+gzipped one.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 7, 2013

Ok, it just remains the README to be fixed!

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 8, 2013

I implemented the logic for building a working levelgraph bundle in the Makefile.
Everything is included, is 60K minified and gzipped.

However I do not like the end-user API:

var Leveljs = require("level-js");
var levelup = require("levelup");
var levelgraph = require("levelgraph");

db = levelgraph(levelup("test", { db: function(l) { return new Leveljs(l); } }));

I'll prefer to have a static bundle that do not expose require.

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 8, 2013

The whole LevelGraph with all dependencies is 60KB minified and gzipped. It's not that bad :).

@refset
Copy link
Copy Markdown
Collaborator Author

refset commented Jul 8, 2013

This is great :) it sucks that I've not had any time to look at this over the last week though!

I didn't know about Browserify's external requires until reading your commit just now but I guess they don't lend themselves to an elegant module interface. How about just exporting a function in the provided build with the default options so you can do

var db levelgraph("test")

And advanced users can follow the Make step you wrote if you only put it in the readme...?

This would need a file levelgraphjs.js:

var Leveljs = require("level-js");
var levelup = require("levelup");
var levelgraph = require("./index.js");

module.exports = function (name) {
  return levelgraph(levelup(name, { db: function(l) { return new Leveljs(l); } }));
}

And the new Make step:

./node_modules/.bin/browserify ./levelgraphjs.js:levelgraphjs > build/levelgraph.js

Does that sound sensible?

@refset
Copy link
Copy Markdown
Collaborator Author

refset commented Jul 8, 2013

Ha :)

@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 8, 2013

ahahhaha we had the same idea mostly at the same time.
I am trying to merge this back inside LevelGraph standard API, with LevelDown instead of Level-js.

mcollina added a commit that referenced this pull request Jul 9, 2013
@mcollina mcollina merged commit 2194935 into master Jul 9, 2013
@refset
Copy link
Copy Markdown
Collaborator Author

refset commented Jul 9, 2013

Looks great! May I delete the branch?

@mcollina mcollina deleted the browser branch July 9, 2013 12:55
@mcollina
Copy link
Copy Markdown
Collaborator

mcollina commented Jul 9, 2013

Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants