npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

potpress-sdk

v0.0.2

Published

Notion APIからTypeScript型定義を自動生成するCLIツールです。

Readme

Notion TypeGen

Notion APIからTypeScript型定義を自動生成するCLIツールです。

機能

  • Notion APIからデータベース構造を取得
  • TypeScript型定義ファイルを自動生成
  • 複数のデータベースに対応
  • 出力先パスのカスタマイズ
  • インターフェース名のカスタマイズ

インストール

# npm でインストール
npm install -g notion-typegen

# または yarn でインストール
yarn global add notion-typegen

使い方

基本的な使用方法

notion-typegen --token=<NOTION_API_TOKEN> --database=<DATABASE_ID> --output=<OUTPUT_PATH>

コマンドラインオプション

| オプション | 省略形 | 説明 | |------------|--------|------| | --token | -t | Notion API トークン | | --database | -d | データベースID (複数指定する場合はカンマ区切り) | | --output | -o | 出力先のパス | | --name | -n | 生成するインターフェース名 (デフォルト: DatabaseProperty) | | --filename | -f | 出力ファイル名 (複数データベース指定時に使用) | | --config | -c | 設定ファイルのパス |

環境変数の使用

.envファイルまたは環境変数を使用して、Notion APIトークンを設定することもできます:

# .envファイル
NOTION_TOKEN=your_notion_api_token

設定ファイルの使用

複数のデータベースを処理する場合、設定ファイルを使用すると便利です:

notion-typegen --config=notion-typegen.config.js

設定ファイルの例 (notion-typegen.config.js):

module.exports = {
  token: "secret_xxxxxxxxxxxxxxxx", // 環境変数を使用する場合は省略可能
  databases: [
    {
      id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      output: "./src/types/blog.ts",
      interfaceName: "BlogProperty"
    },
    {
      id: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
      output: "./src/types/tasks.ts",
      interfaceName: "TaskProperty"
    }
  ]
};

出力例

import { type PropertyType } from "potion-core";

/**
 * ブログ記事 データベースのプロパティ型定義
 * 
 * 自動生成されたコード - 編集しないでください
 * 生成日時: 2023-11-25T12:34:56.789Z
 */
export type BlogProperty = {
  Page: PropertyType<"title">;
  Slug: PropertyType<"rich_text">;
  Published: PropertyType<"checkbox">;
  Date: PropertyType<"date">;
  Categories: PropertyType<"multi_select">;
  Tags: PropertyType<"multi_select">;
  Rank: PropertyType<"number">;
  Excerpt: PropertyType<"rich_text">;
  FeaturedImage: PropertyType<"files">;
};

Notion APIトークンの取得方法

  1. Notion Developers にアクセス
  2. 「My integrations」から新しいインテグレーションを作成
  3. 生成されたAPIトークンをコピー
  4. 対象のNotionデータベースでインテグレーションと接続 (右上の「...」→「Connections」→作成したインテグレーションを追加)

ライセンス

MIT