Skip to content

Improve web-assets build process #958

Closed

Description

@coffeemug

Our current process for building web-assets is flawed for a number of reasons:

  1. It requires people to install less, handlebars, and coffeescript, which many potential contributors complained about.
  2. The development process of these projects often involves breaking changes, so rethinkdb build process can often break as a surprise to us and our users.
  3. Our solution to prebuild web assets for tagged versions of rethink is ok, but it doesn't help people who want to be on the bleeding edge.

I propose the following alternative:

  • Check in js versions of less, handlebars, and coffeescript into the repo.
  • During the build, instead of using lessc and friends, just use v8/node to build our web assets.

This gives us a number of benefits:

  • People who want to build rethink off bleeding edge don't have to deal with less, handlebars, and coffeescript dependencies
  • We can simplify our configure script by removing all these dependencies
  • We'll have complete control of upgrading to newer versions of these components
  • The issue of web assets breaking will go away in practice

Activity

  1. ghost assigned on Jun 7, 2013
  2. jdoliner commented on Jun 7, 2013

    @jdoliner
    Contributor

    This has a very questionable smell to me but I can't think of anything better. Anyone have other potential solutions? Also there must be some people doing things similar to this. Any idea how they do it?

  3. coffeemug commented on Jun 7, 2013

    @coffeemug
    ContributorAuthor

    This has a very questionable smell to me

    Could you try to explain why? This actually seems ok in a sense that it's sort of like including bootstrap or underscore.js -- you wouldn't typically make it a build prereq, you'd just include it. I don't think it's a big leap to extend this to coffee/less and co.

  4. coffeemug commented on Jun 7, 2013

    @coffeemug
    ContributorAuthor

    Actually upon second thought, the web people use the equivalent of this technique. When they're not preprocessing on their own servers, they'd typically store a specific version less.js, coffee.js, etc. on their server, and then have the browser download those and run on the client.

  5. neumino commented on Jun 7, 2013

    @neumino
    Member

    Having less/handlebars/coffee-script in the repo sounds like a good idea to me.
    I'm a little worried about having node since it's platform dependent I guess?

    If it's doable, we should do it.
    I don't know how much work it would be for @AtnNn though.

  6. mlucy commented on Jun 7, 2013

    @mlucy
    Member

    This sounds like a good idea to me as well.

  7. jdoliner commented on Jun 7, 2013

    @jdoliner
    Contributor

    It seems like this could get to be a hairy situation if developers had their own versions of these tools installed and didn't realize our build process distributed a version of them. It's also a bit of repo bloat which is always a pain. That being said it seems like the pros might well outweigh the cons here I'm just wondering if there's an established way to do this that someone can point to. I know in the rails asset pipeline some people just have a pre-commit hook which compiles the static assets locally and commits them in a specific place. This seems like it would bloat the repo even more but I'm wondering if something like this could work.

  8. neumino commented on Jun 7, 2013

    @neumino
    Member

    There shouldn't be any conflict if people have less/handlebars/coffee-script installed on their machine.

    Basically handlebars/less/coffeescripts are just little scripts. We don't have to copy them in /usr/bin or whatever usual directory.

    The only disadvantage that I can see for now is that our repository will be a little bigger.

  9. jdoliner commented on Jun 7, 2013

    @jdoliner
    Contributor

    Well the conflict would come up if they didn't realize we were using the repo versions and tried to compile using their local versions and it didn't work.

  10. neumino commented on Jun 7, 2013

    @neumino
    Member

    We can easily make sure that we use the repo versions.

  11. jdoliner commented on Jun 7, 2013

    @jdoliner
    Contributor

    Just to clarify I'm not saying this is a big enough reason not to do it. But if I see a .coffee file I might reasonably guess that I can just pass it through my local version of coffee to see what it compiles to rather than using the build system. So we can't in general make sure that people in general use the build system version of coffee.

  12. AtnNn commented on Jun 7, 2013

    @AtnNn
    Member
  13. jdoliner commented on Jun 7, 2013

    @jdoliner
    Contributor

    Consider me completely sold then.

  14. coffeemug commented on Jun 7, 2013

    @coffeemug
    ContributorAuthor

    I'm a little worried about having node since it's platform dependent I guess?

    No, we couldn't include node. We'd still be stuck with that, but it doesn't cause nearly as many problems as less/coffee/handlebars because of breaking changes.

  15. neumino commented on Jun 7, 2013

    @neumino
    Member

    Some libraries don't support all node versions.
    I'm having trouble with handlebars and Ubuntu 13's node right now.

    2013/6/7 coffeemug [email protected]

    I'm a little worried about having node since it's platform dependent I
    guess?

    No, we couldn't include node. We'd still be stuck with that, but it
    doesn't cause nearly as many problems as less/coffee/handlebars because of
    breaking changes.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/958#issuecomment-19128691
    .

  16. 6 remaining items

  17. coffeemug commented on Jun 8, 2013

    @coffeemug
    ContributorAuthor

    Agree with @neumino.

    On Fri, Jun 7, 2013 at 6:19 PM, Michel [email protected] wrote:

    Let's do it for 1.7

    I would like to double check handlebars and less before freezing
    everything if you are ok with that.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/958#issuecomment-19140689
    .

  18. jdoliner commented on Jun 8, 2013

    @jdoliner
    Contributor

    Interestingly enough we might actually be better with the unminified
    versions here. While minified is smaller it probably will diff a lot worse
    which means over time its going to lead to a larger repo. This is just a
    guess though.
    On Jun 7, 2013 6:26 PM, "coffeemug" [email protected] wrote:

    Agree with @neumino.

    On Fri, Jun 7, 2013 at 6:19 PM, Michel [email protected] wrote:

    Let's do it for 1.7

    I would like to double check handlebars and less before freezing
    everything if you are ok with that.

    —
    Reply to this email directly or view it on GitHub<
    https://github.com/rethinkdb/rethinkdb/issues/958#issuecomment-19140689>
    .

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/958#issuecomment-19140787
    .

  19. neumino commented on Jun 9, 2013

    @neumino
    Member

    Just for people who are going to try to build from source while this issue is not solved yet

    These versions are known to work
    Less 1.3 -- 1.4 is not compatible with our version of bootstrap
    Handlebars 1.0.7 -- >= 1.0.8 have issues with the syntax {.../id}
    CoffeeScript 1.6.3 -- 1.5, 1.6 and 1.6.1 are shipped with bugs.

  20. coffeemug commented on Jun 10, 2013

    @coffeemug
    ContributorAuthor

    We're already going to specify precise versions in the 1.6 release. The thought process behind adding the libs directly is that many people complained about having to install these dependencies in order to build rethink from scratch, and including them would alleviate that.

  21. coffeemug commented on Jun 10, 2013

    @coffeemug
    ContributorAuthor

    Hmm, that makes sense. I'll talk to @AtnNn about it today.

    On Mon, Jun 10, 2013 at 11:50 AM, Herbert Vojčík
    [email protected]:

    OK, but instead of installing n dependencies, if you say "npm is a
    dependency", it will work out of the box, with (imho) cleaner design - the
    dependencies itself are installed by npm, and project only contains
    manifest with version numbers. I think this more manageable and changeable.
    Embedded library is harder to manipulate.

    Is requiring npm (that is, node, since it's bundled with it) too much?

    coffeemug wrote:

    We're already going to specify precise versions in the 1.6 release.
    The thought process behind adding the libs directly is that many
    people complained about having to install these dependencies in order
    to build rethink from scratch, and including them would alleviate that.

    —
    Reply to this email directly or view it on GitHub
    <#958 (comment)
    .

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/958#issuecomment-19218486
    .

  22. AtnNn commented on Jun 10, 2013

    @AtnNn
    Member

    Building rethinkdb should not require internet access. If it did, users behind a firewall or proxy will have trouble building rethinkdb, and our launchpad builds would fail because the build farm is not connected to the internet.

  23. ricardobeat commented on Jun 11, 2013

    @ricardobeat

    a thought: npm can install from a tarball, so you might be better off checking-in the zipped package (found with npm info modulename), at least it's treated as a binary by github and friends, smaller and easier to update.

  24. AtnNn commented on Jun 11, 2013

    @AtnNn
    Member

    @ricardobeat: @jdoliner correctly pointed out that plain text files take less space in git than zip files.

  25. AtnNn commented on Jun 11, 2013

    @AtnNn
    Member

    @Herby I think I agree with you. I was trying to avoid downloading dependencies when building because the other rethinkdb dependencies are big c++ libraries that also need to be configured and built, which is slow and error-prone.

  26. ricardobeat commented on Jun 13, 2013

    @ricardobeat

    @AtnNn minified != zipped, though it turns out git already compresses everything with zlib and handles binary deltas just fine, in the end neither would make any difference

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions