publish-on-npm

Publish Electron desktop apps to npm with per-platform optionalDependencies.

22|3|Updated Jul 28, 2024
One-click install
npx skills add https://github.com/webdevcody/go-mailing-list --skill publish-on-npm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: publish-on-npm
Source: https://github.com/webdevcody/go-mailing-list/tree/main/.claude/skills/publish-on-npm
Command: npx skills add https://github.com/webdevcody/go-mailing-list --skill publish-on-npm

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Publishing an Electron desktop app to npm often results in broken installs, missing binaries, or users downloading the wrong artifacts across platforms and architectures.

Core Features & Use Cases

  • Deterministic multi-phase release flow: runs an ordered workflow that prevents partial publishing mistakes by publishing sibling binaries before the root package.
  • Per-OS/arch optionalDependencies launcher pattern: packages each platform build into a sibling npm package and pins exact versions from the root so installs resolve correctly.
  • Builder detection with safety guardrails: auto-detects electron-builder vs electron-forge, refuses ambiguous setups, and blocks cross-compiling macOS from non-macOS hosts.
  • Unpacked-artifact validation: verifies that builds produce unpacked application directories (not installers) before assembling the publishable npm packages.

Quick Start

Ask the skill to publish your Electron desktop app to the npm registry using the platform-specific sibling optionalDependencies launcher pattern.

Frequently Asked Questions about publish-on-npm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I publish an Electron app to npm with platform-specific binaries?

Publish an Electron desktop app to npm by packaging each platform build into a sibling npm package and pinning them as optionalDependencies in the root package. This launcher pattern ensures users download the correct prebuilt binary for their OS and architecture.

Why does my npm global Electron install fail with missing binaries on different operating systems?

Missing binaries during npm global installs happen when platform builds are not packaged as sibling packages with correctly resolved optionalDependencies. Packaging per-OS unpacked artifacts into sibling packages and pinning exact versions from the root fixes this cross-platform resolution.

How to use electron-builder or electron-forge for npm release automation?

Automate npm releases by detecting your electron-builder or electron-forge pipeline, verifying a native build matrix, and assembling unpacked directories into sibling packages. The workflow publishes sibling binaries before the root package to prevent partial publish mistakes.

Can I cross-compile and publish macOS Electron binaries from a Windows or Linux machine?

Cross-compiling macOS Electron binaries from non-macOS hosts is blocked by safety guardrails. You must run the build and publish workflow on a macOS host to assemble and publish macOS-specific sibling npm packages correctly.

What is the optionalDependencies launcher pattern for desktop apps?

The optionalDependencies launcher pattern maps each platform and architecture to a sibling npm package containing the prebuilt binary. When users run npm i -g, npm resolves the correct sibling package, and a launcher script executes the appropriate binary.

How do I validate unpacked Electron artifacts before publishing to npm?

Validate unpacked Electron artifacts by verifying that electron-builder or electron-forge produces unpacked application directories rather than installers. The workflow checks for these unpacked directories before assembling and publishing the sibling npm packages.