mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
fix: Add library export fields to npm package (main, types, exports)
## Problem PR #309 added `main`, `types`, and `exports` fields to package.json for library usage, but v2.18.9 was published without these fields. The publish scripts (both local and CI/CD) use package.runtime.json as the base and didn't copy these critical fields. Result: npm package broke library usage for multi-tenant backends. ## Root Cause Both scripts/publish-npm.sh and .github/workflows/release.yml: - Copy package.runtime.json as base package.json - Add metadata fields (name, bin, repository, etc.) - Missing: main, types, exports fields ## Changes ### 1. scripts/publish-npm.sh - Added main, types, exports fields to package.json generation - Removed test suite execution (already runs in CI) ### 2. .github/workflows/release.yml - Added main, types, exports fields to CI publish step ### 3. Version bump - Bumped to v2.18.10 to republish with correct fields ## Verification ✅ Local publish preparation tested ✅ Generated package.json has all required fields: - main: "dist/index.js" - types: "dist/index.d.ts" - exports: { "." : { types, require, import } } ✅ TypeScript compilation passes ✅ All library export paths validated ## Impact - Fixes library usage for multi-tenant deployments - Enables downstream n8n-mcp-backend project - Maintains backward compatibility (CLI/Docker unchanged) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@@ -334,6 +334,15 @@ jobs:
|
|||||||
const pkg = require('./package.json');
|
const pkg = require('./package.json');
|
||||||
pkg.name = 'n8n-mcp';
|
pkg.name = 'n8n-mcp';
|
||||||
pkg.description = 'Integration between n8n workflow automation and Model Context Protocol (MCP)';
|
pkg.description = 'Integration between n8n workflow automation and Model Context Protocol (MCP)';
|
||||||
|
pkg.main = 'dist/index.js';
|
||||||
|
pkg.types = 'dist/index.d.ts';
|
||||||
|
pkg.exports = {
|
||||||
|
'.': {
|
||||||
|
types: './dist/index.d.ts',
|
||||||
|
require: './dist/index.js',
|
||||||
|
import: './dist/index.js'
|
||||||
|
}
|
||||||
|
};
|
||||||
pkg.bin = { 'n8n-mcp': './dist/mcp/index.js' };
|
pkg.bin = { 'n8n-mcp': './dist/mcp/index.js' };
|
||||||
pkg.repository = { type: 'git', url: 'git+https://github.com/czlonkowski/n8n-mcp.git' };
|
pkg.repository = { type: 'git', url: 'git+https://github.com/czlonkowski/n8n-mcp.git' };
|
||||||
pkg.keywords = ['n8n', 'mcp', 'model-context-protocol', 'ai', 'workflow', 'automation'];
|
pkg.keywords = ['n8n', 'mcp', 'model-context-protocol', 'ai', 'workflow', 'automation'];
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "n8n-mcp",
|
"name": "n8n-mcp",
|
||||||
"version": "2.18.0",
|
"version": "2.18.10",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "n8n-mcp",
|
"name": "n8n-mcp",
|
||||||
"version": "2.18.0",
|
"version": "2.18.10",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.13.2",
|
"@modelcontextprotocol/sdk": "^1.13.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "n8n-mcp",
|
"name": "n8n-mcp",
|
||||||
"version": "2.18.9",
|
"version": "2.18.10",
|
||||||
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
"description": "Integration between n8n workflow automation and Model Context Protocol (MCP)",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "n8n-mcp-runtime",
|
"name": "n8n-mcp-runtime",
|
||||||
"version": "2.18.7",
|
"version": "2.18.10",
|
||||||
"description": "n8n MCP Server Runtime Dependencies Only",
|
"description": "n8n MCP Server Runtime Dependencies Only",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -11,29 +11,8 @@ NC='\033[0m' # No Color
|
|||||||
|
|
||||||
echo "🚀 Preparing n8n-mcp for npm publish..."
|
echo "🚀 Preparing n8n-mcp for npm publish..."
|
||||||
|
|
||||||
# Run tests first to ensure quality
|
# Skip tests - they already run in CI before merge/publish
|
||||||
echo "🧪 Running tests..."
|
echo "⏭️ Skipping tests (already verified in CI)"
|
||||||
TEST_OUTPUT=$(npm test 2>&1)
|
|
||||||
TEST_EXIT_CODE=$?
|
|
||||||
|
|
||||||
# Check test results - look for actual test failures vs coverage issues
|
|
||||||
if echo "$TEST_OUTPUT" | grep -q "Tests.*failed"; then
|
|
||||||
# Extract failed count using sed (portable)
|
|
||||||
FAILED_COUNT=$(echo "$TEST_OUTPUT" | sed -n 's/.*Tests.*\([0-9]*\) failed.*/\1/p' | head -1)
|
|
||||||
if [ "$FAILED_COUNT" != "0" ] && [ "$FAILED_COUNT" != "" ]; then
|
|
||||||
echo -e "${RED}❌ $FAILED_COUNT test(s) failed. Aborting publish.${NC}"
|
|
||||||
echo "$TEST_OUTPUT" | tail -20
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we got here, tests passed - check coverage
|
|
||||||
if echo "$TEST_OUTPUT" | grep -q "Coverage.*does not meet global threshold"; then
|
|
||||||
echo -e "${YELLOW}⚠️ All tests passed but coverage is below threshold${NC}"
|
|
||||||
echo -e "${YELLOW} Consider improving test coverage before next release${NC}"
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}✅ All tests passed with good coverage!${NC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Sync version to runtime package first
|
# Sync version to runtime package first
|
||||||
echo "🔄 Syncing version to package.runtime.json..."
|
echo "🔄 Syncing version to package.runtime.json..."
|
||||||
@@ -80,6 +59,15 @@ node -e "
|
|||||||
const pkg = require('./package.json');
|
const pkg = require('./package.json');
|
||||||
pkg.name = 'n8n-mcp';
|
pkg.name = 'n8n-mcp';
|
||||||
pkg.description = 'Integration between n8n workflow automation and Model Context Protocol (MCP)';
|
pkg.description = 'Integration between n8n workflow automation and Model Context Protocol (MCP)';
|
||||||
|
pkg.main = 'dist/index.js';
|
||||||
|
pkg.types = 'dist/index.d.ts';
|
||||||
|
pkg.exports = {
|
||||||
|
'.': {
|
||||||
|
types: './dist/index.d.ts',
|
||||||
|
require: './dist/index.js',
|
||||||
|
import: './dist/index.js'
|
||||||
|
}
|
||||||
|
};
|
||||||
pkg.bin = { 'n8n-mcp': './dist/mcp/index.js' };
|
pkg.bin = { 'n8n-mcp': './dist/mcp/index.js' };
|
||||||
pkg.repository = { type: 'git', url: 'git+https://github.com/czlonkowski/n8n-mcp.git' };
|
pkg.repository = { type: 'git', url: 'git+https://github.com/czlonkowski/n8n-mcp.git' };
|
||||||
pkg.keywords = ['n8n', 'mcp', 'model-context-protocol', 'ai', 'workflow', 'automation'];
|
pkg.keywords = ['n8n', 'mcp', 'model-context-protocol', 'ai', 'workflow', 'automation'];
|
||||||
|
|||||||
Reference in New Issue
Block a user