From 015c4fb91eaf26434ce45cb90074c54e960e2071 Mon Sep 17 00:00:00 2001 From: folinhilo Date: Mon, 4 May 2026 00:18:39 +0800 Subject: [PATCH] mm --- apps/manga-grabber/.npmrc | 1 + apps/manga-grabber/.vscode/settings.json | 8 + apps/manga-grabber/package.json | 38 +++++ .../vite-plugin-gen-index-css.ts | 137 ++++++++++++++++++ .../vite-plugin-gen-index-ts.ts | 129 +++++++++++++++++ apps/manga-grabber/tsconfig.base.json | 40 +++++ .../manga-grabber/tsconfig.build.json | 22 +-- apps/manga-grabber/tsconfig.json | 16 ++ apps/manga-grabber/vite.config.ts | 43 ++++++ packages/bookmark-sync/manifest.json | 2 +- packages/movie-grabber/tsconfig.json | 118 --------------- packages/music-grabber/tsconfig.json | 118 --------------- packages/note-maker/package.json | 12 -- .../note-maker/src/content-block/dg-ls.ts | 0 .../note-maker/src/content-block/dg-text.ts | 8 - .../note-maker/src/content-block/dg-ul.ts | 0 packages/note-maker/tsconfig.json | 118 --------------- pnpm-lock.yaml | 53 +++---- 18 files changed, 453 insertions(+), 410 deletions(-) create mode 100644 apps/manga-grabber/.npmrc create mode 100644 apps/manga-grabber/.vscode/settings.json create mode 100644 apps/manga-grabber/package.json create mode 100644 apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-css.ts create mode 100644 apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-ts.ts create mode 100644 apps/manga-grabber/tsconfig.base.json rename packages/manga-grabber/tsconfig.json => apps/manga-grabber/tsconfig.build.json (82%) create mode 100644 apps/manga-grabber/tsconfig.json create mode 100644 apps/manga-grabber/vite.config.ts delete mode 100644 packages/movie-grabber/tsconfig.json delete mode 100644 packages/music-grabber/tsconfig.json delete mode 100644 packages/note-maker/package.json delete mode 100644 packages/note-maker/src/content-block/dg-ls.ts delete mode 100644 packages/note-maker/src/content-block/dg-text.ts delete mode 100644 packages/note-maker/src/content-block/dg-ul.ts delete mode 100644 packages/note-maker/tsconfig.json diff --git a/apps/manga-grabber/.npmrc b/apps/manga-grabber/.npmrc new file mode 100644 index 0000000..8b02f75 --- /dev/null +++ b/apps/manga-grabber/.npmrc @@ -0,0 +1 @@ +registry = https://registry.npmmirror.com/ \ No newline at end of file diff --git a/apps/manga-grabber/.vscode/settings.json b/apps/manga-grabber/.vscode/settings.json new file mode 100644 index 0000000..772343c --- /dev/null +++ b/apps/manga-grabber/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "json.schemas": [ + { + "fileMatch": ["/tsconfig.build.json", "/tsconfig.base.json"], + "schema": {} + } + ] +} diff --git a/apps/manga-grabber/package.json b/apps/manga-grabber/package.json new file mode 100644 index 0000000..f3a38b9 --- /dev/null +++ b/apps/manga-grabber/package.json @@ -0,0 +1,38 @@ +{ + "name": "@defgov/manga-grabber", + "version": "0.0.0", + "private": true, + "type": "module", + "sideEffects": [ + "*.css" + ], + "module": "./dist/index.es.js", + "main": "./dist/index.cjs.js", + "types": "./dist/index.d.ts", + "style": "./dist/index.css", + "exports": { + ".": { + "import": "./dist/index.es.js", + "require": "./dist/index.cjs.js", + "types": "./dist/index.d.ts" + }, + "./index.css": "./dist/index.css" + }, + "files": [ + "dist" + ], + "scripts": { + "dev": "vite", + "build": "vite build --tsconfig tsconfig.build.json" + }, + "devDependencies": { + "@types/node": "^25.6.0", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.1", + "glob": "^13.0.6", + "typescript": "^6.0.3", + "vite": "^8.0.9", + "vite-plugin-dts": "^4.5.4" + } +} diff --git a/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-css.ts b/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-css.ts new file mode 100644 index 0000000..47af09c --- /dev/null +++ b/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-css.ts @@ -0,0 +1,137 @@ +// plugins/vite-plugin-gen-index-css.ts +import type { Plugin } from "vite"; +import fs from "fs"; +import path from "path"; +import { globSync } from "glob"; + +interface Config { + targetDirs: string[]; + includeExtensions: string[]; + importSyntax: "@import"; + importSyntaxTail?: string; + excludeFilePattern: RegExp[]; + excludeDirs: string[]; + warnDuplicateTailwindImport: boolean; + indexFileName: string; +} + +const CONFIG: Config = { + targetDirs: ["src"], + includeExtensions: [".css"], + importSyntax: "@import", + excludeFilePattern: [/index\.css/, /index\.scss/, /\.(test|spec)\./], + excludeDirs: [ + "__tests__", + "tests", + "story", + "stories", + "types", + "node_modules", + "dist", + "build", + ], + warnDuplicateTailwindImport: true, + indexFileName: "index.css", +}; + +const normalizePath = (p: string) => p.replace(/\\/g, "/"); + +function isValidFile(filePath: string, config: Config): boolean { + const filenameWithExt = filePath.split(/[\\/]/).pop()!; + const shouldExcludeFile = config.excludeFilePattern.some((p) => + p.test(filenameWithExt), + ); + if (shouldExcludeFile) return false; + + const normalized = normalizePath(filePath); + const shouldExcludeDir = config.excludeDirs.some((dir) => + normalized.includes(`/${dir}/`), + ); + if (shouldExcludeDir) return false; + + const ext = path.extname(filePath); + if (!config.includeExtensions.includes(ext)) return false; + + if (config.warnDuplicateTailwindImport) { + try { + const content = fs.readFileSync(filePath, "utf-8"); + if ( + content.includes('@import "tailwindcss"') || + content.includes("@import 'tailwindcss'") + ) { + console.warn( + `[gen-index-css] ${filePath} 含有重复的 @import "tailwindcss",建议删除`, + ); + } + } catch { + // ignore + } + } + + return true; +} + +function generateIndexFile(config: Config) { + const [targetDir] = config.targetDirs; + const dirPath = path.resolve(process.cwd(), targetDir); + + const searchPattern = path.resolve(dirPath, "**", "*.*"); + + const allFiles = globSync(searchPattern, { + nodir: true, + absolute: true, + windowsPathsNoEscape: true, + dot: false, + follow: true, + }); + + const validFiles = allFiles.filter((f) => isValidFile(f, config)); + + console.log(`✅ 有效 CSS 文件数量: ${validFiles.length}`); + validFiles.sort(); + + const importStatements = validFiles.map((file) => { + const relPath = path.relative(dirPath, file); + const importPath = "./" + relPath.replace(/\\/g, "/"); + return `${config.importSyntax} '${importPath}';`; + }); + + const indexContent = ` +@import "tailwindcss"; +${importStatements.join("\n")} +`.trim(); + + const indexFilePath = path.resolve(dirPath, config.indexFileName); + + // ✅ 内容比对,防止无限 rebuild + if (fs.existsSync(indexFilePath)) { + const old = fs.readFileSync(indexFilePath, "utf8"); + if (old === indexContent) return; + } + + fs.writeFileSync(indexFilePath, indexContent, "utf8"); + console.log(`✅ 成功生成 ${config.indexFileName}: ${indexFilePath}`); +} + +export function genIndexCssPlugin(): Plugin { + return { + name: "vite-plugin-gen-index-css", + apply: "build", + + buildStart() { + try { + generateIndexFile(CONFIG); + } catch (err) { + const msg = err instanceof Error ? err.message : String(err); + this.error(`[gen-index-css] failed: ${msg}`); + throw err; + } + }, + + handleHotUpdate({ file }) { + if (normalizePath(file).endsWith(`/src/${CONFIG.indexFileName}`)) { + return []; + } + }, + }; +} diff --git a/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-ts.ts b/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-ts.ts new file mode 100644 index 0000000..17c5d84 --- /dev/null +++ b/apps/manga-grabber/scripts-plugin/vite-plugin-gen-index-ts.ts @@ -0,0 +1,129 @@ +// plugins/vite-plugin-gen-index-ts.ts +import type { Plugin } from "vite"; +import fs from "fs"; +import path from "path"; +import { globSync } from "glob"; + +interface Config { + targetDirs: string[]; + includeExtensions: string[]; + excludeKeywords: { + dirs: string[]; + fileSuffixes: string[]; + filePatterns: RegExp[]; + }; +} + +const CONFIG: Config = { + targetDirs: ["src"], + includeExtensions: [".ts", ".tsx", ".vue"], + excludeKeywords: { + dirs: ["__tests__", "tests", "story", "stories", "types"], + fileSuffixes: [".d.ts"], + filePatterns: [ + /^index\.(ts|tsx|js|jsx)$/, + /\.(test|spec)\./, + /\.(story|stories)\./, + ], + }, +}; + +const normalizePath = (p: string) => p.replace(/\\/g, "/"); + +const isInExcludeDir = (filePath: string) => { + const normalized = normalizePath(filePath); + return CONFIG.excludeKeywords.dirs.some((dir) => + normalized.includes(`/${dir}/`), + ); +}; + +const isExcludeSuffix = (filePath: string) => + CONFIG.excludeKeywords.fileSuffixes.some((suffix) => + filePath.endsWith(suffix), + ); + +const isMatchExcludePattern = (fileName: string) => + CONFIG.excludeKeywords.filePatterns.some((pattern) => pattern.test(fileName)); + +function isValidFile(filePath: string): boolean { + const fileName = filePath.split(/[\\/]/).pop()!; + + if (isInExcludeDir(filePath)) return false; + if (isExcludeSuffix(filePath)) return false; + if (isMatchExcludePattern(fileName)) return false; + + const ext = path.extname(filePath); + return CONFIG.includeExtensions.includes(ext); +} + +function generateIndexFile(dirPath: string) { + const searchPattern = path.resolve(dirPath, "**", "*.*"); + + const allFiles = globSync(searchPattern, { + nodir: true, + absolute: true, + windowsPathsNoEscape: true, + dot: false, + follow: true, + }); + + const validFiles = allFiles.filter(isValidFile); + if (validFiles.length === 0) return; + + validFiles.sort(); + + const exportStatements = validFiles.map((file) => { + const relPath = path.relative(dirPath, file); + const importPath = `./${relPath + .replace(/\.[^.]+$/, "") + .replace(/\\/g, "/")}`; + return `export * from '${importPath}';`; + }); + + const indexContent = ` +import './index.css'; + +${exportStatements.join("\n")} +`.trim(); + + const indexFilePath = path.resolve(dirPath, "index.ts"); + + // ✅ 内容比对,避免无限 rebuild + if (fs.existsSync(indexFilePath)) { + const old = fs.readFileSync(indexFilePath, "utf8"); + if (old === indexContent) return; + } + + fs.writeFileSync(indexFilePath, indexContent, "utf8"); +} + +export function genIndexTsPlugin(): Plugin { + return { + name: "vite-plugin-gen-index-ts", + apply: "build", + + buildStart() { + const [targetDir] = CONFIG.targetDirs; + if (!targetDir) { + this.error("CONFIG.targetDirs is empty"); + return; + } + + const absTargetDir = path.resolve(process.cwd(), targetDir); + + try { + generateIndexFile(absTargetDir); + } catch (err) { + const msg = err instanceof Error ? err.message : String(err); + this.error(`[gen-index-ts] failed: ${msg}`); + throw err; + } + }, + + handleHotUpdate({ file }) { + if (file.replace(/\\/g, "/").endsWith("/src/index.ts")) { + return []; + } + }, + }; +} diff --git a/apps/manga-grabber/tsconfig.base.json b/apps/manga-grabber/tsconfig.base.json new file mode 100644 index 0000000..b134137 --- /dev/null +++ b/apps/manga-grabber/tsconfig.base.json @@ -0,0 +1,40 @@ +{ + // tsconfig.base.json,用于被 tesconfig.json 和 tesconfig.build.json 继承 + "compilerOptions": { + // 输出模块语法,使用版本号最新的那个,而不是实验性语法 ESNext + "module": "es2022", + + // 模块解析策略,模拟 Vite / Rollup / webpack,支持 exports / imports,不强制 Node ESM 的严格规则 + "moduleResolution": "bundler", + + // 显式声明使用的类型包 + "types": ["node", "react", "vite/client"], + + // 开启所有严格类型检查,防止 any / 隐式 any 扩散 + "strict": true, + + // 允许 ESM 导入 CJS + "esModuleInterop": true, + + // 跳过 node_modules 类型检查,加快构建,避免第三方类型污染 + "skipLibCheck": true, + + // 模块检测策略,不会影响 node_modules 中的第三方 CommonJS 依赖,Vite 会在预构建阶段自动将其转换为 ESM。 + "moduleDetection": "force", + + // 保留源码中的 import / export 语句原样输出,不进行自动转换(如 import → require),通常与 moduleDetection: "force" 搭配使用 + "verbatimModuleSyntax": true, + + // 是否检查“未使用的局部变量” + "noUnusedLocals": true, + + // 是否检查“未使用的函数参数” + "noUnusedParameters": true, + + // 是否只允许“可擦除的语法(Erasable Syntax),确保 TypeScript 语法在编译后可完全移除 + "erasableSyntaxOnly": true, + + // 是否禁止 switch 语句中的 case 贯穿(fallthrough),如果 case 没有 break / return,会报错 + "noFallthroughCasesInSwitch": true + } +} diff --git a/packages/manga-grabber/tsconfig.json b/apps/manga-grabber/tsconfig.build.json similarity index 82% rename from packages/manga-grabber/tsconfig.json rename to apps/manga-grabber/tsconfig.build.json index d5ec425..f3b4b99 100644 --- a/packages/manga-grabber/tsconfig.json +++ b/apps/manga-grabber/tsconfig.build.json @@ -1,15 +1,20 @@ { - // tsconfig.lib.json - // 直接复制本文件内容到子项目的 tsconfig.json 即可,不要用 entends 继承本文件 - "extends": "../../tsconfig.base.json", + // 此文件仅用于类型检查,不用于类型检查,构建时会指定使用 tsconfig.build.json + "extends": "./tsconfig.base.json", "compilerOptions": { - /** - * Browser api,需要加 "DOM","DOM.Iterable" - * Node api,需要加 "ES2025",始终使用带版本号的最新版本 - * NextJs api,属于同构,server 端会预处理 DOM,计算url,三个都需要 "ES2025", "DOM", "DOM.Iterable" - */ + // Browser api,需要加 "DOM","DOM.Iterable" + // Node api,需要加 "ES2025",始终使用带版本号的最新版本 + // NextJs api,属于同构,server 端会预处理 DOM,计算url,三个都需要 "ES2025", "DOM", "DOM.Iterable" "lib": ["ES2025", "DOM", "DOM.Iterable"], + /** + * 显式声明使用的类型包 + * - node:Node.js API + * - react:JSX / React 类型 + * - vite/client:import.meta / env + */ + "types": ["node", "react", "vite/client"], + /** * React JSX 编译模式 * - 使用 React 17+ 新 JSX Transform @@ -72,7 +77,6 @@ * - 保证发布包干净 */ "exclude": [ - "scripts", "node_modules", "dist", diff --git a/apps/manga-grabber/tsconfig.json b/apps/manga-grabber/tsconfig.json new file mode 100644 index 0000000..a28554e --- /dev/null +++ b/apps/manga-grabber/tsconfig.json @@ -0,0 +1,16 @@ +{ + // 此文件仅用于类型检查,不用于构建,构建时会指定使用 tsconfig.build.json + "extends": "./tsconfig.base.json", + "compilerOptions": { + // node api 使用最新版本号的 "ESxxxx",browser api 使用 "DOM" 和 "DOM.Iterable" + "lib": ["ES2025", "DOM", "DOM.Iterable"], + + //显式声明使用的类型包,避免找不到模块 + "types": ["node", "react", "vite/client"], + + // React JSX 编译模式 + "jsx": "react-jsx" + }, + // 将类型检查范围扩大至整个子项目,而不只是 src 文件夹, + "include": ["**/*"] +} diff --git a/apps/manga-grabber/vite.config.ts b/apps/manga-grabber/vite.config.ts new file mode 100644 index 0000000..a7b245d --- /dev/null +++ b/apps/manga-grabber/vite.config.ts @@ -0,0 +1,43 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; +import dts from "vite-plugin-dts"; +import path from "path"; +import { genIndexTsPlugin } from "./scripts-plugin/vite-plugin-gen-index-ts"; +import { genIndexCssPlugin } from "./scripts-plugin/vite-plugin-gen-index-css"; + +export default defineConfig({ + plugins: [ + genIndexTsPlugin(), + genIndexCssPlugin(), + react(), + dts({ + insertTypesEntry: true, + }), + ], + + build: { + lib: { + entry: path.resolve(__dirname, "src/index.ts"), + name: "DefgovUIWeb", + formats: ["es", "cjs"], + fileName: (format) => `index.${format}.js`, + }, + + rollupOptions: { + external: ["react", "react-dom", "react/jsx-runtime"], + output: { + globals: { + react: "React", + "react-dom": "ReactDOM", + }, + }, + }, + + sourcemap: true, + cssCodeSplit: true, + + watch: { + exclude: ["node_modules", "dist", ".git"], + }, + }, +}); diff --git a/packages/bookmark-sync/manifest.json b/packages/bookmark-sync/manifest.json index d913202..ba8b7d5 100644 --- a/packages/bookmark-sync/manifest.json +++ b/packages/bookmark-sync/manifest.json @@ -1,5 +1,5 @@ { - "name": "defgov-bookmark-sync", + "name": "@defgov/bookmark-sync", "version": "1.0", "manifest_version": 3, "permissions": ["bookmarks", "storage"], diff --git a/packages/movie-grabber/tsconfig.json b/packages/movie-grabber/tsconfig.json deleted file mode 100644 index d5ec425..0000000 --- a/packages/movie-grabber/tsconfig.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - // 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" - ] -} diff --git a/packages/music-grabber/tsconfig.json b/packages/music-grabber/tsconfig.json deleted file mode 100644 index d5ec425..0000000 --- a/packages/music-grabber/tsconfig.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - // 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" - ] -} diff --git a/packages/note-maker/package.json b/packages/note-maker/package.json deleted file mode 100644 index f6ccb88..0000000 --- a/packages/note-maker/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "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" - } -} diff --git a/packages/note-maker/src/content-block/dg-ls.ts b/packages/note-maker/src/content-block/dg-ls.ts deleted file mode 100644 index e69de29..0000000 diff --git a/packages/note-maker/src/content-block/dg-text.ts b/packages/note-maker/src/content-block/dg-text.ts deleted file mode 100644 index 67f7ff1..0000000 --- a/packages/note-maker/src/content-block/dg-text.ts +++ /dev/null @@ -1,8 +0,0 @@ -class DgText extends HTMLParagraphElement { - constructor() { - super(); - const shadow = this.attachShadow({ mode: "open" }); - - shadow.innerHTML - } -} diff --git a/packages/note-maker/src/content-block/dg-ul.ts b/packages/note-maker/src/content-block/dg-ul.ts deleted file mode 100644 index e69de29..0000000 diff --git a/packages/note-maker/tsconfig.json b/packages/note-maker/tsconfig.json deleted file mode 100644 index d5ec425..0000000 --- a/packages/note-maker/tsconfig.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - // 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" - ] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 12cd7df..3db8565 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,33 @@ importers: specifier: ^2.8.0 version: 2.9.7 + apps/manga-grabber: + devDependencies: + '@types/node': + specifier: ^25.6.0 + version: 25.6.0 + '@types/react': + specifier: ^19.2.14 + version: 19.2.14 + '@types/react-dom': + specifier: ^19.2.3 + version: 19.2.3(@types/react@19.2.14) + '@vitejs/plugin-react': + specifier: ^6.0.1 + version: 6.0.1(vite@8.0.10(@types/node@25.6.0)(jiti@2.6.1)) + glob: + specifier: ^13.0.6 + version: 13.0.6 + typescript: + specifier: ^6.0.3 + version: 6.0.3 + vite: + specifier: ^8.0.9 + version: 8.0.10(@types/node@25.6.0)(jiti@2.6.1) + vite-plugin-dts: + specifier: ^4.5.4 + version: 4.5.4(@types/node@25.6.0)(typescript@6.0.3)(vite@8.0.10(@types/node@25.6.0)(jiti@2.6.1)) + packages/bookmark-sync: dependencies: typescript: @@ -34,19 +61,6 @@ importers: specifier: ^0.12.0 version: 0.12.0 - packages/note-maker: - dependencies: - parse5: - specifier: ^8.0.1 - version: 8.0.1 - devDependencies: - '@types/node': - specifier: ^25.6.0 - version: 25.6.0 - typescript: - specifier: ^6.0.3 - version: 6.0.3 - packages/ui-web: dependencies: '@base-ui/react': @@ -699,10 +713,6 @@ packages: resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} engines: {node: '>=0.12'} - entities@8.0.0: - resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==} - engines: {node: '>=20.19.0'} - es-errors@1.3.0: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} @@ -901,9 +911,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - parse5@8.0.1: - resolution: {integrity: sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==} - path-browserify@1.0.1: resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} @@ -1624,8 +1631,6 @@ snapshots: entities@7.0.1: {} - entities@8.0.0: {} - es-errors@1.3.0: {} estree-walker@2.0.2: {} @@ -1777,10 +1782,6 @@ snapshots: nanoid@3.3.12: {} - parse5@8.0.1: - dependencies: - entities: 8.0.0 - path-browserify@1.0.1: {} path-parse@1.0.7: {}