6
2

More than 3 years have passed since last update.

最短2週間で著名OSSのメンテナになる方法

Last updated at Posted at 2021-08-22

意味がよくわからないタイトルですね。私もよく分かりません。

ある意味ではこの記事の続きです:貢献チャンスの探し方

TL;DR

pnpmについて

GitHubスター数12.5k越えの超巨大OSS、で説明は十分でしょう。

メンテナになって変わった事

変わったことといえば某F○rkwellにてこの2週間で21件スカウトが来たくらいで、特に何も生活は変わっていません。
ポートフォリオに公開できないプロジェクトの概要を書くよりはインパクトがあるんじゃないでしょうか?

メンテナになる流れ

Twitterで最新ソフトウェアの情報を仕入れる(初日)

これ見て、pnpmでnvm代替できるんじゃないかって思いました。

パッケージマネージャ上のソフトウェアの定義を最新にする(初日)

class Pnpm < Formula
  require "language/node"

  desc "📦🚀 Fast, disk space efficient package manager"
  homepage "https://pnpm.io/"
  url "https://registry.npmjs.org/pnpm/-/pnpm-6.11.5.tgz"
  sha256 "8eb5380d696c7e5ff8d7f58e31d453fca02363991e6162fee872bd08dac5c10f"
  license "MIT"

  livecheck do
    url "https://registry.npmjs.org/pnpm/latest"
    regex(/["']version["']:\s*?["']([^"']+)["']/i)
  end

  bottle do
    sha256 cellar: :any_skip_relocation, arm64_big_sur: "5e39cef7fd1b8e8715d678470b119052843d59fd7421c407fcdff24af3011044"
    sha256 cellar: :any_skip_relocation, big_sur:       "cbb69e29ac9cd2b924e9e1e8768a22798465e35ec48e0da244df1c8d57d4ddf6"
    sha256 cellar: :any_skip_relocation, catalina:      "cbb69e29ac9cd2b924e9e1e8768a22798465e35ec48e0da244df1c8d57d4ddf6"
    sha256 cellar: :any_skip_relocation, mojave:        "cbb69e29ac9cd2b924e9e1e8768a22798465e35ec48e0da244df1c8d57d4ddf6"
    sha256 cellar: :any_skip_relocation, x86_64_linux:  "5e39cef7fd1b8e8715d678470b119052843d59fd7421c407fcdff24af3011044"
  end

  depends_on "node"

  def install
    system "npm", "install", *Language::Node.std_npm_install_args(libexec)
    bin.install_symlink Dir["#{libexec}/bin/*"]
  end

  test do
    system "#{bin}/pnpm", "init", "-y"
    assert_predicate testpath/"package.json", :exist?, "package.json must exist"
  end
end

当時はHomebrew上のpnpmのバージョンが6.11.5だったので、brew bump-formula-prを実行してバージョンを上げようとしました。

環境固有の問題を見つける(初日〜1週間目)

早速、新しい定義のpnpmをインストールしてpnpm env use -g 16してみました。最初はうまく動きましたが、消したり入れたりしているうちにNode.js関連のプログラムが何も動かなくなってしまいました。調べたところ、pnpmがHomebrewが管理している/usr/local/bin以下を書き換えてしまっていることが判明したのでHomebrewのメンテナに報告しました。

Running pnpm env use --global 16 (a new feature of pnpm) replaces /usr/local/bin/node with the following script:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

"$basedir/../../../Users/umireon/.pnpm/nodejs/16.6.1/bin/node"   "$@"
exit $?

pnpm and npm continue to work after this replacement, but upgrading node by Homebrew may not work.

% brew reinstall node
--- snip ---
==> Pouring node--16.6.1.big_sur.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
  rm '/usr/local/bin/node'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

Possible conflicting files are:
/usr/local/bin/node
==> Summary
🍺  /usr/local/Cellar/node/16.6.1: 2,504 files, 48.3MB

Having a caveat for those who want to use pnpm env would be great.

Reference: https://github.com/pnpm/pnpm/releases/tag/v6.12.0

余談ですが、Homebrewのメンテナにはいつもボコボコにされています。

アップストリームの課題の解決に手を貸す(1週間目)

pnpmのことを色々調べているうちにpnpmのとある課題にたどり着きました。

この課題によると、pnpmの中心人物はHomebrewに収録されているpnpmの形式をnpmを介したものからバイナリに変更したいようでした。なので、Homebrewへのプルリクのゴールをバージョンアップからバイナリへの以降に急に変更しました(本来やってはいけないことですが、元々あった問題を報告した形になったのでHomebrewのメンテナは許してくれました )。

The pnpm author wants to use binary edition of pnpm for package managers.
pnpm/pnpm#3633

アップストリームへ貢献(1週間目〜2週間目)

Homebrewに適切な形で取り込んでもらうためにpnpmにガンガンプルリクを出しました。

課題でもどんどんディスカッションしました。

ついでに、ポータブルなインストール用シェルスクリプトを書きたいらしかったので、それに必要な環境を提供しました。

ついにメンテナに…!(2週間目)

5本プルリクを通した後、突然それは来ました。

Invitation.png

結論

私は貢献チャンスをものにしました。誰にでもできることが立証されました😃

6
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2