Refer to the overall project contribution guide
- Overview
- Usage
- Notion API Setup
- Development and Testing
- Contribution Guide
notion-dump is a CLI tool that extracts data from Notion pages and saves it in JSON format to the local file system. This tool internally uses the @cozy-blog/notion-client library to communicate with the Notion API.
-
Clone the project and navigate to the directory
git clone https://github.com/meursyphus/react-notion-custom.git cd react-notion-custom
-
Install dependencies
# Run this in the root directory npm install
-
Build the project
# Run this in the root directory npm run cli:build
-
Run the script
node ./packages/notion-dump/dist/notion-dump.es.js --page <NotionPageURL> --auth <YourAPIToken>
Alternatively, use npm link to use it as a global command:
npm link notion-dump --page <NotionPageURL> --auth <YourAPIToken> npm unlink
-
Obtain a Notion API token
- Create a new integration on the Notion developers page
- Select the "Read content" permission
- Copy the Internal Integration Token
-
Connect the integration to a Notion page
- Add the integration in the "Connections" settings of the target page
-
Get the Notion page URL
- Copy the page URL (including query strings is acceptable)
- TypeScript compilation:
npm run build
- Adding dependencies: Update package.json, then run
npm install
- CLI script development
- Page data extraction
- Basic output directory management
- Image processing functionality:
Downloads all images and saves them. Changes the image URL in block types to the downloaded local path.
[ROOT_DIR]/ └── [page-title_page-id]/ ├── index.json └── images/ ├── image1.jpg ├── image2.png └── ...
- Support for Next.js project structure
- Support for various output formats
- Currently only supports single pages. Subpages or databases are not supported.
- Documentation and example improvements
- Check issues
- Fork and create a branch
- Write code and commit
- Create a pull request
- Code review and merge
Your participation is crucial to the development of notion-dump. Let's create a better tool together!