mootools / website

MooTools Website - move fast and break things
https://mootools.net
45 stars 31 forks source link

Hashes in builder #169

Open timwienk opened 10 years ago

timwienk commented 10 years ago

In the previous version of the website, one could use a generated hash to quickly (re-)select the parts/components/packages they want in their build of Core or More. Additionally, the hash was added to the built files. This functionality is not present in the new builder.

It worked through an sqlite3 database with a "hashes" table containing three columns:

The package-string is a semicolon separated list of components. In case anyone is interested:

If the feature is re-added, it would be preferable if this database can be re-used. The desired way of working would be to enter the hash to select the components in the builder, then be able to click "download".

Additionally, paths like http://mootools.net/more/<hash> used to select the right components automatically, that should probably work again as well (and/or redirect to http://mootools.net/more/builder/<hash>).

Example rows below (columns separated by pipes):

e8f3003df2d0919c1091b11854a53e9b|Core/Core;Core/String;Core/Event;Core/Browser;Core/Class;Core/Element.Style;Core/Element.Event;Core/Element.Delegation;Core/Element.Dimensions;Core/Fx;Core/Fx.CSS;Core/Fx.Tween;Core/Fx.Morph;Core/Fx.Transitions;Core/Request.HTML;Core/Request.JSON;Core/Cookie;Core/DOMReady|1415017941
2aa60ee2887f132a617b2a49754ef7fd|Core/Core;Core/Array;Core/String;Core/Number;Core/Function;Core/Object;Core/Event;Core/Browser;Core/Request;Core/Request.HTML;Core/Request.JSON;Core/Cookie;Core/JSON|1415017221
d1d2b98d3cae0d77aa29422996e67802|Core/Core;Core/Event;Core/Element;Core/Element.Style;Core/Element.Delegation;Core/Element.Dimensions;Core/Fx;Core/Fx.Tween;Core/Fx.Morph;Core/JSON;Core/DOMReady|1414767773
73a246bd9f16ce89e3ab685ff1e08599|Core/Array;Core/Function;Core/Event;Core/Class;Core/Element;Core/Element.Event;Core/Fx|1414689276
22af847e17dad82b2f32682e0f617e3e|Core/Core;Core/Array;Core/String;Core/Number;Core/Function;Core/Object;Core/Event;Core/Browser;Core/Class;Core/Class.Extras;Core/Slick.Parser;Core/Slick.Finder;Core/Element;Core/Element.Style;Core/Element.Event;Core/Element.Dimensions;Core/Fx;Core/Fx.CSS;Core/Fx.Tween;Core/Fx.Morph;Core/Fx.Transitions;Core/Request;Core/Request.HTML;Core/Request.JSON;Core/Cookie;Core/JSON;Core/DOMReady|1414636765

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/5805929-hashes-in-builder?utm_campaign=plugin&utm_content=tracker%2F130405&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F130405&utm_medium=issues&utm_source=github).
arian commented 10 years ago

big :+1:

SergioCrisostomo commented 10 years ago

I would like to help out here.

I made this (449a29bdab67b6252ce72bc221e8b707cea60e82) which redirects old hash URLs to the builder and populates the checkboxes. From there is just to press the button. Works also for eventually new hash urls like core/builder/hash

This does not have a database implemented and imported, just a test dummy here would need to be upgraded.

Made a live demo here which redirects from a old-style link core/hash (the first on @timwienk example) and is download-able.

If its usefull the commit could be used maybe.

timwienk commented 10 years ago

That's a good start.

I think we can just route /core/:hash, instead of a regex, though. As long as it's as last route.

timwienk commented 10 years ago

For the hashes we need to be able to both load and save them. So it may be a good idea to put that in a separate module. I put an untested example on top of your commit (https://github.com/timwienk/mootools-website/commit/8463fa0d), feel free to pull that onto yours if you want to use it.

I don't expect that to work like that (for one the sqlite3 and md5 packages will need to be added from npm), but how this would work:

var builderHash = require('middleware/builderHash')({
    core: '/srv/mootools/core/database/packager.sqlite',
    more: '/srv/mootools/more/database/packager.sqlite'
});

builderHash.load('core', 'e8f3003df2d0919c1091b11854a53e9b', function(data){
    if (data){
        console.log(data.hash, data.packages);
    } else {
        console.log('Hash not found.');
    }
});
builderHash.save('core', ['Core/Class'], function(data){
    if (data){
        console.log(data.hash, data.packages);
    } else {
        console.log('Hash not saved.');
    }
});

The paths should probably be set in some kind of configuration.

SergioCrisostomo commented 10 years ago

Nice! Will continue on it tonight. (if any other wants to back this would be cool)

timwienk commented 10 years ago

It might be worth checking if #171 can be resolved together with this issue, since the component selection code needs to be touched anyway.

timwienk commented 10 years ago

There is no graphical interface in the builder to enter hashes yet.

If the feature is re-added, it would be preferable if this database can be re-used. The desired way of working would be to enter the hash to select the components in the builder, then be able to click "download".

To illustrate, the builder "header" from the old website: hash

lorenzos commented 9 years ago

Hashes are not exported in the build when Download minified source code is checked. Unfortunately I didn't notice earlier, and now that I need an additional module, I have to guess what modules I chose before :neutral_face:

SergioCrisostomo commented 9 years ago

@lorenzos sorry for you, thanks for reporting. We just pushed a fix for that https://github.com/mootools/website/commit/6b954488e3a6b21ca655488a40288fbdc381c89c

lorenzos commented 9 years ago

Great 😉 Thank you