Development and Maintenance

This section covers local development tasks for the n8n-nodes-docuwriter-ai project. Follow these steps to set up a rapid edit–build–verify cycle, enforce code quality, and prepare for publishing.

Local Development 🛠️

  • Live TypeScript builds
    Run the TypeScript compiler in watch mode to rebuild on every file change.
    pnpm run dev
    
  • Code formatting
    Format all source files under nodes/ and credentials/ using Prettier.
    pnpm run format
    
  • Linting
    Enforce coding standards and detect errors with ESLint and the eslint-plugin-n8n-nodes-base plugin.
    pnpm run lint
    
  • Auto-fix lint issues
    Attempt to automatically fix fixable lint errors.
    pnpm run lintfix
    
  • Pre-publish checks
    Before publishing, build the project and run the linter in one step.
    pnpm publish   # triggers `prepublishOnly`
    
    The prepublishOnly script combines build and lint to ensure no errors slip through .

NPM Scripts Overview

Script Command Purpose
build tsc && npm run copy:icons Compile TypeScript and copy SVG icons
dev tsc --watch Continuous build on file changes
format prettier nodes credentials --write Format code with Prettier
lint eslint "nodes/**/*.ts" "credentials/**/*.ts" Check code quality with ESLint
lintfix eslint ... --fix Lint and auto-fix issues
prepublishOnly npm run build && npm run lint -s Build and lint before publishing
{
  "scripts": {
    "build": "tsc && npm run copy:icons",
    "copy:icons": "copyfiles \"nodes/**/*.svg\" dist",
    "dev": "tsc --watch",
    "format": "prettier nodes credentials --write",
    "lint": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\"",
    "lintfix": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\" --fix",
    "prepublishOnly": "npm run build && npm run lint -s"
  }
}

Tooling & Configuration

  • TypeScript
    Configuration via tsconfig.json ensures:

    • Output to dist/
    • Strict checks enabled
    • Sources under nodes/ and credentials/
  • ESLint
    Uses core ESLint plus:

    • @typescript-eslint/parser
    • @typescript-eslint/eslint-plugin
    • eslint-plugin-n8n-nodes-base
      defined in devDependencies .
  • Prettier
    Formats code consistently; invoked via the format script.

Version Enforcement 🔒

To guarantee a consistent environment, the project enforces Node.js and pnpm versions:

Engine Required Version
node >=18.10
pnpm >=7.18
{
  "engines": {
    "node": ">=18.10",
    "pnpm": ">=7.18"
  },
  "packageManager": "[email protected]"
}

By following these scripts and configurations, contributors can quickly iterate on code, maintain high quality with linting and formatting, and ensure smooth, error-free releases.