@nuwatop/code-canvas-runtime
v0.4.98
Published
Runtime utilities for code-canvas generated applications (React)
Readme
@nuwatop/code-canvas-runtime
Runtime utilities for code-canvas generated React applications. Re-exports @nuwatop/code-canvas-core and adds command watching, runtime rendering, and related helpers.
Installation
Peer dependencies: react, react-dom, antd, zustand, etc. (see package.json → peerDependencies).
npm install @nuwatop/code-canvas-runtimeUsage
Typical imports in generated app code (Extend.ts / pages):
import {
createWatchCommands,
useAndStore,
useItemStore,
} from "@nuwatop/code-canvas-runtime";
const watchCommandsWithContext = createWatchCommands(() => ({
// command handlers keyed by action name
}));
export function init(store?: unknown) {
if (store) {
watchCommandsWithContext(store as never, "your-session-id");
}
}Other exports include RuntimeRenderer, ComponentRegistry, initRuntime, UIUtils, validation helpers, etc. — see src/index.ts.
发布到 npm(维护者)
在 runtime 目录下,先改好 package.json 里的 version(不能和已发布版本重复),登录 npm 官方源后执行:
npm publish --access public--access public:本包是 scoped 包(@nuwatop/...),公开到 npmjs 必须加这一项。prepublishOnly已配置为自动npm run build,一般无需先手动build。
若本机默认 registry 是镜像(如 npmmirror,不能 publish),可:
npm publish --access public --registry https://registry.npmjs.org/或在 runtime/.npmrc 中指定 registry=https://registry.npmjs.org/(含 token 时不要提交到 Git)。
License
MIT
