{"_id":"@cle-does-things/golang-npm","_rev":"3-4029a2f69d0bd90cbf9c2ac90a4896c8","name":"@cle-does-things/golang-npm","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@cle-does-things/golang-npm","version":"0.1.0","author":{"name":"Clelia Astra Bertelli","email":"astraberte9@gmail.com"},"license":"Apache-2.0","_id":"@cle-does-things/golang-npm@0.1.0","maintainers":[{"name":"cle-does-things","email":"astraberte9@gmail.com"}],"homepage":"https://github.com/AstraBert/golang-npm","bugs":{"url":"https://github.com/AstraBert/golang-npm/issues"},"bin":{"golang-npm":"bin/index.js"},"dist":{"shasum":"c5191ac569123a694ab63a177ea678d9dcf9119f","tarball":"https://registry.npmjs.org/@cle-does-things/golang-npm/-/golang-npm-0.1.0.tgz","fileCount":5,"integrity":"sha512-lDOmg6FWPn+n3B2uKJ//ogN2uk80aL0VSeSSXgDrKBM2E4mh6nv4rGHB9D69iYd+QEByYwwu8yqCq9D8sAeEvw==","signatures":[{"sig":"MEYCIQCAURhiccdlEfNQIm79Ufu6PFSNtRwdo2P+oi5IYK70GgIhAMUfjM+ocnVxiq/kmCWHmxOjSmgOlO4MRL8gMqKn4SLm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26137},"main":"index.js","gitHead":"baa50e4f030a2697d6cfd59e5e8a4aa989564542","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepublish":"npx babel src -d bin --presets=@babel/preset-env"},"_npmUser":{"name":"cle-does-things","email":"astraberte9@gmail.com"},"repository":{"url":"git+https://github.com/AstraBert/golang-npm.git","type":"git"},"_npmVersion":"10.8.2","description":"Distribute and install Go binaries via NPM","directories":{},"_nodeVersion":"18.20.8","dependencies":{"tar":"^6.2.1","mkdirp":"^3.0.1","node-fetch":"^2.7.0"},"_hasShrinkwrap":false,"devDependencies":{"@babel/cli":"^7.24.1","@babel/core":"^7.24.3","@babel/preset-env":"^7.24.3"},"_npmOperationalInternal":{"tmp":"tmp/golang-npm_0.1.0_1783625130737_0.1568153324951489","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@cle-does-things/golang-npm","version":"0.2.0","author":{"name":"Clelia Astra Bertelli","email":"astraberte9@gmail.com"},"license":"Apache-2.0","_id":"@cle-does-things/golang-npm@0.2.0","maintainers":[{"name":"cle-does-things","email":"astraberte9@gmail.com"}],"homepage":"https://github.com/AstraBert/golang-npm","bugs":{"url":"https://github.com/AstraBert/golang-npm/issues"},"bin":{"golang-npm":"bin/index.js"},"dist":{"shasum":"1a6d7361f9bbaee2475076a565665e1cc670b414","tarball":"https://registry.npmjs.org/@cle-does-things/golang-npm/-/golang-npm-0.2.0.tgz","fileCount":5,"integrity":"sha512-xhonjA11Ikp94PiERfNWUuQuQj588ggTXB0jg93LycsLt4bWG5ucF9GV9l+IC/7bZfIZ1AHUriKA9SVjgGcErA==","signatures":[{"sig":"MEUCIELo1+NvkYG6N5Nd3FiZvldpuTiUu7y3CaLRvQR4t50xAiEAkak8P2HNp6tYEYsSrzULTXUHAlUsIbmDJoMdIzQDios=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41888},"main":"index.js","gitHead":"a848544fd29f976ce9b0749ee427dc4f80a96d65","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepublish":"npx babel src -d bin --presets=@babel/preset-env"},"_npmUser":{"name":"cle-does-things","email":"astraberte9@gmail.com"},"repository":{"url":"git+https://github.com/AstraBert/golang-npm.git","type":"git"},"_npmVersion":"10.8.2","description":"Distribute and install Go binaries via NPM","directories":{},"_nodeVersion":"18.20.8","dependencies":{"tar":"^6.2.1","mkdirp":"^3.0.1","adm-zip":"^0.5.18","node-fetch":"^2.7.0"},"_hasShrinkwrap":false,"devDependencies":{"@babel/cli":"^7.24.1","@babel/core":"^7.24.3","@babel/preset-env":"^7.24.3"},"_npmOperationalInternal":{"tmp":"tmp/golang-npm_0.2.0_1783626192685_0.2474294520876117","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@cle-does-things/golang-npm","version":"0.3.0","description":"Distribute and install Go binaries via NPM","main":"index.js","bin":{"golang-npm":"bin/index.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepublish":"npx babel src -d bin --presets=@babel/preset-env"},"author":{"name":"Clelia Astra Bertelli","email":"astraberte9@gmail.com"},"license":"Apache-2.0","dependencies":{"adm-zip":"^0.5.18","mkdirp":"^3.0.1","node-fetch":"^2.7.0","tar":"^6.2.1"},"repository":{"type":"git","url":"git+https://github.com/AstraBert/golang-npm.git"},"homepage":"https://github.com/AstraBert/golang-npm","devDependencies":{"@babel/cli":"^7.24.1","@babel/core":"^7.24.3","@babel/preset-env":"^7.24.3"},"_id":"@cle-does-things/golang-npm@0.3.0","gitHead":"208b28f476c6750f17d4f6eb770b095cb2cf8574","bugs":{"url":"https://github.com/AstraBert/golang-npm/issues"},"_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-gGoUwAlOBYw4sbBaNonOzEvu1h3o1P59S5CV5P3313s94mQxVKvJlNx1v2Sr1GQZdetPG7MQzC/AZaOykUSIvg==","shasum":"f2593402e9d32a444b3f492d7842920605ea9cc2","tarball":"https://registry.npmjs.org/@cle-does-things/golang-npm/-/golang-npm-0.3.0.tgz","fileCount":5,"unpackedSize":42256,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE6jG2EkZBGp1vFWF4gd1wRJfPu/hBC1nCCSsP1qfKalAiApr6QJL9C6F5ExUsvR6FG4SmG1Qnfwr4e8xsSJ7fPSog=="}]},"_npmUser":{"name":"cle-does-things","email":"astraberte9@gmail.com"},"directories":{},"maintainers":[{"name":"cle-does-things","email":"astraberte9@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/golang-npm_0.3.0_1783627591933_0.956274137780196"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-09T19:25:30.520Z","modified":"2026-07-09T20:06:32.188Z","0.1.0":"2026-07-09T19:25:30.868Z","0.2.0":"2026-07-09T19:43:12.853Z","0.3.0":"2026-07-09T20:06:32.084Z"},"bugs":{"url":"https://github.com/AstraBert/golang-npm/issues"},"author":{"name":"Clelia Astra Bertelli","email":"astraberte9@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/AstraBert/golang-npm","repository":{"type":"git","url":"git+https://github.com/AstraBert/golang-npm.git"},"description":"Distribute and install Go binaries via NPM","maintainers":[{"name":"cle-does-things","email":"astraberte9@gmail.com"}],"readme":"## Golang NPM\nA package to publish go binaries via npm.\n\n## Why NPM?\n* **Cross-platform**: NPM is the only popular package manager that works cross-platform. \n* **Lower barier to entry**: Most developers have NPM installed already. \n* **Pain free publishing**: It just takes one command to publish - `npm publish`\n* **Dead simple install & update story**: `npm install/update -g your-awesome-app`\n* **Adds $PATH**: NPM will automatically add your binary location to $PATH and generate .cmd file for Windows. Your app just works after installation! \n\n## Motivation\nThis package is a fork of [go-npm](https://github.com/sanathkr/go-npm). This fork adds support for installation on arm64 architectures and removes all deprecated packages. Big thanks to the previous [author](https://github.com/sanathkr) and help save his [son](https://x.com/sanathkr_/status/1337227367102566403?s=20)\n\n## Usage\nNB: This package is for publishing global binaries. i.e. binaries installed with `-g` flag. \n\nStart by creating a package.json\n```bash\n  npm init\n```\nFollow the prompts and fill them with your own preferred fields. Mine looks like:\n\n```json\n  {\n  \"name\": \"@nelwhix/goserve\",\n  \"version\": \"1.1.9\",\n  \"description\": \"Golang CLI for starting blazing fast server for your local sites\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"postinstall\": \"golang-npm install\",\n    \"preuninstall\": \"golang-npm uninstall\",\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/Nelwhix/goserve.git\"\n  },\n  \"keywords\": [\n    \"cli\",\n    \"dev-server\",\n    \"go\"\n  ],\n  \"author\": \"Nelson Isioma\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/Nelwhix/goserve/issues\"\n  },\n  \"homepage\": \"https://github.com/nelwhix/goserve#readme\",\n  \"dependencies\": {\n    \"golang-npm\": \"^0.0.5\"\n  },\n    //   Specify details about your binary\n  \"goBinary\": {\n    //   Name of the binary file and what npm will alias as\n    \"name\": \"goserve\",\n    // Where to add the binary\n    \"path\": \"./bin\",\n    // Dynamic URL pointing to where the compressed binary exists based on version, platform, and the processor type (amd64, arm, and more)\n    \"url\": \"https://github.com/nelwhix/goserve/releases/download/v{{version}}/goserve_{{version}}_{{platform}}_{{arch}}.tar.gz\"\n  }\n}\n\n```\n\nYou would notice there are two commands in the scripts section\n```json\n  \"scripts\": {\n    \"postinstall\": \"golang-npm install\",\n    \"preuninstall\": \"golang-npm uninstall\",\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n```\n\nWhat postinstall does is that after installing the package it will pull the binary from where you saved it Github or Amazon S3,\n\npreuninstall removes the binary from the bin directory before NPM uninstalls the package.\nNB: sadly npm v7+ no longer supports uninstall scripts so `preuninstall` won't work. Reason [here](https://docs.npmjs.com/cli/v10/using-npm/scripts#a-note-on-a-lack-of-npm-uninstall-scripts)\n\nTo confirm if everything is working properly up to this point. You run:\n\n```bash\n  npm i golang-npm\n```\n\nThis will create a node_modules folder, add it to your .gitignore file, to avoid pushing it to Github.\n\nFor our CLI tool to work on all operating systems, we need to build a binary that works for each using Goreleaser\n\nTo install GoReleaser visit this [link](https://goreleaser.com/install/).\n\n### Generating Binaries\nBefore we can build our OS-specific binaries we need the following:\n\n- Github/Gitlab token(based on where you want your binary to reside)\n- Initialize version control (git)\n- Git basic commands\n\nCreating our token\n\n- Create your token [here](https://github.com/settings/tokens)\n- Set the Github token as an environment variable\n\n```bash\n  export GITHUB_TOKEN=<YOUR GITHUB TOKEN>\n```\n\n**Tagging a release**\n\nWe need to create a tag and push it as GoReleaser will use the latest Git tag of your repo.\n\n```bash\n  git tag -a <version> <commit> -m <release label>\n```\n\n\nDefine goreleaser config and define the arch and operating systems you want to build for.\n\n```\nIn your .goreleaser.yml file\n\nbuilds:\n  - binary: <Your CLI name>\n    goos:\n      - windows\n      - darwin\n      - linux\n    goarch:\n      - amd64\n      - arm64\n```\n\nRun goreleaser\n```bash\n  goreleaser release\n```\n\nThe above command will publish your CLI to Github or Gitlab based on where your repo is hosted.\n\n\nNext, this CLI needs to be published to npm.\n\nBefore you can do that ensure you have the following done:\n\n- An account on npmjs.com\n- Login to account using npm cli \n```bash \n  npm login \n```\n\nAnd now let's publish\n\n```bash\nnpm publish\n```\n\nYou just got your package published~\nThings you should note\n\n- For package documentation, update your repo readme and update the version on your package.json for npm to pick-up.\n- If you need to make any changes at all even a typo fix, you will have to update the npm version on package.json to update the package.","readmeFilename":"README.md"}