重构:提交全新项目代码
This commit is contained in:
12
packages/note-maker/package.json
Normal file
12
packages/note-maker/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "defgov-note-maker",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"peerDependencies": {
|
||||
"parse5": "^8.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.6.0",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
0
packages/note-maker/src/content-block/dg-ls.ts
Normal file
0
packages/note-maker/src/content-block/dg-ls.ts
Normal file
8
packages/note-maker/src/content-block/dg-text.ts
Normal file
8
packages/note-maker/src/content-block/dg-text.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
class DgText extends HTMLParagraphElement {
|
||||
constructor() {
|
||||
super();
|
||||
const shadow = this.attachShadow({ mode: "open" });
|
||||
|
||||
shadow.innerHTML
|
||||
}
|
||||
}
|
||||
0
packages/note-maker/src/content-block/dg-ul.ts
Normal file
0
packages/note-maker/src/content-block/dg-ul.ts
Normal file
118
packages/note-maker/tsconfig.json
Normal file
118
packages/note-maker/tsconfig.json
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
// tsconfig.lib.json
|
||||
// 直接复制本文件内容到子项目的 tsconfig.json 即可,不要用 entends 继承本文件
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
/**
|
||||
* Browser api,需要加 "DOM","DOM.Iterable"
|
||||
* Node api,需要加 "ES2025",始终使用带版本号的最新版本
|
||||
* NextJs api,属于同构,server 端会预处理 DOM,计算url,三个都需要 "ES2025", "DOM", "DOM.Iterable"
|
||||
*/
|
||||
"lib": ["ES2025", "DOM", "DOM.Iterable"],
|
||||
|
||||
/**
|
||||
* React JSX 编译模式
|
||||
* - 使用 React 17+ 新 JSX Transform
|
||||
* - 不需要手动 import React
|
||||
*/
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/**
|
||||
* 编译输出目录
|
||||
* - tsc / tsc -b 都会用到
|
||||
*/
|
||||
"outDir": "./dist",
|
||||
|
||||
/**
|
||||
* 源码根目录
|
||||
* - 确保 dist 结构与 src 一致
|
||||
* - 对 declaration 路径至关重要
|
||||
*/
|
||||
"rootDir": "./src",
|
||||
|
||||
/**
|
||||
* 生成 .d.ts 类型声明文件
|
||||
* - 组件库 / npm 包发布必需
|
||||
* - 对应用项目无害,仅影响类型输出
|
||||
*/
|
||||
"declaration": true,
|
||||
|
||||
/**
|
||||
* 只做类型检查,不生成 JS 输出
|
||||
* - 适用于 Vite / Next / Nuxt 等 bundler 场景
|
||||
* - 防止 tsc 与构建工具重复 emit
|
||||
*/
|
||||
"noEmit": true,
|
||||
|
||||
/**
|
||||
* 强制单文件可独立编译
|
||||
* - 适配 esbuild / SWC / bundler 编译模型
|
||||
* - 禁止依赖跨文件类型推断(enum / namespace 等)
|
||||
*/
|
||||
"isolatedModules": true,
|
||||
|
||||
/**
|
||||
* 允许在 import 中显式使用 .ts / .tsx 后缀
|
||||
* - 兼容 Node ESM / bundler 对文件扩展名的严格要求
|
||||
* - 避免 `import './foo'` 在 TS + ESM 下歧义
|
||||
*/
|
||||
"allowImportingTsExtensions": true
|
||||
},
|
||||
/**
|
||||
* 参与类型检查和编译的文件
|
||||
* - 只扫描 src
|
||||
* - 其它目录通过 exclude 排除
|
||||
*/
|
||||
"include": ["src", "scripts"],
|
||||
|
||||
/**
|
||||
* 明确排除非源码内容
|
||||
* - 避免污染类型系统
|
||||
* - 防止误入 dist / test / config
|
||||
* - 保证发布包干净
|
||||
*/
|
||||
"exclude": [
|
||||
"scripts",
|
||||
"node_modules",
|
||||
"dist",
|
||||
|
||||
// ---------- build / cache ----------
|
||||
".turbo/**/*",
|
||||
".cache/**/*",
|
||||
".vite/**/*",
|
||||
|
||||
// ---------- 配置文件 ----------
|
||||
"vite.config.ts",
|
||||
"*.config.ts",
|
||||
"*.config.js",
|
||||
"tsconfig.*.json",
|
||||
|
||||
// ---------- 测试相关 ----------
|
||||
"__tests__/**/*",
|
||||
"test/**/*",
|
||||
"tests/**/*",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"**/*.spec.ts",
|
||||
"**/*.spec.tsx",
|
||||
|
||||
// ---------- Storybook ----------
|
||||
".storybook/**/*",
|
||||
"stories/**/*",
|
||||
|
||||
// ---------- 示例 / 脚本 ----------
|
||||
"example/**/*",
|
||||
"examples/**/*",
|
||||
"scripts/**/*",
|
||||
|
||||
// ---------- 环境与静态资源 ----------
|
||||
".env",
|
||||
".env.*",
|
||||
"public/**/*",
|
||||
|
||||
// ---------- 文档 ----------
|
||||
"docs/**/*",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user