Skip to content

Commit 5e364d7

Browse files
authored
feat: publish npm package on release (#36)
* feat: publish npm package on release * fixup! feat: publish npm package on release * fixup! fixup! feat: publish npm package on release
1 parent 03c349f commit 5e364d7

File tree

11 files changed

+100
-15
lines changed

11 files changed

+100
-15
lines changed

.github/workflows/dxt-pack.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Checkout repository
1313
uses: actions/checkout@v5
1414

15-
- name: Use Node.js 20
15+
- name: Use Node.js 22
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: '20'
18+
node-version: '22'
1919
cache: 'npm'
2020

2121
- name: Install dependencies

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v5
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Build
28+
run: npm run build
29+
30+
- name: Publish to npm
31+
run: npm publish --provenance --access public
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
35+

.npmignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Source files (only dist/ should be published)
2+
src/
3+
tsconfig.json
4+
eslint.config.mjs
5+
6+
# Development and build files
7+
.github/
8+
scripts/
9+
node_modules/
10+
*.log
11+
12+
# Test files
13+
**/*.test.ts
14+
**/*.test.js
15+
16+
# Documentation (except README.md which is included)
17+
DOCKER.md
18+
19+
# Git and editor files
20+
.git/
21+
.gitignore
22+
.vscode/
23+
.cursor/
24+
.idea/
25+
*.swp
26+
*.swo
27+
*~

dist/package.json

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/index.js

100644100755
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import unusedImports from "eslint-plugin-unused-imports";
44
import eslintConfigPrettier from 'eslint-config-prettier'; // Ensures ESLint doesn't conflict with Prettier
55

66
export default tseslint.config(
7+
{ ignores: ['dist/**', '**/*.js'] },
78
{
89
files: ['src/**/*.ts'],
9-
ignores: ['**/*.js']
1010
},
1111
eslint.configs.recommended,
1212
tseslint.configs.recommended,

package-lock.json

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
{
2-
"name": "postman-api-mcp",
2+
"name": "@postman/postman-mcp-server",
33
"version": "2.0.1",
44
"description": "A simple MCP server to operate on the Postman API",
5-
"main": "index.js",
5+
"main": "dist/src/index.js",
66
"type": "module",
77
"scripts": {
88
"start:stdio": "node dist/src/index.js",
99
"build": "eslint --fix ./src && prettier --write \"src/**/*.ts\" && tsc",
10+
"prepack": "npm run build && node scripts/sync-dist-pkg.mjs",
1011
"test": "vitest",
1112
"lint": "eslint",
1213
"lint:fix": "eslint --fix"
1314
},
15+
"bin": "dist/src/index.js",
16+
"files": [
17+
"dist",
18+
"README.md",
19+
"LICENSE"
20+
],
21+
"publishConfig": {
22+
"access": "public"
23+
},
1424
"dependencies": {
1525
"@apidevtools/swagger-parser": "^11.0.0",
1626
"@modelcontextprotocol/sdk": "^1.17.0",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env tsx
1+
#!/usr/bin/env node
22

33
import dotenv from 'dotenv';
44
import { Server } from '@modelcontextprotocol/sdk/server/index.js';

src/tests/integration/direct.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('Postman MCP - Direct Integration Tests', () => {
8484
createdSpecIds = [];
8585
});
8686

87-
describe('Workspace Workflow',{ timeout: 30000 }, () => {
87+
describe('Workspace Workflow', { timeout: 30000 }, () => {
8888
it('should create, list, search, update, and delete a single workspace', async () => {
8989
const workspaceData = WorkspaceDataFactory.createWorkspace();
9090
const workspaceId = await createWorkspace(workspaceData);
@@ -126,7 +126,7 @@ describe('Postman MCP - Direct Integration Tests', () => {
126126
expect(WorkspaceDataFactory.validateResponse(verifyUpdateResult)).toBe(true);
127127
expect((verifyUpdateResult.content as any)[0].text).toContain(updatedName);
128128
});
129-
}, );
129+
});
130130

131131
describe('Environment Workflow', () => {
132132
it('should create, list, search, update, and delete a single environment', async () => {

0 commit comments

Comments
 (0)