npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-des-twin

v0.2.1

Published

DES digital twin helpers: takt beat (JPH × speed) and station wall-clock wait for n8n workflows

Readme

n8n-nodes-des-twin

面向 DES-AI 数字孪生产线 的 n8n 自定义社区节点包(v0.2.1):节拍、工位墙钟、信号灯闸门、双路分支、可视化上报;与内置 MySQLWaitHTTP Request(PLC) 组合即可完成整条编排。


一、n8n 社区节点机制(摘要)

  1. 形态:独立 npm 包,包名 n8n-nodes-*package.jsonn8n.nodes 指向 dist 下各 *.node.js
  2. 实现:每节点一个类实现 INodeTypedescription + execute),图标为同目录 file:*.svg
  3. 构建npm run buildtsc + scripts/copy-icons.mjs(避免部分环境下 @n8n/node-cli 的 ESM 冲突)。
  4. 安装:自托管设置 N8N_CUSTOM_EXTENSIONS 指向本包根目录并重启;或 Settings → Community nodes 安装已发 npm 的包名。需与实例的 n8n / n8n-workflow 大版本 匹配(本包 peerDependencies: n8n-workflow@^2)。

二、目录结构

n8n-nodes-des-twin/
├── .npmrc                 # 强制官方 registry,避免镜像导致 publish 404
├── package.json
├── LICENSE
├── tsconfig.json
├── scripts/
│   ├── copy-icons.mjs
│   └── pre-publish-check.mjs
├── nodes/
│   ├── DesTaktBeat/
│   ├── DesStationTiming/
│   ├── DesTrafficLightGate/
│   ├── DesBranchRoute/
│   └── DesVisualizationPing/
├── dist/                 # 构建生成
└── README.md

三、节点一览

| 节点 | name | 作用 | |------|--------|------| | DES 节拍放行 | desTaktBeat | 按 JPH、倍速、批条数生成多条 item;输出 runIdcorrelationKeyspawnIntervalSimMs 等(与 useVehicleFlow.ts 公式一致)。 | | DES 工位墙钟 | desStationTiming | 按工位 1× 秒数与倍速写入 desStation.waitWallMs / waitWallSeconds,供 Wait 引用。 | | DES 信号灯闸门 | desTrafficLightGate | 绿灯放行、红灯阻塞、黄灯在 queueDepth < yellowQueueCapacity 时缓冲,否则视为队列满阻塞;结果写入 desTraffic;可选阻塞抛错。 | | DES 双路分支 | desBranchRoute | 双主输出:按 branchKey(可配置路径)匹配支路 A/B,写入 desBranch.sourceHandlebr-a / br-b),未匹配走默认支路。 | | DES 可视化上报 | desVisualizationPing | 使用 n8n 内置 helpers.httpRequest(无额外 runtime 依赖)将批次或逐条 POST 到看板/前端接口,回写 desVisual。 |

刻意不重复实现的能力MySQL 取数PLC HTTP 使用 n8n 自带节点即可;本包只补充 DES 域语义与分流。


四、推荐工作流拓扑

[触发] → [DES 节拍放行]
       → [MySQL](LIMIT / 关联 correlationKey、vehicleSerial)
       → [DES 信号灯闸门](item 可带 trafficPhase、queueDepth)
       → [DES 双路分支](按库中 branchKey)
            ├→ 支路 A → [DES 工位墙钟] → [Wait] → [HTTP PLC] …
            └→ 支路 B → …
       → [DES 可视化上报](POST 到 Vue 看板,驱动小车等)
  • WaitWait 节点持续时间可用表达式引用上一步的 $json.desStation.waitWallSeconds(秒)。
  • 节拍串行:放车间隔由节拍节点给出的 spawnIntervalSimMs 换算为墙钟秒后接 WaitSchedule 子流,按你们习惯组装。
  • 安全:可视化上报 URL 由你们控制;生产环境请配合鉴权网关或仅内网地址。

五、构建

cd n8n-nodes-des-twin
npm install
npm run build

仓库根目录亦可:npm run n8n-nodes:build

安装后在节点面板搜索 「DES」 应出现 5 个节点。


六、发布到 npm(本仓库已尽量「一步到位」)

本包已包含:

  • .npmrc:在本目录执行命令时固定 https://registry.npmjs.org/,避免淘宝/企业镜像下 npm publish 出现 PUT 404
  • npm run publish:npm:先跑 scripts/pre-publish-check.mjs(检查 registry、npm whoami 是否已登录dist 是否存在,缺则自动 build),再 npm publish

你本机只需执行(无法由他人代登录):

cd n8n-nodes-des-twin
npm install
npm login          # 浏览器/邮箱/2FA 按 npm 官网提示完成
npm run publish:npm

若 npm 账号开启了 2FA(一次性密码)

npm run publish:npm -- --otp=你的六位验证码

成功后,在私有化 n8n:Settings → Community nodes,安装包名 n8n-nodes-des-twin(或指定版本 [email protected]),重启 n8n(若提示需要)。

可选:在 package.json 增加 "repository" 指向真实 Git 仓库,便于 npm 页展示;与 Creator Portal 认证GitHub Actions provenance 无冲突时再按需接入。


七、许可

MIT。