tag:crieit.net,2005:https://crieit.net/tags/Yarn/feed 「Yarn」の記事 - Crieit Crieitでタグ「Yarn」に投稿された最近の記事 2021-11-28T17:45:22+09:00 https://crieit.net/tags/Yarn/feed tag:crieit.net,2005:PublicArticle/17792 2021-11-28T17:45:22+09:00 2021-11-28T17:45:22+09:00 https://crieit.net/posts/gifsicle-error-gifsicle-pre-build-test-failed-20211128 yarn 時に gifsicle で gifsicle pre-build test failed エラー <p>数日前から yarn 時に gifsicle で gifsicle pre-build test failed エラーが出るようになってしまったので対処します。</p> <p>あれこれ試しましたが、結論から言うと <code>imagemin-gifsicle</code> が依存している <code>gifsicle</code> の <code>5.0.0</code> だとダメなので、 <code>resolution</code> で <code>5.2.1</code> を指定すると良さそうです。</p> <h2 id="現象"><a href="#%E7%8F%BE%E8%B1%A1">現象</a></h2> <pre><code class="json"> "devDependencies": { // 略 "gulp-imagemin": "^7.1.0", "imagemin-mozjpeg": "^9.0.0", "imagemin-pngquant": "^9.0.2", "imagemin-gifsicle": "^7.0.0", "imagemin-svgo": "^9.0.0", // 略 } </code></pre> <p><code>imagemin-gifsicle</code> を使用しているプロジェクトで <code>yarn</code> したところ、以下のエラーで失敗するようになってしまいました。</p> <pre><code class="bash">warning Error running install script for optional dependency: "PATH\\TO\\PROJECT\\node_modules\\gifsicle: Command failed. Exit code: 1 Command: node lib/install.js Arguments: Directory: PATH\\TO\\PROJECT\\node_modules\\gifsicle Output: Response code 404 (Not Found) gifsicle pre-build test failed compiling from source Error: Command failed: C:\\WINDOWS\\system32\\cmd.exe /s /c \"autoreconf -ivf\" 'autoreconf' �́A�����R�}���h�܂��͊O���R�}���h�A ����\\�ȃv���O�����܂��̓o�b�` �t�@�C���Ƃ��ĔF������Ă��܂���B at PATH\\TO\\PROJECT\\node_modules\\bin-build\\node_modules\\execa\\index.js:231:11 success Saved lockfile. </code></pre> <p>バージョンを上げても直後は特に問題なかったような気はするのですが、逐一キャッシュを削除したりしているわけではないので不明。</p> <p>仕方ないので、色々ググりながら対応してみます。</p> <h2 id="対処 (失敗したものたち)"><a href="#%E5%AF%BE%E5%87%A6+%28%E5%A4%B1%E6%95%97%E3%81%97%E3%81%9F%E3%82%82%E3%81%AE%E3%81%9F%E3%81%A1%29">対処 (失敗したものたち)</a></h2> <h3 id="gisicle を足す"><a href="#gisicle+%E3%82%92%E8%B6%B3%E3%81%99">gisicle を足す</a></h3> <pre><code class="json"> "devDependencies": { // 略 "gulp-imagemin": "^7.1.0", "imagemin-mozjpeg": "^9.0.0", "imagemin-pngquant": "^9.0.2", "imagemin-gifsicle": "^7.0.0", "gifsicle": "6.1.0", // 追加 "imagemin-svgo": "^9.0.0", // 略 } </code></pre> <p>変わらず。</p> <h3 id="逆にいっそ gulp-imagemin 以外全て削除"><a href="#%E9%80%86%E3%81%AB%E3%81%84%E3%81%A3%E3%81%9D+gulp-imagemin+%E4%BB%A5%E5%A4%96%E5%85%A8%E3%81%A6%E5%89%8A%E9%99%A4">逆にいっそ gulp-imagemin 以外全て削除</a></h3> <pre><code class="json"> "devDependencies": { // 略 "gulp-imagemin": "^7.1.0", // 略 } </code></pre> <p>変わらず。</p> <h3 id="コマンドプロンプトを管理者実行"><a href="#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%83%97%E3%83%AD%E3%83%B3%E3%83%97%E3%83%88%E3%82%92%E7%AE%A1%E7%90%86%E8%80%85%E5%AE%9F%E8%A1%8C">コマンドプロンプトを管理者実行</a></h3> <p><code>gifsicle</code> ありの状態で <code>cmd.exe</code> を管理者として実行→変わらず。</p> <h3 id="キャッシュ削除"><a href="#%E3%82%AD%E3%83%A3%E3%83%83%E3%82%B7%E3%83%A5%E5%89%8A%E9%99%A4">キャッシュ削除</a></h3> <pre><code>> yarn cache clean yarn cache v1.22.11 success Cleared cache. Done in 450.56s. </code></pre> <p>変わらず。</p> <h3 id="hosts に Github 関係の名前解決を書き込む"><a href="#hosts+%E3%81%AB+Github+%E9%96%A2%E4%BF%82%E3%81%AE%E5%90%8D%E5%89%8D%E8%A7%A3%E6%B1%BA%E3%82%92%E6%9B%B8%E3%81%8D%E8%BE%BC%E3%82%80">hosts に Github 関係の名前解決を書き込む</a></h3> <pre><code>>ping raw.githubusercontent.com raw.githubusercontent.com [185.199.108.133]に ping を送信しています 32 バイトのデータ: 185.199.108.133 からの応答: バイト数 =32 時間 =5ms TTL=58 185.199.108.133 からの応答: バイト数 =32 時間 =5ms TTL=58 185.199.108.133 の ping 統計: パケット数: 送信 = 2、受信 = 2、損失 = 0 (0% の損失)、 ラウンド トリップの概算時間 (ミリ秒): 最小 = 5ms、最大 = 5ms、平均 = 5ms </code></pre> <p>元々 <code>raw.githubusercontent.com</code> に ping はできていましたが、 <code>hosts</code> に次のように追記してみます。</p> <pre><code>52.74.223.119 github.com 192.30.253.119 gist.github.com 54.169.195.247 api.github.com 185.199.111.153 assets-cdn.github.com 151.101.76.133 raw.githubusercontent.com 151.101.76.133 gist.githubusercontent.com 151.101.76.133 cloud.githubusercontent.com 151.101.76.133 camo.githubusercontent.com 151.101.76.133 avatars0.githubusercontent.com 151.101.76.133 avatars1.githubusercontent.com 151.101.76.133 avatars2.githubusercontent.com 151.101.76.133 avatars3.githubusercontent.com 151.101.76.133 avatars4.githubusercontent.com 151.101.76.133 avatars5.githubusercontent.com 151.101.76.133 avatars6.githubusercontent.com 151.101.76.133 avatars7.githubusercontent.com 151.101.76.133 avatars8.githubusercontent.com </code></pre> <p>変わらず。</p> <p>なお、ここまで次の issue にあった対処法。</p> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/imagemin-gifsicle/issues/33">Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "autoreconf -ivf" · Issue #33 · imagemin/imagemin-gifsicle · GitHub</a></li> </ul> <h3 id="ネットワークを変更"><a href="#%E3%83%8D%E3%83%83%E3%83%88%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%92%E5%A4%89%E6%9B%B4">ネットワークを変更</a></h3> <p>違う場所に出かけて、ゲートウェイを変更してみました。</p> <p>が、変わらず。</p> <h3 id="最小限構成で実験する"><a href="#%E6%9C%80%E5%B0%8F%E9%99%90%E6%A7%8B%E6%88%90%E3%81%A7%E5%AE%9F%E9%A8%93%E3%81%99%E3%82%8B">最小限構成で実験する</a></h3> <p>長丁場になりそうだったので最小限構成の <code>package.json</code> を作成して検証を続行。</p> <pre><code>{ "name": "tmp", "version": "1.0.0", "main": "index.js", "license": "MIT", "devDependencies": { "imagemin-gifsicle": "^7.0.0" } } </code></pre> <p>これで<code>yarn</code>。変わらず。</p> <p>ちなみに <code>yarn.lock</code> の中身は次のような感じ。</p> <pre><code>gifsicle@^5.0.0: version "5.3.0" resolved "https://registry.yarnpkg.com/gifsicle/-/gifsicle-5.3.0.tgz#499713c6f1e89ebbc3630da3a74fdb4697913b4e" integrity sha512-FJTpgdj1Ow/FITB7SVza5HlzXa+/lqEY0tHQazAJbuAdvyJtkH4wIdsR2K414oaTwRXHFLLF+tYbipj+OpYg+Q== dependencies: bin-build "^3.0.0" bin-wrapper "^4.0.0" execa "^5.0.0" imagemin-gifsicle@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/imagemin-gifsicle/-/imagemin-gifsicle-7.0.0.tgz#1a7ab136a144c4678657ba3b6c412f80805d26b0" integrity sha512-LaP38xhxAwS3W8PFh4y5iQ6feoTSF+dTAXFRUEYQWYst6Xd+9L/iPk34QGgK/VO/objmIlmq9TStGfVY2IcHIA== dependencies: execa "^1.0.0" gifsicle "^5.0.0" is-gif "^3.0.0" </code></pre> <p><code>imagemin-gifsicle</code> が依存している <code>gifsicle</code> のバージョンが悪いのではないか、と思い <code>resolutions</code> を追加することにしました。</p> <h3 id="resolutions を追加"><a href="#resolutions+%E3%82%92%E8%BF%BD%E5%8A%A0">resolutions を追加</a></h3> <pre><code class="json">{ "name": "tmp", "version": "1.0.0", "main": "index.js", "license": "MIT", "devDependencies": { "imagemin-gifsicle": "^7.0.0" }, "resolutions": { "gifsicle": "^6.1.0" } } </code></pre> <p>すると、 <code>yarn</code> は通りました。</p> <p>しかし、 6系 は "Use native ESM" なので <code>require</code> を使用している現環境での使用は不可です。惜しい。</p> <h3 id="resolutions の指定を 5.3.0 にする"><a href="#resolutions+%E3%81%AE%E6%8C%87%E5%AE%9A%E3%82%92+5.3.0+%E3%81%AB%E3%81%99%E3%82%8B">resolutions の指定を 5.3.0 にする</a></h3> <pre><code>[email protected], gifsicle@^5.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/gifsicle/-/gifsicle-6.1.0.tgz#16194fe7d9420a539709eb065e7245eaf74de5a7" integrity sha512-tmnKbW2UQzoc/FTg2dq98sUaoGM1/CRQP+HtyeIMNLDlB8ijZbX7TKBCc2s5YJ8oXUZIxdqXH2rKXnCB0/Hg3w== dependencies: bin-build "^3.0.0" bin-wrapper "^4.0.0" execa "^5.1.1" </code></pre> <p><a target="_blank" rel="nofollow noopener" href="https://www.npmjs.com/package/gifsicle">gifsicle - npm</a>を確認したところ、11/26現在で <code>6.1.0</code> と並んで "3 days ago" となっている 5系 最新の <code>5.3.0</code> があることが判明。</p> <pre><code class="json">{ "name": "tmp", "version": "1.0.0", "main": "index.js", "license": "MIT", "devDependencies": { "imagemin-gifsicle": "^7.0.0" }, "resolutions": { "gifsicle": "^5.3.0" } } </code></pre> <p>しかしNG。</p> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/gifsicle-bin/issues/134">5.3.0 is error · Issue #134 · imagemin/gifsicle-bin · GitHub</a></li> </ul> <blockquote> <p>yep, this repo's 5.3.0 tag is missing, that makes the downloading process of bin-wrapper failed.</p> <p><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/gifsicle-bin/issues/134">5.3.0 is error · Issue #134 · imagemin/gifsicle-bin · GitHub</a></p> </blockquote> <p>タグ付けをミスって生まれてしまったバージョンらしいので、これは使えないとのこと。なんて紛らわしい……。</p> <h2 id="resolutions の指定を 5.2.1 にする"><a href="#resolutions+%E3%81%AE%E6%8C%87%E5%AE%9A%E3%82%92+5.2.1+%E3%81%AB%E3%81%99%E3%82%8B">resolutions の指定を 5.2.1 にする</a></h2> <pre><code class="json">{ "name": "tmp", "version": "1.0.0", "main": "index.js", "license": "MIT", "devDependencies": { "imagemin-gifsicle": "^7.0.0" }, "resolutions": { "gifsicle": "5.2.1" } } </code></pre> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://qiita.com/sotarok/items/4ebd4cfedab186355867">package.json のチルダ(~) とキャレット(^) - Qiita</a></li> </ul> <p><code>^5.2.1</code> とキャレットを付けると <code>5.2.1 <= version < 6.0.0</code> となってしまい、 <code>5.3.0</code> に上がってしまうので <code>5.2.1</code> とキャレットを外して指定します。</p> <pre><code>[email protected], gifsicle@^5.0.0: version "5.2.1" resolved "https://registry.yarnpkg.com/gifsicle/-/gifsicle-5.2.1.tgz#efadab266a493ef0b4178e34597493349937369e" integrity sha512-9ewIQQCAnSmkU2DhuWafd1DdsgzAkKqIWnY+023xBLSiK9Az2TDUozWQW+SyRQgFMclbe6RQldUk/49TRO3Aqw== dependencies: bin-build "^3.0.0" bin-wrapper "^4.0.0" execa "^5.0.0" imagemin-gifsicle@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/imagemin-gifsicle/-/imagemin-gifsicle-7.0.0.tgz#1a7ab136a144c4678657ba3b6c412f80805d26b0" integrity sha512-LaP38xhxAwS3W8PFh4y5iQ6feoTSF+dTAXFRUEYQWYst6Xd+9L/iPk34QGgK/VO/objmIlmq9TStGfVY2IcHIA== dependencies: execa "^1.0.0" gifsicle "^5.0.0" is-gif "^3.0.0" </code></pre> <p>これでようやく通りました。処理も無事にできることを確認。</p> <p>……思ったよりも手間取りました。</p> <h2 id="参考"><a href="#%E5%8F%82%E8%80%83">参考</a></h2> <h3 id="gifsicle"><a href="#gifsicle">gifsicle</a></h3> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/imagemin-gifsicle/issues/33">Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "autoreconf -ivf" · Issue #33 · imagemin/imagemin-gifsicle · GitHub</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/imagemin-gifsicle/issues/37">Install failed gifsicle@4.0.1 postinstall · Issue #37 · imagemin/imagemin-gifsicle · GitHub</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/gifsicle-bin/issues/102">Command failed: C:\WINDOWS\system32\cmd.exe /s /c "autoreconf -ivf" "autoreconf" · Issue #102 · imagemin/gifsicle-bin · GitHub</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/facebook/docusaurus/issues/1804">'autoreconf' is not recognized as an internal or external command · Issue #1804 · facebook/docusaurus · GitHub</a> <ul> <li><code>taobao.org</code> って中国ですよね……試す気にはなれないですね……。</li> </ul></li> <li><a target="_blank" rel="nofollow noopener" href="https://stackoverflow.com/questions/65147246/cannot-find-module-gifsicle-for-loading-image-webpack">Cannot find module 'gifsicle' for loading image -webpack - Stack Overflow</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://www.npmjs.com/package/gifsicle">gifsicle - npm</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://github.com/imagemin/gifsicle-bin/issues/134">5.3.0 is error · Issue #134 · imagemin/gifsicle-bin · GitHub</a></li> </ul> <h3 id="package.json"><a href="#package.json">package.json</a></h3> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://qiita.com/sotarok/items/4ebd4cfedab186355867">package.json のチルダ(~) とキャレット(^) - Qiita</a></li> </ul> arm-band tag:crieit.net,2005:PublicArticle/17425 2021-06-21T22:22:57+09:00 2021-06-21T22:22:57+09:00 https://crieit.net/posts/Node-js-GitHub-Actions 📝 Node.js パッケージを公開するための GitHub Actions を構築する <p><a target="_blank" rel="nofollow noopener" href="https://github.com/nikaera/react-emoji-textarea">react-emoji-textarea</a> の開発を行った際、<a target="_blank" rel="nofollow noopener" href="https://docs.github.com/ja/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository">リリース</a>を作成したら自動的に Node.js パッケージにライブラリが公開される仕組みがほしいと考え、GitHub Actions でそれを実現することにしました。</p> <p>その際、公式サイトに <a target="_blank" rel="nofollow noopener" href="https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-using-yarn">公開されている内容</a> を参考に GitHub Actions を作成したのですが、そのまま利用すると私の環境では下記のエラーが発生してしまいました。</p> <pre><code class="bash">error Couldn't publish package: "https://registry.yarnpkg.com/@nikaera/react-emoji-textarea: You do not have permission to publish \"react-emoji-textarea\". Are you logged in as the correct user?" </code></pre> <p>上記のエラーについて調査しながら改修したところ、最終的に下記の GitHub Actions で Node.js パッケージを公開できるようになりました。<code>secrets.NPM_TOKEN</code> には <a target="_blank" rel="nofollow noopener" href="https://docs.npmjs.com/creating-and-viewing-access-tokens">NPM Token</a> を登録します。</p> <pre><code class="yml"># package.yml name: Node.js Package on: # workflow_dispatch を追加して手動でも実行できるよう改修 workflow_dispatch: release: types: [created] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: "14.x" registry-url: "https://registry.npmjs.org" # registry.npmjs.org へアクセスする際は必ず認証を試みるオプションを追加 always-auth: true # scope には自分のユーザ名を指定 scope: "@nikaera" # .npmrc に https://registry.npmjs.org アクセス時に利用する認証情報を記載する - run: echo "//registry.npmjs.org/:_authToken=$<span>{</span><span>{</span> secrets.NPM_TOKEN <span>}</span><span>}</span>" > ~/.npmrc - name: Build react-emoji-textarea 😆💖 run: | yarn install --frozen-lockfile yarn format yarn build - run: yarn publish --access public env: NODE_AUTH_TOKEN: $<span>{</span><span>{</span> secrets.NPM_TOKEN <span>}</span><span>}</span> </code></pre> nikaera tag:crieit.net,2005:PublicArticle/16568 2021-01-08T23:52:48+09:00 2021-01-08T23:52:48+09:00 https://crieit.net/posts/yarn-error-there-appears-to-be-trouble-with-your-network-20210108 Yarn でパッケージをインストールする際に info There appears to be trouble with your network connection. Retrying... が出て失敗してしまう <p>Yarn でパッケージをインストールする際に</p> <blockquote> <p>info There appears to be trouble with your network connection. Retrying...</p> </blockquote> <p>が出て失敗してしまう現象に遭遇したので対処法をメモ。</p> <h2 id="現象"><a href="#%E7%8F%BE%E8%B1%A1">現象</a></h2> <p><code>package.json</code> が存在するプロジェクトで普通に <code>yarn</code> したら失敗しました。</p> <pre><code class="bash">> yarn ## 略 [2/4] Fetching packages... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your network connection. Retrying... error An unexpected error occurred: "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.11.2.tgz: ESOCKETTIMEDOUT". info If you think this is a bug, please open a bug report with the information provided in "PATH/TO/PROJECT/DIRECTORY/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. </code></pre> <p>Webサイトは閲覧できるので接続自体は正常の模様。他の原因としては、「該当パッケージが重過ぎてダウンロード中にタイムアウトしてしまう」というケース。今回の場合は <code>@material-ui/icons</code> ですね。</p> <h2 id="対処"><a href="#%E5%AF%BE%E5%87%A6">対処</a></h2> <p>対処として、プロジェクト直下に <code>.yarnrc</code> というファイルを作成し、以下のように記述しました。</p> <pre><code class="yarnrc">network-timeout 600000 </code></pre> <p>単位はミリ秒なので、上記の場合は600秒、つまり10分となります。</p> <p>今回はこれで上手く行きました。</p> <h3 id="その他の対策"><a href="#%E3%81%9D%E3%81%AE%E4%BB%96%E3%81%AE%E5%AF%BE%E7%AD%96">その他の対策</a></h3> <p>ファイルを作成せずにコマンドの引数として渡すこともできるようです(未実施)。</p> <pre><code class="bash">> yarn config set network-timeout 600000 </code></pre> <p>または</p> <pre><code class="bash">> yarn install --network-timeout 600000 </code></pre> <h2 id="参考"><a href="#%E5%8F%82%E8%80%83">参考</a></h2> <h3 id=".yarnrc 設置"><a href="#.yarnrc+%E8%A8%AD%E7%BD%AE">.yarnrc 設置</a></h3> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://qiita.com/GandT/items/9c2afa82609ff6062fd3">【Tips】yarn install時に発生しうるESOCKETTIMEDOUTの回避 - Qiita</a></li> <li><a target="_blank" rel="nofollow noopener" href="https://wonwon-eater.com/material-ui-lab-install/">yarn add @material-ui/labを実行するとThere appears to be trouble with your network connection. Retrying… │ wonwon eater</a></li> </ul> <h3 id="コマンドの引数"><a href="#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%AE%E5%BC%95%E6%95%B0">コマンドの引数</a></h3> <ul> <li><a target="_blank" rel="nofollow noopener" href="https://blog.sa2taka.com/post/resolve-yarn-info-there-appears-to-be-trouble-with-your-network-connection-retrying">yarnを行うと「info There appears to be trouble with your network connection. Retrying...」が出てくる - 園児ニアの庭園</a></li> <li><a target="_blank" rel="nofollow noopener" href="http://rdrgn.hatenablog.com/entry/2018/11/06/000000">yarnに「There appears to be trouble with your network connection.」と言われたら - もふふのはてな</a></li> </ul> arm-band tag:crieit.net,2005:PublicArticle/14829 2019-02-22T08:17:26+09:00 2019-02-24T08:49:49+09:00 https://crieit.net/posts/Yarn Yarnのコントリビュート説明ページが良い件について <p>ふとYarnのコントリビュートの説明ページを見たところ、OSS貢献するための情報が親切に書かれていて非常に良いなと思ったため紹介してみます。実際のページは下記になります。ちなみにYarnというのはNode.jsのパッケージマネージャです。</p> <p><a target="_blank" rel="nofollow noopener" href="https://yarnpkg.com/ja/org/contributing/">コントリビュート | Yarn</a></p> <h2 id="コントリビュートとは"><a href="#%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AA%E3%83%93%E3%83%A5%E3%83%BC%E3%83%88%E3%81%A8%E3%81%AF">コントリビュートとは</a></h2> <p>そもそもコントリビュートとは何かというと、YarnのようなオープンソースはGitHub上のリポジトリとして公開されており、誰でも開発に参加することができるようになっています。そのようにしてOSS開発に貢献することをコントリビュートといいます。</p> <p>自分のコミットが承認されてリポジトリに取り込まれると、そのプロジェクトのContributorになることができ、IssuesやPull requestsの自分の書き込みにもContributorのマークが付くようになります。</p> <h2 id="コントリビュートの説明ページとは"><a href="#%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AA%E3%83%93%E3%83%A5%E3%83%BC%E3%83%88%E3%81%AE%E8%AA%AC%E6%98%8E%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%A8%E3%81%AF">コントリビュートの説明ページとは</a></h2> <p>各オープンソースのプロジェクトにはだいたいコントリビュートの説明が書かれています。</p> <p>というのも、誰かが適当なコーディングスタイルでぐちゃぐちゃなプログラムを書いてきたり、誰も必要としていない機能のプルリクエストを勝手に送ってきても管理者含めてみんなが困ってしまいますので、そのあたりの手順やルールなどがまとめられています。</p> <p>小さなプロジェクトなどだと「自由に送ってね!」とかのものもありますが、大きなプロジェクトだと結構細かい手順等を書いてくれていたりしてくれています。</p> <p>そんな中Yarnの説明ページを見てみると、他とは違って親切に作られていることに気付きました。</p> <h2 id="どのように良いか"><a href="#%E3%81%A9%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E8%89%AF%E3%81%84%E3%81%8B">どのように良いか</a></h2> <h3 id="取り組みやすいIssueがどれかを教えてくれている"><a href="#%E5%8F%96%E3%82%8A%E7%B5%84%E3%81%BF%E3%82%84%E3%81%99%E3%81%84Issue%E3%81%8C%E3%81%A9%E3%82%8C%E3%81%8B%E3%82%92%E6%95%99%E3%81%88%E3%81%A6%E3%81%8F%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B">取り組みやすいIssueがどれかを教えてくれている</a></h3> <blockquote> <p>いくつか、最初に取り組むのに適したリンクを簡単に紹介しておきます。</p> </blockquote> <p>ということで実際のIssuesにリンクが貼られています。下記のようなリンクがあります。</p> <ul> <li>初めて取り組むのによいバグ (Good first bugs)</li> <li>初めて取り組むのに良い機能 (Good first features)</li> <li>助けが必要なインパクトの大きい issue (High impact issue that need help)</li> <li>問題を再現するスクリプトが必要な issue (Issues need reproduction scripts)</li> <li>トリアージが必要な issue</li> </ul> <p>これがすごく良いなと思いました。公式としてはじめて取り組むのはこれが良さそう、というのを指定してくれているので、「ほんとにこのあたりは進めてみても良いのだろうか…」という事を悩まずにすむためそれだけでも貢献しやすさが全然違ってくると思います。最初ってこういうところでドキドキするだけで結構消耗してしまったりしますので…。</p> <h3 id="日本語で書かれている"><a href="#%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%81%A7%E6%9B%B8%E3%81%8B%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B">日本語で書かれている</a></h3> <p>さすが規模の大きいプロジェクトだからかもしれませんが、日本語というか多言語で書かれていることは個人的にあまり見たことがなかったため、よくよく考えたら親切なのでは、と思いました。</p> <p>そもそもだいたいこういう説明がMarkdownでGit管理されているだけだったりすることが多いので英語で書かれていることがほとんどかなと思います。(とはいえ決まりきったことが書かれているだけなので英語でも特に不便はないのですが)</p> <h3 id="実際の対応の流れが書かれている"><a href="#%E5%AE%9F%E9%9A%9B%E3%81%AE%E5%AF%BE%E5%BF%9C%E3%81%AE%E6%B5%81%E3%82%8C%E3%81%8C%E6%9B%B8%E3%81%8B%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B">実際の対応の流れが書かれている</a></h3> <p>下記のようなものが書かれています。</p> <ul> <li>環境構築の方法</li> <li>テストを実行する方法</li> <li>実際にプルリクエストを送る方法</li> </ul> <p>実際の実行方法は他のOSSでもだいたい書かれていますし、PRを送る方法も調べればいくらでも出てくるのですが、実際に本家が書いてくれていることの安心感はやはり大きいと思います。</p> <h3 id="行動規範が書かれている"><a href="#%E8%A1%8C%E5%8B%95%E8%A6%8F%E7%AF%84%E3%81%8C%E6%9B%B8%E3%81%8B%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B">行動規範が書かれている</a></h3> <p>多くの人が利用し参加するプロジェクトだからかもしれませんが、行動規範までがしっかり書かれているのは珍しいような気がしました。いわゆるネットマナーと言うか、古い言葉で言うとネチケットみたいなものでしょうか。</p> <p>逆にこういうのが書かれていることで、OSSの世界にもやばい人たちが結構いるのかな…という想像も膨らみます。</p> <p>恐る恐るコントリビュートをはじめる人からすると、相手がまともな人なのかおかしな人なのか、特に国という枠を超えた場合には判断しづらいと思いますので、何かひどいことを言われても「世の中こういうものなのかな…。自分が悪かったんだろうな…」と不必要に自分をせめて貢献をやめてしまう人などもいるのではないかと思います。そういうのは非常にもったいないですし、少しでもそういうことが減る要因になるのであればすごく良いことかなと感じます。</p> <h2 id="やっていきましょう"><a href="#%E3%82%84%E3%81%A3%E3%81%A6%E3%81%84%E3%81%8D%E3%81%BE%E3%81%97%E3%82%87%E3%81%86">やっていきましょう</a></h2> <p>OSSへの貢献に興味のある人は、こういう貢献の方法が分かりやすいプロジェクトからはじめてみるのも手かもしれません。ぜひちょうどやりやすいものを探してチャレンジしてみましょう。たまたま今回見つけたのがYarnだったというだけで、他にも分かりやすいものがありそうな気はします。</p> <p>他にも翻訳へのコミットやちょっとしたタイポの修正、コードではなくIssuesへの書き込みでの貢献等、とりあえずできるところからはじめてみる、という方法もありそうです。</p> だら@Crieit開発者