hacomono TECH BLOG

フィットネスクラブ・スクールなど施設・店舗のための会員管理・予約・決済システム「hacomono」 開発チームの技術ブログ

なるべく楽して JS のライブラリを作ってみる (part3: 運用)

どうも、フロントエンドのテックリードやってるみゅーとん(@_mew_ton)です。

前回からだいぶ時間が空いてしまいましたが、ライブラリのリリースまでが完了しました。

ライブラリの contribution など、今後の運用について、ここでは語っていこうと思います。

TL; DR

  • version, リリース管理には changesets を使うと楽
  • CONTRIBUTION.md なども ChatGPT に任せると楽

本記事で扱わないこと

  • バージョン・リリース管理フレームワークそのものの入門・導入方法

作ったライブラリ

バージョン管理

バージョン管理に changesets を使うことは、実ははじめから決めていました。

導入理由は以下の通り依存元やファンが多く、ライブラリとして太いことが推察されるためです。

changesets とは?

本来は monorepo 向けのバージョン・リリース管理フレームワークです。monorepo のどのパッケージをどのようにバージョンアップするかを簡単に管理することができます。

また、運用が結構簡単で、 single repo でも問題なく管理できる利点があります。

Contribution Guideline を作ってもらった

ここで、試しに chatGPT に以下の質問を投げかけてみます。

Changesets を使用する方針でのコントリビューションガイドラインを作成してください。

すると、以下の Markdown が排出されました。

# Contribution Guidelines

We appreciate your interest in contributing to our project! To ensure a smooth contribution process, please follow these guidelines.

## Getting Started

1. Make sure you have the appropriate permissions to contribute to the repository.
1. Clone the repository to your local machine using `git clone https://github.com/your-username/your-repo.git.`
1. Install the project dependencies by running `yarn install`.

## Development Workflow

1. Create a new branch for your changes: `git checkout -b your-feature-branch.`
1. Make your changes and commit them with a descriptive commit message.
1. Run tests to ensure your changes don't introduce any regressions: `yarn test`.
1. Push your changes to the repository on GitHub.

## Using Changesets

We use Changesets to manage our changelog and versioning. Follow these steps to create a changeset for your changes:

1. Ensure you have the Changesets CLI installed globally: `yarn global add @changesets/cli`.
1. Run `yarn changeset` in the project root.
1. Follow the CLI prompts to choose the affected packages and the appropriate version bump (major, minor, or patch) based on your changes.
1. Commit the generated changeset file along with your changes.

## Creating a Pull Request

1. Push your feature branch to the repository on GitHub.
1. Create a new Pull Request targeting the `main` branch.
1. In your Pull Request description, provide a brief summary of your changes and any additional context.
1. Ensure that any required status checks pass before requesting a review.

Thank you for contributing to our project! We look forward to reviewing your changes and collaborating with you.

・・・そのまま使っても問題なさそうな出来かなと思います。

まとめ

本シリーズでは、ライブラリの設計から開発、リリース後の運用に至るまでを、

なるべく AI を用いて、手間をかけずに作ってみました。

実装自体はほとんど手作業であるところが多かったですが、

ライブラリの命名から、 Readme, Contribution などのガイドラインの生成まではほとんど手間がかからずにできたかと思われます。

余談ですが、同様のやりかたでもう一つライブラリを作っていました。 (これのせいで続編が遅れました)


株式会社hacomonoでは一緒に働く仲間を募集しています!
採用情報や採用ウィッシュリストも是非ご覧ください!