Filament: [Web] Provide filament-cli-tools package on npm

Created on 21 Jun 2020  ยท  10Comments  ยท  Source: google/filament

The problem
Web developers don't care about C++ / C / Kotlin programming environments, or their programming ecosystem / culture. Running npm install on a nice starter-project, should give you everything you need.

The solution
I'm creating a starter-project. It will be available for anyone to use. As a web developer, i've spent many days actually, figuring out of this ecosystem works, just so i could get the example triangle.html tutorial to work. Now that i finally have it working in my own browser, i wanted to create a starter-project using webpack, and also integrating the cli-tools with npm scripts, to automate the compilation of .mat files, or possible do other nice things. To make this easier to maintain, it would be a good idea to include the binaries (matc etc.) in the npm package, so whenever Filament is upgraded from npm, so is the binaries.

Alternatives
Well of course this does not make maintenance obsolete, i am aware, that in some cases, maybe the cli-tools change so radically, that the starter-project would need maintenance anyways for the automated material compilation etc.

Maybe another solution would be, to make a seperate npm-package for just the cli-tools - maybe filament-cli-tools. That would perhaps be a better option, if we're concerned with bloat. The first suggestion however, i think is better, because it seems like the cli-tools, and current release version of Filament, is quite closely entangled, so it would make a lot of sense to keep them in the same "box".

Another option is of course, that i manually download binaries everytime Filament gets a new release... it just doesn't seem like a very good solution ๐Ÿ˜… I want it to be easy to maintain.

Backend
Feature for WebGL 2.0 and npm. This is specific to web only, because of radical different developer culture / ecosystems. Web developers are way more comfortable with npm-scripts and webpack, than messing around with some C cli tool.

Thank you for making Filament the best WebGL 3D render engine on the web!! ๐Ÿ™

Most helpful comment

Note that we have downloadable releases of the host tools. You do not need to build Filament yourself. What I'm not sure is how to distribute binaries for multiple platforms as part of a web project? Would the npm package contains all 3 binaries? It also greatly complicates our CI if we do it this way. Releases are almost entirely automated right now.

All 10 comments

This is an interesting idea but I'm not sure if npm is a great distribution platform for binary tools that are built from C++, especially since our tools work on macOS, Windows, and Linux.

Presently, for all platforms (not just web) we do expect developers to at least download and use our pre-built binary tools. Our tools do not ship with maven, npm, or cocoapods.

This is an interesting idea but I'm not sure if npm is a great distribution platform for binary tools that are built from C++, especially since our tools work on macOS, Windows, and Linux.

Sure it's crossplatform, and i got it working just fine - after spending _several days_ with errors in the console! This is not very accessible for web developers. I think this is why libraries like three.js is really popular on the web, even though they suck in technical terms, compared to Filament. It's easy to get started. I was so close to giving up on Filament actually. This is what motivates me to create this starter-project.

Presently, for all platforms (not just web) we do expect developers to at least download and use our pre-built binary tools. Our tools do not ship with maven, npm, or cocoapods.

Yes, i understand, coming from your perspective, why you have this expectation. But really, it makes the learning curve very steep when coming from a _different_ perspective. This is what i tried to address when speaking about developer culture / ecosystems.

But as i understand, you are not interested in distributing the binaries in a more friendly way, even though i'm offering to create the starter-project? ๐Ÿ‘Ž ๐Ÿ˜… Then i might close my project. I just thought it would be awesome to add webpack plugins for compiling materials etc.

Note that we have downloadable releases of the host tools. You do not need to build Filament yourself. What I'm not sure is how to distribute binaries for multiple platforms as part of a web project? Would the npm package contains all 3 binaries? It also greatly complicates our CI if we do it this way. Releases are almost entirely automated right now.

@romainguy Thank you for explaining. Personally i have already downloaded and successfully used the cli tools. This issue is more about, my quite bad experience with getting to this point, as a web developer.

Well the idea would be, to keep the binaries as a dev-dependency. This is maybe why, it would maybe make more sense to distribute it as a separate package. It is common to distribute cli tools on npm ๐Ÿ˜ƒ I'm actually not thinking about just the 3 binaries, i'm thinking about the entire bin folder. It will never get downloaded to a client browser anyway, this is only to make Filament more accessible to web developers.

If this would be distributed on npm, it would allow me to more easily and seamlessly make a starter-project, that would handle automation of the cli-tools. Well of course the starter project should do much more, but this is just related to this particular issue i pulled up, because really the binaries seems like all i was missing to be able to do this project.

If the CI is gonna be too complicated by this, i will just change the scope of my project, and do something for myself to use personally, but i just saw this as a nice opportunity to make my first contribution maybe, and try and generalize something for anyone to use. It's no problem โœŒ๏ธ

By 3 binaries I meant all the binaries for Windows, Linux, and macOS.

Omg of course ๐Ÿคฆโ€โ™‚๏ธ I guess now it really shows, that i'm just a web developer ๐Ÿ˜‚ But yea, well it makes a lot a sense when i think about it now, why we need different binaries for different OS. Sorry about that. I actually have no idea about how the cli tools already distributed on npm actually works, but my main motivation for wanting it distributed, was exactly to be able to provide a crossplatform starter-project, and have the automation work for anyone.

Maybe i could do a prototype for a wrapper? I could try to make a cli tool with node, which could then wrap all 3 binaries, and decide which to use, depending on the developers OS. Would you be interested in distributing such a package? The design goal of such a wrapper should be 0 maintenance, eg. work with any new cli-tools added to the 3 binaries, without touching the code. It should be able to automate and integrate in your CI then, but i don't know how much this would potentially complicate your CI.

The problem is building all those binaries and merging them in a single package. That would complicate things greatly. A wrapper is not the issue. The alternative is 3 separate builds/packages.

Alright - then it doesn't make sense to look further into this, until i have made a good starter-project. If there is not much interest in making such a project, i think i will scope it more towards my personal needs ๐Ÿ‘

I think we should close this for now, although we do want to make it easier for web developers to use Filament. (e.g. another idea is to create a simple drag-and-drop web app that wraps matc / cmgen)

Was this page helpful?
0 / 5 - 0 ratings