Gatsby Theme Aoi Blog CLI

2022-02-07

Gatsby Theme Aoi Blog CLI

post by cieloazul310

Gatsby Theme Aoi Blog のための CLI パッケージを作成しました。

動機

Gatsby には Hugo のように記事を投稿するコマンドはありません。投稿日時から /2022/02/${slug} のようにディレクトリを作成し、Hugo の Archetypes のように Markdown ファイルの雛形を作成する機能が欲しいと思いました。

使い方

# 1. install
npm install --save-dev @cieloazul310/gatsby-theme-aoi-blog-cli
# 2. set script
npm pkg set scripts.gatsby-aoi-blog="gatsby-aoi-blog"
# 3. create new post
npm run gatsby-aoi-blog new post "Article Title"

引数

  • -a, --author: 記事の投稿者を指定
  • -d, --date: 記事の日時を指定
  • --canonical: URL を正規化する (ex. /2022/02/new-post/index.md)
  • --mdx: MDX ファイルを作成 (ex. new-post.mdx)

開発

Commander.js で作成しました。

Gatsby Theme Aoi Blog CLI

Date: 2022-02-07

Post by cieloazul310

Categories: Gatsby Theme Aoi Blog

#CLI#nodejs

Gatsby Theme Aoi Blog

© 2023 @cieloazul310 All rights reserved. Built with Gatsby