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

@wato787/microcms-cli

v0.1.5

Published

AI-friendly CLI tool for microCMS, built with Bun

Readme

microCMS CLI

microCMS 用の CLI ツールです。実行コマンドは microcms です。
npm 配布物は事前ビルド済みのため、実行時に Bun は不要です(Node.js 18+)。

  • generate:types: Management API のスキーマから TypeScript 型を生成

Install

npm install -g @wato787/microcms-cli
# または
bun add -g @wato787/microcms-cli
# インストールせずに実行
npx @wato787/microcms-cli generate:types blog

Commands

generate:types [endpointId] [options]

microCMS Management API(/api/v1/apis)から API スキーマを取得し、TypeScript 型を生成します。 生成結果は microcms.d.ts に集約されます。 共通型(MicroCMSListResponse など)は microcms-js-sdk の公式定義に合わせています。 このコマンドは Content API のコンテンツ取得エンドポイントは呼びません。

  • endpointId 指定時: 対象 endpoint のスキーマのみ取得
  • --all 指定時: API 一覧を取得して全 endpoint を生成
  • 生成型: XxxSchema(スキーマ本体)と XxxContent(SDK の共通メタ情報付き)
  • 利用する Management API: /api/v1/apis, /api/v1/apis/{endpoint}
# 単一エンドポイント
microcms generate:types blog

# 出力先ディレクトリ指定(デフォルトは ./types/microcms.d.ts)
microcms generate:types blog -o ./src/types/microcms
# => ./src/types/microcms/microcms.d.ts

# 出力ファイルを直接指定
microcms generate:types blog -o ./src/types/microcms.d.ts

# 全エンドポイントを一括生成
microcms generate:types --all
# endpointIdを渡しても --all 指定時は無視されます
microcms generate:types blog --all

# CIなどで環境変数をインライン指定
MICROCMS_SERVICE_DOMAIN=your-service-id \
MICROCMS_API_KEY=your-management-api-key \
microcms generate:types blog

Options

  • -o, --output <path>: 出力先(ディレクトリ指定時は <path>/microcms.d.ts、デフォルト ./types/microcms.d.ts
  • --all: 全エンドポイントの型を生成
  • --service-domain <domain>: MICROCMS_SERVICE_DOMAIN をCLI引数で上書き
  • --api-key <key>: MICROCMS_API_KEY をCLI引数で上書き

Required environment variables

generate:types実行した利用者の環境変数 から設定を読み取ります。
カレントディレクトリの .env.env.local を自動で読み込みます(.env.local は後から読み込むため、同名の変数を上書きします)。dotenv 使用。
CLI引数で指定しない場合、以下の環境変数が必要です。

MICROCMS_SERVICE_DOMAIN=your-service-id
MICROCMS_API_KEY=your-management-api-key

Required Management API permission

MICROCMS_API_KEY には、マネジメントAPIのGET権限として 「API情報の取得」 が必要です。

補足: 単一 endpoint で apiType が取得できない場合、CLI は警告を出して LIST として型生成します。

Development

開発ツール(Node.js / Bun)は mise.toml でバージョン固定しています。
最初に mise install を実行してから開発コマンドを実行してください。

# ツールチェインを mise.toml から導入
mise install

bun install
bun run build
bun run typecheck
bun run test
bun run lint
bun run format:check

# シェルに反映されない場合の実行例
mise exec -- bun run build

# 自動修正
bun run lint:fix
bun run format

# 事前ビルド済み CLI を実行
bun run start -- generate:types blog

# ソースから実行(Bun)
bun run dev generate:types blog

# 単一バイナリを生成
bun run compile