Skip to content

tnotesjs/core

Repository files navigation

@tnotesjs/core

TNotes 知识库系统的核心框架,以 NPM 包形式发布,被所有 TNotes.xxx 知识库引用。

简介

@tnotesjs/core 包含了 TNotes 知识库系统的 CLI 命令、VitePress 配置/主题、服务层、工具函数等核心代码。各 TNotes.xxx 仓库通过 npm install @tnotesjs/core 安装即可使用。

目录结构

@tnotesjs/core
├── commands/           # CLI 命令(dev、build、push、update 等)
├── config/             # 配置管理(ConfigManager、默认配置、模板)
├── core/               # 核心模块(GitManager、NoteManager、ReadmeGenerator 等)
├── services/           # 服务层(file-watcher、git、note、readme、vitepress 等)
├── types/              # TypeScript 类型定义
├── utils/              # 工具函数(日志、文件操作、Markdown 解析、校验等)
├── vitepress/          # VitePress 主题、组件、插件、样式
│   ├── components/     # 自定义 Vue 组件
│   ├── config/         # VitePress 配置(defineNotesConfig)
│   ├── plugins/        # VitePress 插件
│   └── theme/          # 主题入口与样式
├── index.ts            # CLI 入口
└── src/index.ts        # 公共 API 导出

安装

# 安装核心包
pnpm add @tnotesjs/core

# 安装 peerDependencies
pnpm add -D vite vitepress vue

使用方式

VitePress 配置

// .vitepress/config.mts
import { defineNotesConfig } from '@tnotesjs/core/vitepress/config'
export default defineNotesConfig()

VitePress 主题

// .vitepress/theme/index.ts
export { default } from '@tnotesjs/core/vitepress/theme'

CLI 命令

package.json 中配置脚本:

{
  "scripts": {
    "tn:dev": "tnotes --dev",
    "tn:build": "tnotes --build",
    "tn:preview": "tnotes --preview",
    "tn:update": "tnotes --update",
    "tn:push": "tnotes --push",
    "tn:pull": "tnotes --pull",
    "tn:create-notes": "tnotes --create-notes",
    "tn:fix-timestamps": "tnotes --fix-timestamps",
    "tn:help": "tnotes --help"
  }
}

版本管理

许可证

MIT

About

TNotes 核心

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors