{"_id":"@1984vc/notion_mdx","_rev":"1-bab373f1d01a0129957c431ee2012218","name":"@1984vc/notion_mdx","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@1984vc/notion_mdx","version":"1.0.0","keywords":["notion","mdx","markdown","export","cli","notion-to-md"],"author":{"name":"Mark Percival","email":"mdp@1984.vc"},"license":"MIT","_id":"@1984vc/notion_mdx@1.0.0","maintainers":[{"name":"mdp","email":"m@mdp.im"}],"bin":{"notion_mdx":"dist/index.js"},"dist":{"shasum":"8834a4d3d8d457ceb9e6f498db1f77217b7cd0fc","tarball":"https://registry.npmjs.org/@1984vc/notion_mdx/-/notion_mdx-1.0.0.tgz","fileCount":17,"integrity":"sha512-PltgTEp1kGARWwxHLbPuPSxGEtErQeMrifanmJ1SG/uQCf+vcim6gFduNlRXV621FDy1GEJJDvhYC2Pq7eppvQ==","signatures":[{"sig":"MEUCIDNoPcJQVod49zwbvkRVHkUvYPzBcbl9g5n4fBb5EqMgAiEA1aRv+AcIPnBH3WOkuKjUhQj/eAAgfgCcCAQ1zuwed10=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31498},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"894955456db87c49e9c76982b2cb54316b8841c7","scripts":{"cli":"tsx bin/index.ts","lint":"eslint .","test":"vitest run","build":"tsc","start":"node dist/index.js","lint:fix":"eslint . --fix","test:watch":"vitest"},"_npmUser":{"name":"mdp","email":"m@mdp.im"},"_npmVersion":"10.8.2","description":"CLI tool to export Notion database pages to MDX files with frontmatter","directories":{},"_nodeVersion":"20.18.0","dependencies":{"commander":"^12.1.0","notion-to-md":"^3.1.1","@notionhq/client":"^2.2.15"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","eslint":"^9.14.0","vitest":"^2.1.4","globals":"^14.0.0","@eslint/js":"^9.14.0","typescript":"^5.6.3","@types/node":"^22.9.0","@typescript-eslint/parser":"^8.14.0","@typescript-eslint/eslint-plugin":"^8.14.0"},"_npmOperationalInternal":{"tmp":"tmp/notion_mdx_1.0.0_1731424897127_0.9499592720643657","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@1984vc/notion_mdx","version":"2.0.0","description":"CLI tool to export Notion database pages to MDX files with frontmatter","homepage":"https://github.com/1984vc/notion_mdx","main":"dist/index.js","bin":{"notion_mdx":"dist/index.js"},"type":"module","scripts":{"build":"tsc","start":"node dist/index.js","test":"vitest run","test:watch":"vitest","lint":"eslint .","lint:fix":"eslint . --fix","cli":"tsx bin/index.ts"},"keywords":["notion","mdx","markdown","export","cli","notion-to-md"],"author":{"name":"Mark Percival","email":"mdp@1984.vc"},"license":"MIT","dependencies":{"@notionhq/client":"^2.2.15","commander":"^12.1.0","notion-to-md":"^3.1.1"},"devDependencies":{"@eslint/js":"^9.14.0","@types/node":"^22.9.0","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","globals":"^14.0.0","tsx":"^4.19.2","typescript":"^5.6.3","vitest":"^2.1.4"},"engines":{"node":">=14.0.0"},"publishConfig":{"access":"public"},"_id":"@1984vc/notion_mdx@2.0.0","gitHead":"c7935dfc6591f1f0e3ce348cf9438beee65829c4","types":"./dist/index.d.ts","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-pqjBMxr+pWHS9tTTpMGhl5sF7154qvX4VZETh3ocGai83xGyu2PAzOwRLwUzcBHnUo30vPcPg8PTBM4cT/O6lw==","shasum":"c2b9313f3a7cc1765accb0917e80ab869ebee9e2","tarball":"https://registry.npmjs.org/@1984vc/notion_mdx/-/notion_mdx-2.0.0.tgz","fileCount":36,"unpackedSize":123528,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIACuFEB9yr0xhiG8FNd9NIrIMM+/nDWpQ9MNDwCEOEMQAiEAxrPfxQ+4gJYl5NVweX/PNrZA4t2g1kL/nzMTpgGHaI8="}]},"_npmUser":{"name":"mdp","email":"m@mdp.im"},"directories":{},"maintainers":[{"name":"mdp","email":"m@mdp.im"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/notion_mdx_2.0.0_1731704118860_0.29862173932381264"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-12T15:21:36.953Z","modified":"2024-11-15T20:55:19.251Z","1.0.0":"2024-11-12T15:21:37.324Z","2.0.0":"2024-11-15T20:55:19.061Z"},"author":{"name":"Mark Percival","email":"mdp@1984.vc"},"license":"MIT","keywords":["notion","mdx","markdown","export","cli","notion-to-md"],"description":"CLI tool to export Notion database pages to MDX files with frontmatter","maintainers":[{"name":"mdp","email":"m@mdp.im"}],"readme":"# @1984vc/notion_mdx\n\n[![CI](https://github.com/1984vc/notion_mdx/actions/workflows/ci.yml/badge.svg)](https://github.com/1984vc/notion_mdx/actions/workflows/ci.yml)\n\nA CLI tool to export Notion database pages to MDX files with frontmatter metadata.\n\n## Features\n\n- Export all pages from a Notion database to MDX files\n- Preserves page metadata in frontmatter\n- Maintains Notion content structure using notion-to-md\n- Generates clean filenames from page titles\n- Includes creation and last edited timestamps\n- Supports internal link transformations\n- Optional JSON export for raw data\n\n## Prerequisites\n\n- Node.js >= 14.0.0\n- A Notion integration token\n- Access to the Notion database you want to export\n\n## Installation\n\nYou can install this CLI tool globally using npm:\n\n```bash\nnpm install -g @1984vc/notion_mdx@2.0.0\n```\n\nOr locally in your project:\n\n```bash\nnpm add -D @1984vc/notion_mdx@2.0.0\n```\n\n## Setup\n\n1. Create a Notion integration at https://www.notion.so/my-integrations\n2. Copy the integration token\n3. Set the token as an environment variable:\n```bash\nexport NOTION_TOKEN=your_integration_token\n```\n4. Share your Notion database with the integration (click 'Share' in Notion and add your integration)\n\n## Usage\n\n### Export to MDX\n\n```bash\nnotion_mdx export-mdx --id <database_id> -o <output_path> [options]\n```\n\nOptions:\n- `--id`: Required. The Notion database ID\n- `-o, --output`: Required. The output directory path for MDX files\n- `--include-json`: Optional. Include raw JSON export in output directory\n- `--base-path`: Optional. Base path for internal links (e.g., /docs)\n- `--no-frontmatter`: Optional. Exclude frontmatter from MDX files\n\nExample:\n```bash\nnotion_mdx export-mdx --id \"123456789abcdef\" -o \"./content/posts\" --base-path \"/docs\"\n```\n\n### Export to JSON\n\n```bash\nnotion_mdx json --id <database_id> -o <output_path>\n```\n\nOptions:\n- `--id`: Required. The Notion database ID\n- `-o, --output`: Required. The output directory path for JSON file\n\nExample:\n```bash\nnotion_mdx json --id \"123456789abcdef\" -o \"./content/data\"\n```\n\n### Export Raw JSON\n\n```bash\nnotion_mdx raw-json --id <id> [-o <output_path>]\n```\n\nOptions:\n- `--id`: Required. The Notion database or page ID\n- `-o, --output`: Optional. Output file path (defaults to stdout)\n\nExample:\n```bash\nnotion_mdx raw-json --id \"123456789abcdef\" -o \"./data/raw.json\"\n```\n\n### Finding Your Database ID\n\nThe database ID is the part of your Notion database URL after the workspace name and before the question mark:\n```\nhttps://www.notion.so/workspace-name/123456789abcdef?v=...\n                                   ^^^^^^^^^^^^^^\n                                   This is your database ID\n```\n\n## Output Format\n\nEach page is exported as an MDX file with frontmatter metadata:\n\n```mdx\n---\ntitle: Page Title\nnotionId: page-id\ncreatedAt: 2024-01-01T00:00:00.000Z\nlastEditedAt: 2024-01-01T00:00:00.000Z\nweight: 0\n---\n\n[Your page content here]\n```\n\n## Development\n\nTo develop locally:\n\n1. Clone this repository\n2. Install dependencies: `npm install`\n3. Set up your NOTION_TOKEN environment variable\n4. Link the package locally: `npm link`\n5. Run the CLI: `notion_mdx export-mdx --id <database_id> -o <output_path>`\n\n### Testing and Linting\n\nRun tests:\n```bash\nnpm test\n```\n\nRun linting:\n```bash\nnpm run lint\n```\n\n## CI/CD\n\nThis project uses GitHub Actions for continuous integration and deployment:\n\n### Continuous Integration\n\nThe CI workflow runs automatically on:\n- All pull requests to the `main` branch\n- All pushes to the `main` branch\n\nIt performs:\n- Installation of dependencies\n- Code linting\n- Test suite execution\n\n### Automated Releases\n\nTo publish a new version to npm:\n\n1. Update the version in package.json:\n```bash\nnpm version patch  # for bug fixes\nnpm version minor  # for new features\nnpm version major  # for breaking changes\n```\n\n2. Push the new version tag:\n```bash\ngit push origin v*\n```\n\nThe release workflow will automatically:\n- Run tests\n- Build the package\n- Publish to npm under the @1984vc organization\n\nNote: Publishing requires an NPM_TOKEN secret to be set in the repository's GitHub secrets.\n\n## Dependencies\n\nKey dependencies:\n- @notionhq/client: ^2.2.15\n- commander: ^12.1.0\n- notion-to-md: ^3.1.1\n\n## Error Handling\n\nThe CLI will:\n- Verify the NOTION_TOKEN is set\n- Create the output directory if it doesn't exist\n- Skip and report any pages that fail to export\n- Provide progress feedback during export\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/1984vc/notion_mdx"}