1.7 KiB
1.7 KiB
Publishing to npm
This document contains instructions for publishing this package to npm.
Prerequisites
- You need an npm account. Sign up at https://www.npmjs.com/ if you don't have one.
- You need to be logged in to npm from your command line.
Steps to Publish
-
Ensure your code is ready for publishing
- Make sure all necessary files are included (and unnecessary ones excluded via .npmignore)
- Verify that the package.json is correctly configured
-
Make the main script executable
chmod +x src/index.js -
Login to npm (if you haven't already)
npm login -
Publish to npm
npm publish -
For future updates
- Update the version number in package.json
- Run
npm publishagain
Setting up GitHub Actions for Automatic Publishing (Optional)
You can set up a GitHub workflow to automatically publish to npm when you create a new release.
- Create a GitHub secret called
NPM_TOKENwith your npm token - Create a file at
.github/workflows/publish-npm.ymlwith the following content:
name: Publish to npm
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org/'
- run: npm ci
- run: chmod +x src/index.js
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Verifying Publication
After publishing, you can verify that your package is available on npm by visiting: https://www.npmjs.com/package/openapi-mcp-generator