by rajangdavis · 5y ago · 0 comments
The use case is to be able to leverage ES6/Typescript but have security built into the assets management. I'm not unhappy with the sprockets pipeline, but I would like to move forward with a modern assets pipeline without having to think too hard about the security implications of using yarn and node.
As for migrating to Deno: you probably will not be able to do this because most NPM packages will not run in Deno out of the box. Your build pipeline almost certainly relies on libraries like gulp/sass/globby, and those projects will need to be ported first (or made compatible by their authors).
Deno provides built in bundler. It is low level but there are third party packages built on top of it.
All the three packages mentioned have equivalent in the deno ecosystem.
Try searching on https://deno.land/std and https://deno.land/x
Manual for built-in stuff in deno: https://deno.land/manual
I've rolled my own assets pipeline with a Sinatra app, but did not tap into Node.
I think with Rails, there's probably some way to hook into the framework, just not sure how one would approach this.
It's a really good/barebones Roda project that uses webpack for assets/js pipeline and Tailwind CSS for UI. My methodology was:
1) clone the project
2) then swap out webpack for Snowpack
I was able to do that within 1 day and honestly, it was well worth the effort due to the amount of knowledge that come with it. Snowpack is much much faster and efficient in terms of resources vs webpack. The newest version, Snowpack3, uses esbuild internally which basically puts it on steroids. Good luck!
Reference: https://www.snowpack.dev/posts/2021-01-13-snowpack-3-0
FYI, in my dev stack, I'm running Puma server, Sidekiq worker, Snowpack dev server and Guard for live reload capabilities. I'm using Foreman to startup all 4 things using a Procfile and my startup time clocks in at 2.85s from issuing "foreman start". I hope this helps!
That vendors yours dependencies, so the whole project can then be started without yarn itself, but avoids the gigabytes and millions of files problem of node_modules.
Just an alternative.