指南
快速开始
安装
在 Bun workspace 或独立项目中使用以下命令同时安装框架与 CLI:
bun add @geektech/tsone @geektech/tsone-cli应用入口
默认入口是 src/main.ts。它必须具名导出 app,其值提供 renderHtmlDocument();由 createApp 创建的 TSone 应用满足该约定:
import { Component, VNode, createApp } from '@geektech/tsone';
class App extends Component<object, object> {
protected initState(): object {
return {};
}
protected initStyles(): void {}
protected render(): VNode {
return { tag: 'main', children: ['Hello TSone'] };
}
}
export const app = createApp({
root: App,
document: { title: 'TSone App' },
});
app.mount();创建项目
tsone create 在当前目录生成一个基础 TSone 项目:package.json、tsone.config.ts、tsconfig.json、.gitignore,以及一个展示 TSone 名称和框架仓库链接的 src/main.ts 首页。它拒绝覆盖已存在的文件。
tsone create开发与构建
启动开发服务:tsone dev;构建生产产物:tsone build。详见命令参考。