refactor: migrate n8n node to official n8n-node CLI tooling#7
refactor: migrate n8n node to official n8n-node CLI tooling#7pranavjana wants to merge 4 commits intomainfrom
Conversation
- Replace custom build/lint scripts with n8n-node CLI commands - Add ESLint flat config with n8n community node rules (strict mode) - Add Prettier config matching n8n conventions - Align tsconfig.json with n8n-nodes-starter template - Fix repository URL to standard git format with directory field - Remove unnecessary main field from package.json - Use NodeConnectionTypes.Main enum instead of string literals - Alphabetize operation options per n8n lint rules - Add noDataExpression to operation field - Set limit default to 50 per n8n conventions - Remove useless try/catch wrapper in consumeSseStream - Remove stale retry JSDoc from tinyfishApiRequest - Add CI workflow for lint/build on PRs - Add publish workflow with npm provenance for May 2026 requirement
📝 WalkthroughWalkthroughAdds CI/CD and code-style tooling for the n8n node package and refactors node configuration and build tooling. Two GitHub Actions workflows are added: one to run build/lint on PRs and main pushes, and one to publish the package to npm on releases or manual dispatch. Prettier and ESLint config files are added/proxied. Tinyfish node updates include enum-based connection types, reworked operation options (add getRun, listRuns, reordering), a noDataExpression flag, and an increased default list limit. package.json and tsconfig.json are updated to use n8n-node CLI tooling, adjust TypeScript targets, and add package metadata. Sequence Diagram(s)mermaid mermaid 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/n8n-ci.yml (1)
3-7: Consider path filters to avoid running this workflow on unrelated monorepo changes.This CI only validates
n8n/, so restricting triggers to relevant paths will save runner time and reduce noise.⚙️ Suggested trigger refinement
on: pull_request: + paths: + - 'n8n/**' + - '.github/workflows/n8n-ci.yml' push: branches: [main] + paths: + - 'n8n/**' + - '.github/workflows/n8n-ci.yml'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/n8n-ci.yml around lines 3 - 7, The workflow currently triggers on broad events "pull_request" and "push"; add path filters to both triggers so the CI only runs for changes under the n8n package. Update the "on" block for "pull_request" and "push" to include a "paths:" array with "n8n/**" (and any other relevant subpaths you want validated) or use "paths-ignore:" to skip unrelated monorepo directories, ensuring only changes affecting the n8n codebase run this workflow.n8n/package.json (1)
26-33: Optional: unify watch/dev flow under n8n-node tooling.Now that
devisn8n-node dev, keepingbuild:watchon rawtsc --watchcan lead to mixed local workflows.♻️ Suggested script cleanup
"scripts": { "build": "n8n-node build", - "build:watch": "tsc --watch", + "build:watch": "n8n-node dev", "dev": "n8n-node dev", "lint": "n8n-node lint",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@n8n/package.json` around lines 26 - 33, Unify the watch/dev flow by replacing the raw TypeScript watcher with the n8n-node tooling: update the package.json script "build:watch" (currently "tsc --watch") to use the n8n-node command consistent with "dev" (e.g., "n8n-node dev --watch" or "n8n-node watch" depending on available CLI flags), so all local workflows use the same n8n-node toolchain; ensure you run/validate the "dev" and "build:watch" scripts afterwards to confirm parity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/n8n-publish.yml:
- Around line 3-10: The workflow currently triggers on any repository release
(on: release) which can cause the publish job named publish to run for unrelated
tags; add a tag guard by adding an if condition on the publish job that checks
the release tag pattern (e.g., if: startsWith(github.ref, 'refs/tags/n8n-') or
another agreed prefix) so the publish job only executes for intended release
tags; update the publish job's definition (the publish job block) to include
this if guard.
In `@n8n/nodes/Tinyfish/GenericFunctions.ts`:
- Around line 168-170: The SSE parsing loop leaves the final partial chunk in
buffer (buffer, lines) but breaks immediately when done is true, which can skip
the last "data:" frame; update the loop that reads chunks so that when
done===true you first process any remaining buffer: split buffer by '\n', treat
the residual chunk as a complete line (append it to lines or emit it) so the
final "data:" event (e.g., COMPLETE) is parsed before exiting, then break;
adjust logic around where buffer = lines.pop() is set to ensure leftover content
is not discarded and is parsed when done is seen.
---
Nitpick comments:
In @.github/workflows/n8n-ci.yml:
- Around line 3-7: The workflow currently triggers on broad events
"pull_request" and "push"; add path filters to both triggers so the CI only runs
for changes under the n8n package. Update the "on" block for "pull_request" and
"push" to include a "paths:" array with "n8n/**" (and any other relevant
subpaths you want validated) or use "paths-ignore:" to skip unrelated monorepo
directories, ensuring only changes affecting the n8n codebase run this workflow.
In `@n8n/package.json`:
- Around line 26-33: Unify the watch/dev flow by replacing the raw TypeScript
watcher with the n8n-node tooling: update the package.json script "build:watch"
(currently "tsc --watch") to use the n8n-node command consistent with "dev"
(e.g., "n8n-node dev --watch" or "n8n-node watch" depending on available CLI
flags), so all local workflows use the same n8n-node toolchain; ensure you
run/validate the "dev" and "build:watch" scripts afterwards to confirm parity.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
n8n/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
.github/workflows/n8n-ci.yml.github/workflows/n8n-publish.ymln8n/.prettierrc.jsn8n/eslint.config.mjsn8n/nodes/Tinyfish/GenericFunctions.tsn8n/nodes/Tinyfish/Tinyfish.node.tsn8n/nodes/Tinyfish/TinyfishDescription.tsn8n/package.jsonn8n/tsconfig.json
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
.github/workflows/n8n-ci.yml (2)
25-25:npm installcan silently mutatepackage-lock.json, hurting reproducibility.
npm ciis the idiomatic choice for CI because it performs a clean install that strictly follows the lockfile.npm installcan resolve differently across environments if the lockfile is out of sync. If the "cross-version compatibility" concern is about the Node/npm version, consider pinning viaenginesinpackage.jsoninstead and usingnpm cihere.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/n8n-ci.yml at line 25, Replace the CI step that runs the literal command "npm install" with "npm ci" to ensure a clean, lockfile-respecting install; locate the workflow step containing the string "npm install" and update it to "npm ci", and if cross-version compatibility is a concern, add or update the "engines" field in package.json to pin Node/npm versions rather than relying on "npm install" behavior.
12-14: Add explicit least-privilegepermissionsblock.Without an explicit
permissionsdeclaration the job inherits the repo/org default, which may be broader than needed.🔒 Proposed fix
jobs: build: runs-on: ubuntu-latest + permissions: + contents: read defaults:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/n8n-ci.yml around lines 12 - 14, The workflow omits an explicit permissions declaration for the build job; add a top-level permissions block under the jobs.build stanza (the 'build' job) that explicitly grants only the least privileges required by this CI (e.g., read-only for contents, packages, and any tokens the job needs) by adding a 'permissions:' mapping beneath the build job; ensure you list only the specific permissions the job consumes (for example contents: read, checks: write or read as needed, id-token: write only if OIDC is used) so the job no longer inherits broader repo/org defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/n8n-ci.yml:
- Around line 3-10: The workflow's on: pull_request and push path filters only
include 'n8n/**', which excludes the workflow file itself so CI won't run when
n8n-ci.yml is modified; update the on: block (the pull_request and push -> paths
entries) to also include the workflow file (n8n-ci.yml) so changes to this
workflow will trigger the job—modify the paths arrays under the on: section to
add the workflow filename alongside 'n8n/**'.
In @.github/workflows/n8n-publish.yml:
- Line 6: The manual-dispatch guard silently skips publishes because
workflow_dispatch sets github.ref to a branch (refs/heads/...), so change the
condition that currently uses startsWith(github.ref, 'refs/tags/n8n-') to allow
workflow_dispatch to bypass it by OR-ing with github.event_name ==
'workflow_dispatch' (or explicitly check github.event.action if you use a custom
dispatch payload); update the job condition(s) referencing
startsWith(github.ref, 'refs/tags/n8n-') (and the duplicate at the second
occurrence) so manual runs from branches will proceed instead of being silently
skipped.
- Line 26: Replace the 'run: npm install' step in the publish workflow with
'run: npm ci' so the pipeline performs a clean, lockfile-exact install; locate
the workflow job that currently contains the run step with "npm install" and
update it to "npm ci" to ensure reproducible builds for the publish pipeline.
---
Nitpick comments:
In @.github/workflows/n8n-ci.yml:
- Line 25: Replace the CI step that runs the literal command "npm install" with
"npm ci" to ensure a clean, lockfile-respecting install; locate the workflow
step containing the string "npm install" and update it to "npm ci", and if
cross-version compatibility is a concern, add or update the "engines" field in
package.json to pin Node/npm versions rather than relying on "npm install"
behavior.
- Around line 12-14: The workflow omits an explicit permissions declaration for
the build job; add a top-level permissions block under the jobs.build stanza
(the 'build' job) that explicitly grants only the least privileges required by
this CI (e.g., read-only for contents, packages, and any tokens the job needs)
by adding a 'permissions:' mapping beneath the build job; ensure you list only
the specific permissions the job consumes (for example contents: read, checks:
write or read as needed, id-token: write only if OIDC is used) so the job no
longer inherits broader repo/org defaults.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/n8n-ci.yml.github/workflows/n8n-publish.yml
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'n8n/**' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'n8n/**' |
There was a problem hiding this comment.
CI won't self-trigger on workflow file changes.
The n8n/** path filter excludes .github/workflows/n8n-ci.yml itself. A PR that only edits this workflow file won't run the CI job, so workflow changes can't be validated automatically.
Consider adding the workflow path to the trigger:
🔧 Proposed fix
on:
pull_request:
paths:
- 'n8n/**'
+ - '.github/workflows/n8n-ci.yml'
push:
branches: [main]
paths:
- 'n8n/**'
+ - '.github/workflows/n8n-ci.yml'📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| on: | |
| pull_request: | |
| paths: | |
| - 'n8n/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'n8n/**' | |
| on: | |
| pull_request: | |
| paths: | |
| - 'n8n/**' | |
| - '.github/workflows/n8n-ci.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'n8n/**' | |
| - '.github/workflows/n8n-ci.yml' |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/n8n-ci.yml around lines 3 - 10, The workflow's on:
pull_request and push path filters only include 'n8n/**', which excludes the
workflow file itself so CI won't run when n8n-ci.yml is modified; update the on:
block (the pull_request and push -> paths entries) to also include the workflow
file (n8n-ci.yml) so changes to this workflow will trigger the job—modify the
paths arrays under the on: section to add the workflow filename alongside
'n8n/**'.
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
workflow_dispatch from a branch is silently skipped by the tag guard.
When manually dispatched from a branch (e.g., main), github.ref resolves to refs/heads/main, causing the startsWith(github.ref, 'refs/tags/n8n-') guard to evaluate to false. The job is silently skipped — no error, no publish. Manual dispatch only works when the workflow is triggered from the tag ref directly (via the GitHub UI "Run workflow" drop-down with the tag selected).
This is subtle enough to confuse operators expecting a manual publish to "just work" from the default branch. Consider either documenting this constraint or restructuring the guard:
🔧 Option: make workflow_dispatch always publish (bypass guard)
- if: startsWith(github.ref, 'refs/tags/n8n-')
+ if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/n8n-')Also applies to: 11-11
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/n8n-publish.yml at line 6, The manual-dispatch guard
silently skips publishes because workflow_dispatch sets github.ref to a branch
(refs/heads/...), so change the condition that currently uses
startsWith(github.ref, 'refs/tags/n8n-') to allow workflow_dispatch to bypass it
by OR-ing with github.event_name == 'workflow_dispatch' (or explicitly check
github.event.action if you use a custom dispatch payload); update the job
condition(s) referencing startsWith(github.ref, 'refs/tags/n8n-') (and the
duplicate at the second occurrence) so manual runs from branches will proceed
instead of being silently skipped.
Summary
Migrates the
n8n-nodes-tinyfishcommunity node from a hand-rolled build setup to the official@n8n/node-clitooling. This is required for submitting the node for n8n verification and ensures compliance with their technical and UX guidelines.What changed
Build tooling (
package.json)tsc && cpbuild script withn8n-node buildtsc --noEmitlint withn8n-node lint(ESLint with n8n-specific community node rules)n8n-node dev,n8n-node release,n8n-node prereleasescripts@n8n/node-cli,eslint@9,prettier,release-itn8n-workflowfrom devDependencies (stays in peerDependencies only)mainfield (n8n resolves nodes via then8n.nodesarray)n8n.strict: truefor full cloud-compatible lint rulesConfig files (new)
eslint.config.mjs— ESLint flat config importing@n8n/node-cli/eslint(includeseslint-plugin-n8n-nodes-baserules for nodes, credentials, and package.json validation).prettierrc.js— n8n standard Prettier config (tabs, single quotes, trailing commas, 100 char width)tsconfig.jsontarget: es2019, updatedlib, addeduseUnknownInCatchVariables: false,incremental: truepackage.jsonmetadatadirectoryfield for monorepo supportLint fixes
Tinyfish.node.ts: UseNodeConnectionTypes.Mainenum instead of string literal'main'forinputs/outputsTinyfishDescription.ts: AddednoDataExpression: trueto operation field, alphabetized operation options, set limit default to 50 (n8n conventions)GenericFunctions.ts: Removed useless try/catch wrapper inconsumeSseStream(), removed stale retry JSDoc fromtinyfishApiRequest()GitHub Actions workflows (new)
n8n-ci.yml— Runs lint + build on PRs and pushes to mainn8n-publish.yml— Publishes to npm with--provenanceon GitHub Release creation (required for all community nodes from May 2026)Verification
npm run lintpasses cleanly (zero errors)npm run buildproduces correctdist/output with SVG iconsnpx @n8n/scan-community-package n8n-nodes-tinyfishpasses all security checksFollow-up (not in this PR)
tinyfish.dark.svg) for n8n dark theme support