Socket
Book a DemoInstallSign in
Socket

goreleaser-npm-publisher

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

goreleaser-npm-publisher

Build and publish npm packages based on goreleaser output folder

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
9
800%
Maintainers
0
Weekly downloads
 
Created
Source

goreleaser-npm-publisher logo

goreleaser-npm-publisher

NPM Version NPM Downloads NPM Unpacked Size
GitHub Actions Workflow Status Git Hub Release License
Quality Gate Status Coverage Lines of code

Automated tool for building and publishing NPM packages from Go binaries.

Quick start:

First, create a release of your package using goreleaser.

goreleaser build --clean

Then, run goreleaser-npm-publisher in the same directory. Make sure you're logged into the registry.

npx -y goreleaser-npm-publisher publish --clean

Alternatively, add the --token parameter to use your NPM_AUTH_TOKEN.

npx -y goreleaser-npm-publisher publish --clean --token npm_********

That’s it!

Use as a library

You can use goreleaser-npm-publisher as a standard npm package.

import { publish } from 'goreleaser-npm-publisher';

publish({ token: process.env.NPM_TOKEN })
  .then(console.log)
  .catch(console.error);

Use as a GitHub Action

You can use goreleaser-npm-publisher as a GitHub Action.

- name: Publish to npm
  uses: evg4b/goreleaser-npm-publisher-action@v1.0.0
  with:
    prefix: '@evg4b'
    token: ${{ secrets.NPM_AUTH_TOKEN }}

For more details, see the GitHub Action documentation.

CLI commands and options:

goreleaser-npm-publisher provides the following CLI commands:

list

Displays a list of packages that can be built in the current project using the specified options.

Options

OptiontypeDescription
projectstringSpecifies the path to the root of the Go package.
builderstringThe name of the builder whose output will be used for building the packages.
prefixstringNPM package scope prefix.
descriptionstringNPM package description.
verbosebooleanPrint verbose output.

build

Builds all packages that can be built in the current project using the specified parameters. The built packages can be found in the dist/npm folder.

OptionTypeDescription
projectstringSpecifies the path to the root of the Go package.
builderstringThe name of the builder whose output will be used for building the packages.
clearbooleanClean the dist/npm folder before the build.
prefixstringNPM package scope prefix.
descriptionstringNPM package description.
filesstring[]Files that should be included in the NPM package (e.g., README.md, LICENSE by default).
keywordsstring[]NPM package keywords.
verbosebooleanPrint verbose output.

publish

Builds and publishes to the registry all packages that can be built in the current project using the specified parameters.

OptionTypeDescription
projectstringSpecifies the path to the root of the Go package.
builderstringThe name of the builder whose output will be used for building the packages.
clearbooleanClean the dist/npm folder before the build.
prefixstringNPM package scope prefix.
descriptionstringNPM package description.
filesstring[]Files that should be included in the NPM package (e.g., README.md, LICENSE by default).
keywordsstring[]NPM package keywords.
tokenstringThe NPM authentication token.
verbosebooleanPrint verbose output.

Structure of npm package:

The output will include a main package and platform packages. The main package will contain the executable script that detects the platform and architecture, running the corresponding platform package. The platform packages will include the Go binary for the specific platform and architecture.

For example, for the package go-package with version 0.0.17, and with Goreleaser building for linux, windows, and darwin along with ia32, x64, and arm64 architectures:

Main package:

go-package@0.0.17
  os: linux, win32, darwin
  cpu: ia32, x64, arm64

Platform packages:

go-package_linux_386@0.0.17
  os: linux
  cpu: ia32
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-linux-386-go-package

go-package_windows_386@0.0.17
  os: win32
  cpu: ia32
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-windows-386-go-package-exe

go-package_linux_amd64@0.0.17
  os: linux
  cpu: x64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-linux-amd-64-v-1-go-package

go-package_linux_arm64@0.0.17
  os: linux
  cpu: arm64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-linux-arm-64-go-package

go-package_windows_arm64@0.0.17
  os: win32
  cpu: arm64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-windows-arm-64-go-package-exe

go-package_windows_amd64@0.0.17
  os: win32
  cpu: x64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-windows-amd-64-v-1-go-package-exe

go-package_darwin_amd64@0.0.17
  os: darwin
  cpu: x64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-darwin-amd-64-v-1-go-package

go-package_darwin_arm64@0.0.17
  os: darwin
  cpu: arm64
  bin: /Users/<user>/go-package/dist/npm/dist-go-package-darwin-arm-64-go-package

Supported platforms and architectures:

Platforms:

GOOSNode.js Platform
darwindarwin
linuxlinux
windowswin32
androidandroid
aixaix
freebsdfreebsd
openbsdopenbsd
solarissunos
netbsdnetbsd

Architectures:

GOARCHNode.js Platform
amd64x64
386ia32
armarm
arm64arm64
s390xs390x
s390s390
riscv64riscv64
ppc64ppc64
ppcppc
mipsmips

Keywords

goreleaser

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts