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

Suggestion: Installing from npm #519

Closed
RecuencoJones opened this issue Mar 20, 2019 · 8 comments
Closed

Suggestion: Installing from npm #519

RecuencoJones opened this issue Mar 20, 2019 · 8 comments
Assignees

Comments

@RecuencoJones
Copy link

RecuencoJones commented Mar 20, 2019

We are using gomplate quite frequently for many purposes and sometimes for node/npm projects.

Not sure if you know https://www.npmjs.com/package/go-npm but is a really nice tool that allows JS devs to easily install go binary packages as npm modules (either for a project or globally).

Its current status does not allow downloading untarred files – although I'm working on that (sanathkr/go-npm#8).

Do you think it would be possible to publish this/do you want to host this in your GitHub account?

I created a small proof of concept if you want to check it:

npm i -g RecuencoJones/gomplate-npm
gomplate version
@hairyhenderson
Copy link
Owner

Hi @RecuencoJones - thanks for taking the time to log this! This is an intriguing concept! I think this could make sense as yet another alternative for installing gomplate.

Is there a reason that your PR is necessary? gomplate is distributed as a binary, not a tar archive.

@RecuencoJones
Copy link
Author

Yes! The PR is absolutely necessary to allow go-npm to download binaries without compression, currently it only supports downloading .tar.gz resources.

@hairyhenderson
Copy link
Owner

ahh - I misunderstood! Thanks 😉

I'll think about the best place for this.

@RecuencoJones
Copy link
Author

Let me know when you come up to a decision!

Meanwhile I've created some automation scripts for publishing previous releases of gomplate to npm too in https://github.com/RecuencoJones/gomplate-npm/tree/feature/release-existing-versions

@hairyhenderson
Copy link
Owner

Cool! I hope to get this dealt with this weekend ($DAYJOB has been getting in the way 😂) - my thought is to put it in https://github.com/gomplate/gomplate-npm/ (as yet uncreated!)

@hairyhenderson hairyhenderson self-assigned this Mar 24, 2019
@hairyhenderson
Copy link
Owner

@RecuencoJones ok! I've copied your release-existing-versions branch over to https://github.com/gomplate/gomplate-npm - I've invited you to be a Collaborator for that repo, so you can keep working on it if you want.

I'll get a release pushed to https://www.npmjs.com/package/gomplate soon!

@hairyhenderson
Copy link
Owner

Ok, https://www.npmjs.com/package/gomplate is published, and it seems to work as expected:

$ npm i gomplate

> gomplate@3.3.1 postinstall /Users/hairyhenderson/tmp/node_modules/gomplate
> go-npm install

Downloading from URL: https://github.com/hairyhenderson/gomplate/releases/download/v3.3.1/gomplate_darwin-amd64-slim
Placed binary on /Users/hairyhenderson/tmp/node_modules/gomplate/node_modules/.bin/gomplate
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN tmp@1.0.0 No description
npm WARN tmp@1.0.0 No repository field.

+ gomplate@3.3.1
added 68 packages from 62 contributors and audited 91 packages in 17.524s
found 0 vulnerabilities
$ ls -alh ./node_modules/gomplate/node_modules/.bin/gomplate 
-rwxr-xr-x 1 hairyhenderson 5.7M Mar 24 14:12 ./node_modules/gomplate/node_modules/.bin/gomplate
$ ./node_modules/gomplate/node_modules/.bin/gomplate --version
gomplate version 3.3.1
$ du -sh node_modules 
13M     node_modules

I gotta say, installing 68 packages and 13MBs just to get a single 5.7MB binary seems a bit overkill... But that's one of the reasons I switched from Node.js to Go years ago 😉

Anyway, it works!

@RecuencoJones
Copy link
Author

Thank you very much! 😄

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