Development and Maintenance – Conventions and Quality

Maintaining a healthy codebase requires consistent styling, strict linting, and reliable build processes. This section details the conventions and quality controls employed by the n8n-nodes-docuwriter-ai project to ensure clarity, consistency, and compatibility.

ESLint: Enforcing Code Standards 🕵️‍♀️

ESLint analyzes TypeScript sources under nodes/ and credentials/ to catch errors and enforce style rules:

  • Configuration

    • Uses eslint core with the @typescript-eslint parser and plugin.
    • Includes eslint-plugin-n8n-nodes-base to align with n8n’s node development guidelines.
  • npm Scripts

    npm run lint       # Run ESLint checks
    npm run lintfix    # Auto-fix ESLint issues
    

    These scripts lint all .ts files in nodes/ and credentials/ .

  • CI Integration

    • The prepublishOnly hook runs both build and lint to prevent publishing if lint errors exist.

Prettier: Automatic Formatting 🎨

Prettier provides a uniform code style to reduce bike-shedding:

  • Formatting Script

    npm run format    # Apply Prettier to nodes and credentials
    

    Targets nodes/ and credentials/ directories, ensuring code blocks, imports, and spacing stay consistent .

  • Combination with ESLint

    • Teams first apply Prettier, then run ESLint to catch semantic errors.
    • Editors can be configured to format on save.

TypeScript Configuration

Strong typing and modern JavaScript features are enabled via tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "outDir": "dist",
    "rootDir": ".",
    "declaration": true,
    "strict": true,
    "esModuleInterop": true
  },
  "include": ["credentials/**/*","nodes/**/*"],
  "exclude": ["dist/**/*","node_modules/**/*"]
}
  • Output
    • Compiled files are placed in dist/ for n8n consumption.
    • Declaration files assist IDEs and downstream consumers .

Icon Management: Copying SVG Assets 📁

Custom node icons (SVG files) must accompany compiled code for n8n’s UI:

  • Build-Time Copy

    npm run copy:icons  # copyfiles "nodes/**/*.svg" dist
    

    Leverages the copyfiles package to mirror all .svg icons from nodes/ into dist/, preserving folder structure .

  • Script Workflow

    1. Transpile: tsc compiles .ts.js into dist/.
    2. Copy Icons: copyfiles moves SVGs into matching dist/ paths.
    3. Publish: dist/ contains everything n8n needs: code, credentials, and icons.

Package Manager and Publishing

The project embraces pnpm for fast, reproducible installs:

"engines": {
  "node": ">=18.10",
  "pnpm": ">=7.18"
},
"packageManager": "[email protected]",
  • Scripts Overview
Script Description
build Compile TS and copy icons
copy:icons Copy all .svg icons to dist/
dev Watch-mode TypeScript compilation
format Run Prettier formatting
lint Run ESLint checks
lintfix ESLint with --fix
prepublishOnly Ensure build + lint pass before publishing

All files published are restricted to the dist/ folder, simplifying n8n’s module loading and reducing bundle size .


By combining ESLint, Prettier, strict TypeScript settings, and automated icon handling, the n8n-nodes-docuwriter-ai project upholds high code quality, consistent styling, and smooth integration into n8n workflows.