Skip to content

Conversation

@myjeong19
Copy link
Member

Description of Changes

Here is reference: @notionpresso/notionpresso-react #25


Summary

This PR revolutionizes CLI UX by eliminating manual page URL input and implementing automatic page discovery with --all option. Also introduces title-based file naming for better developer experience.

⚠️ Breaking Changes

File naming structure changed from ID-based to title-based.

  • Before: abc123def456.json
  • After: my-blog-post.json

Action required: Delete existing notion-data/ folder and re-run CLI.

What Changed & Why

Problem

  • Manual URL copy-paste for each page was tedious
  • ID-based filenames made content management difficult
  • No environment variable support required token input every time

Solution

  • Auto page discovery: --all option finds all accessible pages via Search API
  • Smart file naming: Use page titles instead of cryptic IDs
  • Environment variables: Read NOTION_API_KEY from .env file
  • Incremental updates: Only process changed pages for faster sync

Implementation Details

  • Added Search API integration for page discovery
  • Implemented title-based filename generation with sanitization
  • Created pages.json for frontend integration
  • Added cross-platform .env support
  • Refactored duplicate code between workflows

Documentation

  • Complete README rewrite with new features
  • Added setup guide with Notion Integration links

Review Needed

API reliability concern: Search API may not discover all pages due to Notion limitations. Should we add a fallback method or document this limitation?

Quick Test

# 1. Add to .env: NOTION_API_KEY=your_token
# 2. npm run build && npresso --all

Next.js Integration Testing

# Link CLI to Next.js project
pnpm link --global
cd /path/to/nextjs-project
echo "NOTION_API_KEY=your_token" > .env
pnpm link --global @notionpresso/cli
npresso --all

Review Guide

Reviews are conducted based on priority levels, such as p0, p1, p2, p3, p4, and p5.
p0 ~ p2: If the author decides not to reflect a review for p0 to p2, it signals that a proper discussion with the reviewer is
necessary. It is expected
that the review will be resolved either through incorporating the feedback or through further discussion.
p3: indicates that the reviewer has identified a significant issue, but either lacks a clear solution or the comment lacks sufficient context. Further explanation or additional discussion on the reviewer's concerns is needed.
p4, p5: p4 and p5 suggest low priority, and if the author does not deem them important, these comments can be disregarded.

…tion\n\n- Enforce max length in sanitizeFileName with safe fallback\n- Avoid trailing dashes after truncation
… Defer mkdir to per-image write path\n- Skip directory creation if no image is downloaded
@myjeong19
Copy link
Member Author

  • Applied safe truncation with fallback to prevent filename corruption or conflicts when titles exceed 50 characters
  • Updated behavior to avoid creating empty directories when no images are present

Copy link
Contributor

@Moon-DaeSeung Moon-DaeSeung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently reviewing other tasks, but it's difficult to understand the actual changes here since formatting updates to unrelated files are included. Could you please separate the formatting changes from the main feature or bugfix? This will make the review process much clearer. Thanks!

@myjeong19
Copy link
Member Author

I'm currently reviewing other tasks, but it's difficult to understand the actual changes here since formatting updates to unrelated files are included. Could you please separate the formatting changes from the main feature or bugfix? This will make the review process much clearer. Thanks!

sure, i’ll wrap this up by tomorrow morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants