feat: add comprehensive update script for n8n dependencies
- Created update-and-publish-prep.sh script that automates entire update process - Script now runs all 1,182 tests before allowing updates - Automatically bumps version and updates README badges - Integrates with npm publish preparation workflow - Added 'npm run update:all' command for one-step updates - Updated MEMORY_N8N_UPDATE.md with new comprehensive process The new workflow ensures: - All tests pass before version bump - README badges stay in sync - Consistent commit messages - Ready for npm publish after update 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,49 @@
|
|||||||
# n8n Update Process - Quick Reference
|
# n8n Update Process - Quick Reference
|
||||||
|
|
||||||
## Quick Steps to Update n8n
|
## Quick One-Command Update
|
||||||
|
|
||||||
When there's a new n8n version available, follow these steps:
|
For a complete update with tests and publish preparation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run update:all
|
||||||
|
```
|
||||||
|
|
||||||
|
This single command will:
|
||||||
|
1. ✅ Check for n8n updates and ask for confirmation
|
||||||
|
2. ✅ Update all n8n dependencies to latest compatible versions
|
||||||
|
3. ✅ Run all 1,182 tests (933 unit + 249 integration)
|
||||||
|
4. ✅ Validate critical nodes
|
||||||
|
5. ✅ Build the project
|
||||||
|
6. ✅ Bump the version
|
||||||
|
7. ✅ Update README badges
|
||||||
|
8. ✅ Prepare everything for npm publish
|
||||||
|
9. ✅ Create a comprehensive commit
|
||||||
|
|
||||||
|
## Manual Steps (if needed)
|
||||||
|
|
||||||
|
### Quick Steps to Update n8n
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Update n8n dependencies automatically
|
# 1. Update n8n dependencies automatically
|
||||||
npm run update:n8n
|
npm run update:n8n
|
||||||
|
|
||||||
# 2. Validate the update
|
# 2. Run tests
|
||||||
|
npm test
|
||||||
|
|
||||||
|
# 3. Validate the update
|
||||||
npm run validate
|
npm run validate
|
||||||
|
|
||||||
# 3. Commit and push
|
# 4. Build
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# 5. Bump version
|
||||||
|
npm version patch
|
||||||
|
|
||||||
|
# 6. Update README badges manually
|
||||||
|
# - Update version badge
|
||||||
|
# - Update n8n version badge
|
||||||
|
|
||||||
|
# 7. Commit and push
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "chore: update n8n to vX.X.X
|
git commit -m "chore: update n8n to vX.X.X
|
||||||
|
|
||||||
@@ -21,6 +53,7 @@ git commit -m "chore: update n8n to vX.X.X
|
|||||||
- Updated @n8n/n8n-nodes-langchain from X.X.X to X.X.X
|
- Updated @n8n/n8n-nodes-langchain from X.X.X to X.X.X
|
||||||
- Rebuilt node database with XXX nodes
|
- Rebuilt node database with XXX nodes
|
||||||
- Sanitized XXX workflow templates (if present)
|
- Sanitized XXX workflow templates (if present)
|
||||||
|
- All 1,182 tests passing (933 unit, 249 integration)
|
||||||
- All validation tests passing
|
- All validation tests passing
|
||||||
|
|
||||||
🤖 Generated with [Claude Code](https://claude.ai/code)
|
🤖 Generated with [Claude Code](https://claude.ai/code)
|
||||||
@@ -31,8 +64,21 @@ git push origin main
|
|||||||
|
|
||||||
## What the Commands Do
|
## What the Commands Do
|
||||||
|
|
||||||
|
### `npm run update:all`
|
||||||
|
This comprehensive command:
|
||||||
|
1. Checks current branch and git status
|
||||||
|
2. Shows current versions and checks for updates
|
||||||
|
3. Updates all n8n dependencies to compatible versions
|
||||||
|
4. **Runs the complete test suite** (NEW!)
|
||||||
|
5. Validates critical nodes
|
||||||
|
6. Builds the project
|
||||||
|
7. Bumps the patch version
|
||||||
|
8. Updates version badges in README
|
||||||
|
9. Creates a detailed commit with all changes
|
||||||
|
10. Provides next steps for GitHub release and npm publish
|
||||||
|
|
||||||
### `npm run update:n8n`
|
### `npm run update:n8n`
|
||||||
This single command:
|
This command:
|
||||||
1. Checks for the latest n8n version
|
1. Checks for the latest n8n version
|
||||||
2. Updates n8n and all its required dependencies (n8n-core, n8n-workflow, @n8n/n8n-nodes-langchain)
|
2. Updates n8n and all its required dependencies (n8n-core, n8n-workflow, @n8n/n8n-nodes-langchain)
|
||||||
3. Runs `npm install` to update package-lock.json
|
3. Runs `npm install` to update package-lock.json
|
||||||
@@ -45,13 +91,20 @@ This single command:
|
|||||||
- Shows database statistics
|
- Shows database statistics
|
||||||
- Confirms everything is working correctly
|
- Confirms everything is working correctly
|
||||||
|
|
||||||
|
### `npm test`
|
||||||
|
- Runs all 1,182 tests
|
||||||
|
- Unit tests: 933 tests across 30 files
|
||||||
|
- Integration tests: 249 tests across 14 files
|
||||||
|
- Must pass before publishing!
|
||||||
|
|
||||||
## Important Notes
|
## Important Notes
|
||||||
|
|
||||||
1. **Always run on main branch** - Make sure you're on main and it's clean
|
1. **Always run on main branch** - Make sure you're on main and it's clean
|
||||||
2. **The update script is smart** - It automatically syncs all n8n dependencies to compatible versions
|
2. **The update script is smart** - It automatically syncs all n8n dependencies to compatible versions
|
||||||
3. **Database rebuild is automatic** - The update script handles this for you
|
3. **Tests are required** - The publish script now runs tests automatically
|
||||||
4. **Template sanitization is automatic** - Any API tokens in workflow templates are replaced with placeholders
|
4. **Database rebuild is automatic** - The update script handles this for you
|
||||||
5. **Docker image builds automatically** - Pushing to GitHub triggers the workflow
|
5. **Template sanitization is automatic** - Any API tokens in workflow templates are replaced with placeholders
|
||||||
|
6. **Docker image builds automatically** - Pushing to GitHub triggers the workflow
|
||||||
|
|
||||||
## GitHub Push Protection
|
## GitHub Push Protection
|
||||||
|
|
||||||
@@ -62,12 +115,18 @@ As of July 2025, GitHub's push protection may block database pushes if they cont
|
|||||||
3. If push is still blocked, use the GitHub web interface to review and allow the push
|
3. If push is still blocked, use the GitHub web interface to review and allow the push
|
||||||
|
|
||||||
## Time Estimate
|
## Time Estimate
|
||||||
- Total time: ~3-5 minutes
|
- Total time: ~5-7 minutes
|
||||||
- Most time is spent on `npm install` and database rebuild
|
- Test suite: ~2.5 minutes
|
||||||
- The actual commands take seconds to run
|
- npm install and database rebuild: ~2-3 minutes
|
||||||
|
- The rest: seconds
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
If tests fail:
|
||||||
|
1. Check the test output for specific failures
|
||||||
|
2. Run `npm run test:unit` or `npm run test:integration` separately
|
||||||
|
3. Fix any issues before proceeding with the update
|
||||||
|
|
||||||
If validation fails:
|
If validation fails:
|
||||||
1. Check the error message - usually it's a node type reference issue
|
1. Check the error message - usually it's a node type reference issue
|
||||||
2. The update script handles most compatibility issues automatically
|
2. The update script handles most compatibility issues automatically
|
||||||
@@ -79,6 +138,23 @@ To see what would be updated without making changes:
|
|||||||
npm run update:n8n:check
|
npm run update:n8n:check
|
||||||
```
|
```
|
||||||
|
|
||||||
At the end, update version badges in README.md
|
|
||||||
|
|
||||||
This shows you the available updates without modifying anything.
|
This shows you the available updates without modifying anything.
|
||||||
|
|
||||||
|
## Publishing to npm
|
||||||
|
|
||||||
|
After updating:
|
||||||
|
```bash
|
||||||
|
# Prepare for publish (runs tests automatically)
|
||||||
|
npm run prepare:publish
|
||||||
|
|
||||||
|
# Follow the instructions to publish with OTP
|
||||||
|
cd npm-publish-temp
|
||||||
|
npm publish --otp=YOUR_OTP_CODE
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creating a GitHub Release
|
||||||
|
|
||||||
|
After pushing:
|
||||||
|
```bash
|
||||||
|
gh release create vX.X.X --title "vX.X.X" --notes "Updated n8n to vX.X.X"
|
||||||
|
```
|
||||||
@@ -66,7 +66,8 @@
|
|||||||
"db:init": "node -e \"new (require('./dist/services/sqlite-storage-service').SQLiteStorageService)(); console.log('Database initialized')\"",
|
"db:init": "node -e \"new (require('./dist/services/sqlite-storage-service').SQLiteStorageService)(); console.log('Database initialized')\"",
|
||||||
"docs:rebuild": "ts-node src/scripts/rebuild-database.ts",
|
"docs:rebuild": "ts-node src/scripts/rebuild-database.ts",
|
||||||
"sync:runtime-version": "node scripts/sync-runtime-version.js",
|
"sync:runtime-version": "node scripts/sync-runtime-version.js",
|
||||||
"prepare:publish": "./scripts/publish-npm.sh"
|
"prepare:publish": "./scripts/publish-npm.sh",
|
||||||
|
"update:all": "./scripts/update-and-publish-prep.sh"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
193
scripts/update-and-publish-prep.sh
Executable file
193
scripts/update-and-publish-prep.sh
Executable file
@@ -0,0 +1,193 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Comprehensive script to update n8n dependencies, run tests, and prepare for npm publish
|
||||||
|
# Based on MEMORY_N8N_UPDATE.md but enhanced with test suite and publish preparation
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Color codes for output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
echo -e "${BLUE}🚀 n8n Update and Publish Preparation Script${NC}"
|
||||||
|
echo "=============================================="
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 1. Check current branch
|
||||||
|
CURRENT_BRANCH=$(git branch --show-current)
|
||||||
|
if [ "$CURRENT_BRANCH" != "main" ]; then
|
||||||
|
echo -e "${YELLOW}⚠️ Warning: Not on main branch (current: $CURRENT_BRANCH)${NC}"
|
||||||
|
echo "It's recommended to run this on the main branch."
|
||||||
|
read -p "Continue anyway? (y/N) " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Check for uncommitted changes
|
||||||
|
if ! git diff-index --quiet HEAD --; then
|
||||||
|
echo -e "${RED}❌ Error: You have uncommitted changes${NC}"
|
||||||
|
echo "Please commit or stash your changes before updating."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Get current versions for comparison
|
||||||
|
echo -e "${BLUE}📊 Current versions:${NC}"
|
||||||
|
CURRENT_N8N=$(node -e "console.log(require('./package.json').dependencies['n8n'])" 2>/dev/null || echo "not installed")
|
||||||
|
CURRENT_PROJECT=$(node -e "console.log(require('./package.json').version)")
|
||||||
|
echo "- n8n: $CURRENT_N8N"
|
||||||
|
echo "- n8n-mcp: $CURRENT_PROJECT"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 4. Check for updates first
|
||||||
|
echo -e "${BLUE}🔍 Checking for n8n updates...${NC}"
|
||||||
|
npm run update:n8n:check
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
read -p "Do you want to proceed with the update? (y/N) " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
echo "Update cancelled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 5. Update n8n dependencies
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📦 Updating n8n dependencies...${NC}"
|
||||||
|
npm run update:n8n
|
||||||
|
|
||||||
|
# 6. Run the test suite
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}🧪 Running comprehensive test suite (1,182 tests)...${NC}"
|
||||||
|
npm test
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -e "${RED}❌ Tests failed! Please fix failing tests before proceeding.${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo -e "${GREEN}✅ All tests passed!${NC}"
|
||||||
|
|
||||||
|
# 7. Run validation
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}✔️ Validating critical nodes...${NC}"
|
||||||
|
npm run validate
|
||||||
|
|
||||||
|
# 8. Build the project
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}🔨 Building project...${NC}"
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# 9. Bump version
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📌 Bumping version...${NC}"
|
||||||
|
# Get new n8n version
|
||||||
|
NEW_N8N=$(node -e "console.log(require('./package.json').dependencies['n8n'])")
|
||||||
|
# Bump patch version
|
||||||
|
npm version patch --no-git-tag-version
|
||||||
|
|
||||||
|
# Get new project version
|
||||||
|
NEW_PROJECT=$(node -e "console.log(require('./package.json').version)")
|
||||||
|
|
||||||
|
# 10. Update version badge in README
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📝 Updating README badges...${NC}"
|
||||||
|
sed -i.bak "s/version-[0-9.]*/version-$NEW_PROJECT/" README.md && rm README.md.bak
|
||||||
|
sed -i.bak "s/n8n-v[0-9.]*/n8n-$NEW_N8N/" README.md && rm README.md.bak
|
||||||
|
|
||||||
|
# 11. Sync runtime version
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}🔄 Syncing runtime version...${NC}"
|
||||||
|
npm run sync:runtime-version
|
||||||
|
|
||||||
|
# 12. Get update details for commit message
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📊 Gathering update information...${NC}"
|
||||||
|
# Get all n8n package versions
|
||||||
|
N8N_CORE=$(node -e "console.log(require('./package.json').dependencies['n8n-core'])")
|
||||||
|
N8N_WORKFLOW=$(node -e "console.log(require('./package.json').dependencies['n8n-workflow'])")
|
||||||
|
N8N_LANGCHAIN=$(node -e "console.log(require('./package.json').dependencies['@n8n/n8n-nodes-langchain'])")
|
||||||
|
|
||||||
|
# Get node count from database
|
||||||
|
NODE_COUNT=$(node -e "
|
||||||
|
const Database = require('better-sqlite3');
|
||||||
|
const db = new Database('./data/nodes.db', { readonly: true });
|
||||||
|
const count = db.prepare('SELECT COUNT(*) as count FROM nodes').get().count;
|
||||||
|
console.log(count);
|
||||||
|
db.close();
|
||||||
|
" 2>/dev/null || echo "unknown")
|
||||||
|
|
||||||
|
# Check if templates were sanitized
|
||||||
|
TEMPLATES_SANITIZED=false
|
||||||
|
if [ -f "./data/nodes.db" ]; then
|
||||||
|
TEMPLATE_COUNT=$(node -e "
|
||||||
|
const Database = require('better-sqlite3');
|
||||||
|
const db = new Database('./data/nodes.db', { readonly: true });
|
||||||
|
const count = db.prepare('SELECT COUNT(*) as count FROM templates').get().count;
|
||||||
|
console.log(count);
|
||||||
|
db.close();
|
||||||
|
" 2>/dev/null || echo "0")
|
||||||
|
if [ "$TEMPLATE_COUNT" != "0" ]; then
|
||||||
|
TEMPLATES_SANITIZED=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 13. Create commit message
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📝 Creating commit...${NC}"
|
||||||
|
COMMIT_MSG="chore: update n8n to $NEW_N8N and bump version to $NEW_PROJECT
|
||||||
|
|
||||||
|
- Updated n8n to $NEW_N8N
|
||||||
|
- Updated n8n-core to $N8N_CORE
|
||||||
|
- Updated n8n-workflow to $N8N_WORKFLOW
|
||||||
|
- Updated @n8n/n8n-nodes-langchain to $N8N_LANGCHAIN
|
||||||
|
- Rebuilt node database with $NODE_COUNT nodes"
|
||||||
|
|
||||||
|
if [ "$TEMPLATES_SANITIZED" = true ]; then
|
||||||
|
COMMIT_MSG="$COMMIT_MSG
|
||||||
|
- Sanitized $TEMPLATE_COUNT workflow templates"
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMIT_MSG="$COMMIT_MSG
|
||||||
|
- All 1,182 tests passing (933 unit, 249 integration)
|
||||||
|
- All validation tests passing
|
||||||
|
- Built and prepared for npm publish
|
||||||
|
|
||||||
|
🤖 Generated with [Claude Code](https://claude.ai/code)
|
||||||
|
|
||||||
|
Co-Authored-By: Claude <noreply@anthropic.com>"
|
||||||
|
|
||||||
|
# 14. Stage all changes
|
||||||
|
git add -A
|
||||||
|
|
||||||
|
# 15. Show what will be committed
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}📋 Changes to be committed:${NC}"
|
||||||
|
git status --short
|
||||||
|
|
||||||
|
# 16. Commit changes
|
||||||
|
git commit -m "$COMMIT_MSG"
|
||||||
|
|
||||||
|
# 17. Summary
|
||||||
|
echo ""
|
||||||
|
echo -e "${GREEN}✅ Update completed successfully!${NC}"
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}Summary:${NC}"
|
||||||
|
echo "- Updated n8n from $CURRENT_N8N to $NEW_N8N"
|
||||||
|
echo "- Bumped version from $CURRENT_PROJECT to $NEW_PROJECT"
|
||||||
|
echo "- All 1,182 tests passed"
|
||||||
|
echo "- Project built and ready for npm publish"
|
||||||
|
echo ""
|
||||||
|
echo -e "${YELLOW}Next steps:${NC}"
|
||||||
|
echo "1. Push to GitHub:"
|
||||||
|
echo -e " ${GREEN}git push origin $CURRENT_BRANCH${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "2. Create a GitHub release (after push):"
|
||||||
|
echo -e " ${GREEN}gh release create v$NEW_PROJECT --title \"v$NEW_PROJECT\" --notes \"Updated n8n to $NEW_N8N\"${NC}"
|
||||||
|
echo ""
|
||||||
|
echo "3. Publish to npm:"
|
||||||
|
echo -e " ${GREEN}npm run prepare:publish${NC}"
|
||||||
|
echo " Then follow the instructions to publish with OTP"
|
||||||
|
echo ""
|
||||||
|
echo -e "${BLUE}🎉 Done!${NC}"
|
||||||
Reference in New Issue
Block a user