-
-
Notifications
You must be signed in to change notification settings - Fork 0
Switch nutils to vite build #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1769143
67fc000
957ccd8
23a22d9
3b20cf1
754a75e
f884800
b273960
bda4e61
e8bc71d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| A TypeScript-first monorepo for working with Notion. Fork of React Notion X with added search API, backlink support, and extended property rendering. Uses the unofficial Notion API. | ||
|
|
||
| ## Common Commands | ||
|
|
||
| ```bash | ||
| pnpm i # Install dependencies | ||
| pnpm build # Build all packages (turbo + tsup) | ||
| pnpm dev # Watch mode development | ||
| pnpm test # Run all tests (vitest) | ||
| pnpm lint # Lint and fix TS/TSX files | ||
| pnpm format # Format with Prettier | ||
| pnpm clean # Clean build artifacts | ||
| ``` | ||
|
|
||
| ### Running a Single Test | ||
|
|
||
| ```bash | ||
| pnpm vitest run packages/nutils/src/parse-page-id.test.ts | ||
| ``` | ||
|
|
||
| ### CLI Usage | ||
|
|
||
| ```bash | ||
| pnpm tsx packages/cli/src/main.ts export -p <PAGE_ID> --raw -r -f | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Package Dependency Graph | ||
|
|
||
| ``` | ||
| ntypes (types) ─────────┬──────────────────────┐ | ||
| │ │ | ||
| ▼ ▼ | ||
| nutils (utilities) ncompat (compat layer) | ||
| │ | ||
| ┌─────────────┼─────────────┐ | ||
| ▼ ▼ ▼ | ||
| nclient nreact cli | ||
| (API) (React) (exporter) | ||
| ``` | ||
|
|
||
| ### Packages | ||
|
|
||
| | Package | Purpose | Build Target | | ||
| | ------------------ | --------------------------------------------- | -------------------- | | ||
| | `@texonom/ntypes` | Shared TypeScript type definitions | node14/ESM | | ||
| | `@texonom/nutils` | Isomorphic utility functions (Node & browser) | es2015/browser/ESM | | ||
| | `@texonom/nclient` | Unofficial Notion API client | node14/ESM | | ||
| | `@texonom/ncompat` | Bridge to official @notionhq/client | node14/ESM | | ||
| | `@texonom/nreact` | React renderer components | ESM (React 16+ peer) | | ||
| | `@texonom/cli` | CLI exporter using Clipanion | Node binary | | ||
|
|
||
| ### Build Order (Turbo) | ||
|
|
||
| Turbo respects dependencies defined in `turbo.json`: | ||
|
|
||
| 1. `ntypes` builds first (no dependencies) | ||
| 2. `nutils`, `nclient`, `ncompat` build next (depend on ntypes) | ||
| 3. `nreact` builds (depends on ntypes + nutils) | ||
| 4. `cli` builds last (depends on nclient) | ||
|
|
||
| ## Code Style | ||
|
|
||
| - ESM-only output (no CommonJS) | ||
| - Single quotes, no semicolons (Prettier) | ||
| - camelCase for variables, PascalCase for types | ||
| - Pre-commit hook runs `pnpm format && pnpm lint` | ||
|
|
||
| ## Key Files | ||
|
|
||
| - `turbo.json` - Build task dependencies | ||
| - `tsconfig.base.json` - Shared TypeScript config | ||
| - Each package has `tsup.config.ts` for bundling | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests use Vitest. Test files are colocated with source: | ||
|
|
||
| - `packages/nutils/src/*.test.ts` | ||
| - `packages/nclient/src/notion-api.test.ts` | ||
| - `packages/cli/src/notion/export.test.ts` | ||
|
|
||
| Environment variable `NOTION_TOKEN` is needed for API tests. | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -43,7 +43,8 @@ | |||||||||
| "tsx": "^4.21.0", | ||||||||||
| "turbo": "^2.8.0", | ||||||||||
| "typescript": "^5.9.3", | ||||||||||
| "vite": "^7.3.1", | ||||||||||
| "vite": "^7.3.1", | ||||||||||
| "vite-plugin-dts": "^4.5.0", | ||||||||||
|
Comment on lines
+46
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting inconsistency on line 46. The 🔧 Proposed fix-"vite": "^7.3.1",
+ "vite": "^7.3.1",📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| "vitest": "^4.0.18" | ||||||||||
| }, | ||||||||||
| "standard-version": { | ||||||||||
|
|
||||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { defineConfig } from 'vite' | ||
| import dts from 'vite-plugin-dts' | ||
| import pkg from './package.json' with { type: 'json' } | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
| lib: { | ||
| entry: 'src/main.ts', | ||
| formats: ['es'], | ||
| fileName: () => 'main.js' | ||
| }, | ||
| outDir: 'build/src', | ||
| target: 'node16', | ||
| sourcemap: true, | ||
| minify: true, | ||
| rollupOptions: { | ||
| external: [ | ||
| ...Object.keys(pkg.dependencies || {}), | ||
| ...Object.keys(pkg.peerDependencies || {}), | ||
| 'fs', | ||
| 'fs/promises', | ||
| 'path', | ||
| 'stream', | ||
| 'util' | ||
| ] | ||
| } | ||
| }, | ||
| plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build/src' })] | ||
| }) | ||
|
|
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { defineConfig } from 'vite' | ||
| import dts from 'vite-plugin-dts' | ||
| import pkg from './package.json' with { type: 'json' } | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
| lib: { | ||
| entry: 'src/index.ts', | ||
| formats: ['es'], | ||
| fileName: () => 'index.js' | ||
| }, | ||
| outDir: 'build', | ||
| target: 'es2015', | ||
| sourcemap: true, | ||
| minify: true, | ||
| rollupOptions: { | ||
| external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
| } | ||
| }, | ||
| plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
| }) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { defineConfig } from 'vite' | ||
| import dts from 'vite-plugin-dts' | ||
| import pkg from './package.json' with { type: 'json' } | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
| lib: { | ||
| entry: 'src/index.ts', | ||
| formats: ['es'], | ||
| fileName: () => 'index.js' | ||
| }, | ||
| outDir: 'build', | ||
| target: 'es2015', | ||
| sourcemap: true, | ||
| minify: true, | ||
| rollupOptions: { | ||
| external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
| } | ||
| }, | ||
| plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
| }) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { defineConfig } from 'vite' | ||
| import dts from 'vite-plugin-dts' | ||
| import pkg from './package.json' with { type: 'json' } | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
| lib: { | ||
| entry: 'src/index.tsx', | ||
| formats: ['es'], | ||
| fileName: () => 'index.js' | ||
| }, | ||
| outDir: 'build', | ||
| target: 'es2015', | ||
| sourcemap: true, | ||
| minify: true, | ||
| rollupOptions: { | ||
| external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})] | ||
| } | ||
| }, | ||
| plugins: [dts({ tsconfigPath: 'tsconfig.json', outDir: 'build' })] | ||
| }) |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specifier to fenced code block.
The architecture diagram code block lacks a language identifier. While this is an ASCII diagram, adding a language specifier (or
text/plaintext) satisfies the markdown linting rule and improves consistency.📝 Proposed fix
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)
[warning] 37-37: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents