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

add a binary to build artifacts #132

Closed
shanejonas opened this issue Apr 4, 2019 · 5 comments
Closed

add a binary to build artifacts #132

shanejonas opened this issue Apr 4, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request stale
Projects

Comments

@shanejonas
Copy link
Member

shanejonas commented Apr 4, 2019

Is your feature request related to a problem? Please describe.
i’d like binary build for generator-client so that i can brew or apt-get or maybe even chocolatey install the generator client as an alternative to nodejs installed.

@BelfordZ BelfordZ added the enhancement New feature or request label Apr 4, 2019
@triage-new-issues triage-new-issues bot removed the triage label Apr 4, 2019
@BelfordZ BelfordZ added this to To do in OpenRPC via automation Apr 4, 2019
@shanejonas
Copy link
Member Author

shanejonas commented Apr 8, 2019

I tried a couple out and this was the one that worked the best for me:

https://github.com/nexe/nexe

produced a 33mb binary for a simple hello world.

Just a note
Don't think we really care about size here, since it's going to have to include a node.js binary for each platform.

In a language like rust though, it would be down to a couple hundred bytes probably as a comparison.

maybe one day we will have something that can produce typescript -> binary, or as typescript -> wasm gets more popular, the tooling will emerge.

@devonwesley
Copy link
Collaborator

devonwesley commented Apr 26, 2019

Working on this:

Current progress:

  • The binary, using the nexe tool spits out to be 161m
  • The schema-utils-js seem to be the package making the build a bit bigger, particularly the packages called "quicktype" and "json-schema".

Solution:

  • just going to keep looking into the packages, but it might not get better.
  • Theres flags you can pass to nexe that will build nodejs with certain packages, but I don't think this is going to help. Alot of the packages use each other.

Also when running --production on the schema-utils-jss node_modules folder its 148M by itself.

@shanejonas
Copy link
Member Author

I tested with generator-client on my machine with nexe installed globally and it ended up at 38M

image

maybe it's the way nexe is included in the project? not sure

@devonwesley
Copy link
Collaborator

Yeah, Did the build @shanejonas way, and it was alot smaller.

#!/usr/bin/env node

const { compile } = require('nexe');
const getVersion = require('./get-version');

const releasePath = './build/macos';
const artifactName = `openrpc-${getVersion}`;

compile({ 
  input: './bin/cli.js',
  output: `${releasePath}/${artifactName}`,
  name: artifactName,
})
.then(() => console.log(`Ready! ${artifactName}`));

This is the code I currently have inside of a script file with nexe installed as a dev dependency.

Maybe thats bloating it for some reason.

@stale
Copy link

stale bot commented Jun 25, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 25, 2019
@stale stale bot closed this as completed Jul 2, 2019
OpenRPC automation moved this from To do to Done Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
OpenRPC
  
Done
Development

No branches or pull requests

3 participants