Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release standalone versions without a node requirement #2450

Closed
henrikbjorn opened this issue Mar 21, 2022 · 8 comments
Closed

Release standalone versions without a node requirement #2450

henrikbjorn opened this issue Mar 21, 2022 · 8 comments

Comments

@henrikbjorn
Copy link

Is your feature request related to a problem? Please describe.

In many development environments there is a desire to not install node and a lot of node packages e.g. Rails, Symfony, Laravel. This was also a "problem" with Tailwind until recently.

They have started doing standalone builds using https://github.com/vercel/pkg. This lets e.g. rubygems developers to include the binaries directly for the platforms and thus not require a separate nodejs build pipeline.

Describe the solution you'd like
Bulid mjml with https://github.com/vercel/pkg

Describe alternatives you've considered
Try and find an alternative no mjlm which might be hard to hear, but is a reality when scoping for solutions to a problem.

Additional context
Tailwind: https://tailwindcss.com/blog/standalone-cli
Tailwind-rails https://github.com/rails/tailwindcss-rails

Someone playing with this idea previously vercel/pkg#618

@henrikbjorn
Copy link
Author

henrikbjorn commented Mar 21, 2022

Doing a quick test (assuming that pkg is installed and that mjml is build)

$ pkg packages/mjml
> pkg@5.5.2
> Targets not specified. Assuming:
  node16-linux-x64, node16-macos-x64, node16-win-x64

and then

$ ./mjml-macos --version
mjml-core: 4.12.0
mjml-cli: 4.12.0
$ ./mjml-macos -i input.mjml 
# spits out https://gist.github.com/henrikbjorn/df1f159249117a8b876336986614f49d#file-input-mjml

Seems to work out of the box

@iRyusa
Copy link
Member

iRyusa commented Mar 21, 2022

I'm not against adding a binary version of MJML at release if it doesn't add much overhead as a we have already a browser build.

I wonder if .mjmlconfig and custom component works tho ? I guess it has some limitation that we need to document if we provide such build

@henrikbjorn
Copy link
Author

@iRyusa I think the limitations is that the dependencies needs to be loadable. e.g. for custom component there would be a need for a package.json file the components as dependencies.

The binaries produced are ~50mb in size and it takes 10s to create the 3 standard platforms from my tests.

@henrikbjorn
Copy link
Author

My understanding is that the binary just includes node, and everything node can load, it should be able to load also. Tailwind uses tailwind.config.js so it can load .mjmlconfig

@henrikbjorn
Copy link
Author

I can see that Tailwind have a custom package that includes some of their most used plugins. In order to make the standalone version usable for the vast majority https://github.com/tailwindlabs/tailwindcss/blob/master/standalone-cli/standalone.js

@iRyusa
Copy link
Member

iRyusa commented Mar 30, 2022

If someone willing to do a PR on this I'm fine with this 👍 .
Does it have any positive impact on perf (boot time) ?

@henrikbjorn
Copy link
Author

@iRyusa I think it is hard to do a PR since it requires some workflow etc etc. If it just is creating the pkg and using upload artifact then i can do one rather quickly.

@iRyusa
Copy link
Member

iRyusa commented Sep 4, 2022

As we have many things to handle and we're a small team I don't think we can take much effort supporting this binary. I'm closing

@iRyusa iRyusa closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2022
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

No branches or pull requests

2 participants