@microature/publisher-npm-release-plugin
v0.1.0
Published
NPM release asset plugin for @microature/publisher - uploads npm packages to git releases
Maintainers
Readme
@microature/publisher-npm-release-plugin
NPM release asset plugin for @microature/publisher.
Purpose: Uploads NPM packages (.tgz) to git releases as downloadable assets, not to npm registry.
Installation
npm install @microature/publisher-npm-release-pluginUsage
import { Publisher } from '@microature/publisher'
import { NpmReleasePlugin } from '@microature/publisher-npm-release-plugin'
const publisher = new Publisher(config)
// Register the plugin
const npmReleasePlugin = new NpmReleasePlugin()
publisher.registerPlugin('npm-assets', npmReleasePlugin)
// Plugin will automatically:
// 1. Detect version from package.json
// 2. Build project (if build script exists)
// 3. Create .tgz package
// 4. Upload to git release as assetWhat This Plugin Does
Version Detection
- Reads
package.json → versionfield - Suggests git tag name (e.g.,
v1.2.3)
Asset Preparation
- Runs
npm run build(if script exists) - Runs
npm run prepublishOnly(if script exists) - Creates
.tgzpackage withnpm pack
Release Upload
- Uploads
.tgzfile to GitLab/GitHub release as asset - Users can download and install with:
npm install <asset-url>
Configuration
{
gitHosting: {
type: 'gitlab', // or 'github'
token: 'your-gitlab-token',
projectId: 'project-id', // for GitLab
apiUrl: 'https://gitlab.com' // optional, for self-hosted
}
}Features
- ✅ Automatic version detection from
package.json - ✅ Project building before packaging
- ✅ NPM tarball creation
- ✅ GitLab release asset upload
- ✅ GitHub support (planned)
- ✅ Cleanup of temporary files
Package Flow
- Detect: Read version from
package.json - Build: Run build scripts if they exist
- Package: Create
.tgzwithnpm pack - Upload: Attach to git release as downloadable asset
- Cleanup: Remove temporary
.tgzfile
Difference from NPM Publishing
This plugin does NOT:
- ❌ Publish to npm registry
- ❌ Require npm authentication
- ❌ Use
npm publish
This plugin does:
- ✅ Create git release assets
- ✅ Enable git-based package distribution
- ✅ Allow installation via direct URLs
Installation from Git Release
Users can install packages directly from git releases:
# Download from release assets
npm install https://gitlab.com/org/project/-/releases/v1.2.3/downloads/package-1.2.3.tgzRequirements
- Node.js >= 18.0.0
- Git repository with remote configured
- GitLab or GitHub API access
License
MIT
