{"_id":"@2npm/go","_rev":"2-2fc59be4c24c1f0b3fe2f100e953e567","name":"@2npm/go","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"@2npm/go","version":"0.0.1","description":"Distribute and install Go binaries via NPM","private":false,"publishConfig":{"access":"public"},"type":"module","license":"MIT","homepage":"https://2npm.netlify.app","repository":{"type":"git","url":"git+https://github.com/raulfdm/2npm.git"},"author":{"name":"Raul Melo","email":"contact@raulmelo.me"},"bin":{"go-2npm":"bin/index.js"},"dependencies":{"@manypkg/get-packages":"2.2.0","tar":"6.2.0"},"devDependencies":{"@biomejs/biome":"1.5.3","@types/node":"20","@types/tar":"6.1.11","typescript":"5.3.3","vite":"5.1.1"},"scripts":{"build":"vite build","dev":"tsx src/index.ts"},"bugs":{"url":"https://github.com/raulfdm/2npm/issues"},"_id":"@2npm/go@0.0.1","_integrity":"sha512-NihuaZXKi2OB1DAR9DHYZhZRG6ViyLq43GzjjoMLdx3gBQJ4Z13MSwhqMJZH1/MuGVg6AqYiP2zOdKZiEuU20g==","_resolved":"/tmp/07cf4dcb83c48530c897db35119f7774/2npm-go-0.0.1.tgz","_from":"file:2npm-go-0.0.1.tgz","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-NihuaZXKi2OB1DAR9DHYZhZRG6ViyLq43GzjjoMLdx3gBQJ4Z13MSwhqMJZH1/MuGVg6AqYiP2zOdKZiEuU20g==","shasum":"42e64af11adea167dba708a91d249471e04644b8","tarball":"https://registry.npmjs.org/@2npm/go/-/go-0.0.1.tgz","fileCount":5,"unpackedSize":8481,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFVKIsz9zP8cYcuvPz1T/gd1P1tEnzh2Z4ceUKq1bZUPAiEAzE9GGy0Txiyb7vZW1PgvhQyOIs/V5jgdi4MXBXOemD8="}]},"_npmUser":{"name":"raul-melo","email":"melo.raulf@gmail.com"},"directories":{},"maintainers":[{"name":"raul-melo","email":"melo.raulf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/go_0.0.1_1707893372079_0.330836853815776"},"_hasShrinkwrap":false},"0.0.2":{"name":"@2npm/go","version":"0.0.2","description":"Distribute and install Go binaries via NPM","private":false,"publishConfig":{"access":"public"},"type":"module","license":"MIT","homepage":"https://2npm.netlify.app","repository":{"type":"git","url":"git+https://github.com/raulfdm/2npm.git"},"author":{"name":"Raul Melo","email":"contact@raulmelo.me"},"bin":{"go-2npm":"bin/index.js"},"dependencies":{"@manypkg/get-packages":"2.2.0","@2npm/utils":"0.0.0"},"devDependencies":{"@types/node":"18","typescript":"5.3.3","vite":"5.1.1","@2npm/tsconfig":"0.0.0-development"},"packageManager":"pnpm@8.15.2","engines":{"node":">=18 <20"},"scripts":{"build":"vite build","dev":"tsx src/index.ts"},"bugs":{"url":"https://github.com/raulfdm/2npm/issues"},"_id":"@2npm/go@0.0.2","_integrity":"sha512-16d1UcIZr/pyCFjrBdXkLTRyzuXBSfNdYjBUcqy4VyjqQT4qj6RTvhmlxoJ+mus0zj+Pts0IbeYcGFNC891SZg==","_resolved":"/tmp/78a9b2dae43f5c776270aab107e46935/2npm-go-0.0.2.tgz","_from":"file:2npm-go-0.0.2.tgz","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-16d1UcIZr/pyCFjrBdXkLTRyzuXBSfNdYjBUcqy4VyjqQT4qj6RTvhmlxoJ+mus0zj+Pts0IbeYcGFNC891SZg==","shasum":"a911f5e46d4324b6f31d4dfbbfc73cca969fcc1f","tarball":"https://registry.npmjs.org/@2npm/go/-/go-0.0.2.tgz","fileCount":5,"unpackedSize":7955,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDceO9r7iiq/6SVAzgarSy4N4qZ1EL9mojuAP+tuQ8VOAIhALStR8/tUKHHbk1ZMjy7qXOChBipaZylpQVER0Chvy9Q"}]},"_npmUser":{"name":"raul-melo","email":"melo.raulf@gmail.com"},"directories":{},"maintainers":[{"name":"raul-melo","email":"melo.raulf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/go_0.0.2_1707895847006_0.7636688696237017"},"_hasShrinkwrap":false},"0.1.0":{"name":"@2npm/go","version":"0.1.0","description":"Distribute and install Go binaries via NPM","private":false,"publishConfig":{"access":"public"},"type":"module","license":"MIT","homepage":"https://2npm.netlify.app","repository":{"type":"git","url":"git+https://github.com/raulfdm/2npm.git"},"author":{"name":"Raul Melo","email":"contact@raulmelo.me"},"bin":{"go-2npm":"bin.js"},"dependencies":{"@2npm/utils":"0.0.1","@2npm/core":"0.1.0"},"devDependencies":{"@types/node":"18","typescript":"5.3.3","vite":"5.1.1","@2npm/tsconfig":"0.0.0-development"},"packageManager":"pnpm@8.15.2","engines":{"node":">=18 <20"},"scripts":{"build":"vite build","dev":"tsx src/index.ts"},"bugs":{"url":"https://github.com/raulfdm/2npm/issues"},"_id":"@2npm/go@0.1.0","_integrity":"sha512-X7HhSrTLr3/bA7+tI4NWW6hcJ4GGw4do2AK3s1EcPWFxYwIgCbcvnsTiVJbmVsG2hBQdxgHmGTc5W33BgY9CFA==","_resolved":"/tmp/7a4be6b80d88f88d82023587b561462a/2npm-go-0.1.0.tgz","_from":"file:2npm-go-0.1.0.tgz","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-X7HhSrTLr3/bA7+tI4NWW6hcJ4GGw4do2AK3s1EcPWFxYwIgCbcvnsTiVJbmVsG2hBQdxgHmGTc5W33BgY9CFA==","shasum":"a53ff1afb9c8db423f07f53f73f9297e48c9701a","tarball":"https://registry.npmjs.org/@2npm/go/-/go-0.1.0.tgz","fileCount":5,"unpackedSize":6610,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDx2Ngb/44ihW78lfNJ3PWzxBwD3h/KM1+gS19n691WIAIgPf0C/1K8G1H6LOKZf8F+YQv9AkvKniAwCnctvDGr3o8="}]},"_npmUser":{"name":"raul-melo","email":"melo.raulf@gmail.com"},"directories":{},"maintainers":[{"name":"raul-melo","email":"melo.raulf@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/go_0.1.0_1708329674685_0.882401498664267"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-14T06:49:31.999Z","0.0.1":"2024-02-14T06:49:32.223Z","modified":"2024-02-19T08:01:15.273Z","0.0.2":"2024-02-14T07:30:47.211Z","0.1.0":"2024-02-19T08:01:14.828Z"},"maintainers":[{"name":"raul-melo","email":"melo.raulf@gmail.com"}],"description":"Distribute and install Go binaries via NPM","homepage":"https://2npm.netlify.app","repository":{"type":"git","url":"git+https://github.com/raulfdm/2npm.git"},"author":{"name":"Raul Melo","email":"contact@raulmelo.me"},"bugs":{"url":"https://github.com/raulfdm/2npm/issues"},"license":"MIT","readme":"# go-npm2\n\nPublishing your Go binary via NPM made easy.\n\n## About\n\nThere are situations where we want to use a language like Go to build tooling that needs some performance. Therefore, the distribution of a binary written in another language might be hard for folks that are not familiar to that language.\n\nLike you or not, NodeJS (or any JS runtime) is been used for various kind projects, needless to say, the JS community is one of the largest in the world of development, meaning that those developers probably know how to install a global npm package, which makes the distribution easier and more accessible than \"asking to install a binary from somewhere\".\n\nThe main issue here is that we need a glue between a Go project and its ways of building and publishing vs. a JavaScript/NodeJS package ways of publishing.\n\nAnother huge pain point is to distribute the right package. When we build a Go app/tool, we need to specify the ARCH and the OS, which by default is the one we're, but that might not be the same one from the user.\n\nThis library attempts to solve this issue using technologies from 2024.\n\n## Inspiration\n\nThis project is an enhancement of [go-npm](), a project that attempts to solve this issue but which is no longer being maintained (last commit was 7 years ago) and doesn't cover the modern aspect of publishing a JS package, specially when it comes with the variarity of package managers (pnpm, bun, yarn, npm, deno, etc.).\n\nSo, I grasp the idea (which is totally correct) and cut some phases based on projects that do that like Biome<!-- Link to -->, SWC <!-- Link -->, Turbo <!-- Link -->.\n\n## How it works\n\nThe concept here is the following:\n\n1. You have your CLI/tool in Go\n1. You publish to Github/Gitlab or whatever platform where it can be reached via HTTP using Goreleaser <!-- Link --> (this will create binaries from a wide range of platforms)\n1. You create either a separate package (or in the same repo) a package.json that contains basic information and some instructions about how to fetch your package\n1. You create a simple `bin.js` file that will call your binary\n1. You add `go-npm2` as dependency, and add it as `postscript`. It'll use all the information in your package.json + the user OS and ARCH to download the right binary.\n\nOnce the user install globally (or locally) the package, a the `postscript` npm script will run, fetch the binary, save it in the folder you've specified. When the user invokes the bin command (defined in the package.json) of your package, the JS file will call your binary and it'll be executed.\n\n## Guide\n","readmeFilename":"README.md"}