Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
社内パッケージの再利用にSatisを使っている話.pdf
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kin29
April 11, 2022
Programming
1.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内パッケージの再利用にSatisを使っている話.pdf
PHPerKaigi2022
kin29
April 11, 2022
More Decks by kin29
See All by kin29
外部APIとズブズブな開発どうしてますか?
kin29
2
2.2k
【Symfony超入門】コマンドだけでCRUD画面を作るチート法
kin29
0
900
めんそ〜れ!モブプロ!!!
kin29
0
850
Other Decks in Programming
See All in Programming
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
5分で問診!Composer セキュリティ健康診断
codmoninc
0
910
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
340
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.5k
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
150
yield再入門 #phpcon
o0h
PRO
0
980
霧の中の代数的エフェクト
funnyycat
1
490
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
300
メールのエイリアス機能を履き違えない
isshinfunada
0
230
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4.1k
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
590
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
240
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
400
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Chasing Engaging Ingredients in Design
codingconduct
0
260
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Making Projects Easy
brettharned
120
6.7k
Done Done
chrislema
186
16k
エンジニアに許された特別な時間の終わり
watany
108
250k
Transcript
社内パッケージの再利用に satisを使っている話 志賀 彩乃
自己紹介 • 林(旧:志賀) 彩乃 • PHPer 6年 • Symfony 3年
• カルテットコミュニケーションズ 3年(産休育休1年含む) • 子育て中(1歳半息子) Twitter: @kin29ma_n / GitHub: @kin29
本題に入ります
PHPerのみなさんに質問です プライベートな社内パッケージを再利用したい時、 どうやってますか?
プライベートな社内パッケージの例 プライベートな社内パッケージ (秘伝のタレ) サービスA (秘伝のタレを使ったうなぎ ) サービスB (秘伝のタレを使った焼き鳥 )
(packagistに未登録) quartetcom/repository composer requireできない packagistに登録していないリポジトリは再利用することはできない packagist symfony/symfony … $ composer
require symfony/symfony $ composer require quartetcom/repository
しかし
quartetcom/repository を使いたい人 composer requireできる + "repositories": { + "quartetcom/repository": {
+ "type": "vcs", + "url": "https://github.com/quartetcom/repository.git" + } + } composer.json composer.jsonのrepositoriesに追加すればcomposer requireできる! $ composer require quartetcom/repository quartetcom/repository (packagistに未登録)
ただし、以下のデメリットがある🥺 • 再利用したいリポジトリが複数ある場合、 そのリポジトリの数だけcomposer.jsonに追記する必要がある。
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
} } composer.json quartetcom/repo1 (packagistに未登録) $ composer require
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
}, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, } composer.json quartetcom/repo1 (packagistに未登録) quartetcom/repo2 $ composer require $ composer require
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
}, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, + "quartetcom/repo3": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo3.git" + } } composer.json quartetcom/repo1 (packagistに未登録) quartetcom/repo2 quartetcom/repo3 $ composer require
quartetcom/repo1~3 を使いたい人 quartetcom/repo1 (packagistに未登録) quartetcom/repo2 quartetcom/repo3 $ composer require "repositories":
{ "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git" }, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, + "quartetcom/repo3": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo3.git" + } } composer.json めんどう😓
その問題、Satisで解決できるかも
{ "name": "quartetcom.composer", "homepage": "https://quartetcom/composer", "repositories": [ { "type": "vcs",
"url": "https://github.com/quartetcom/repo1" }, { "type": "vcs", "url": "https://github.com/quartetcom/repo2" }, { "type": "vcs", "url": "https://github.com/quartetcom/repo3" } ], "require-all": true } satis.json quartetcom/repo1~3 を使いたい人 再利用したいリポジトリ quartetcom/repo1 quartetcom/repo2 quartetcom/repo3 $ composer require + "repositories": { + "quartetcom": { + "type": "composer", + "url": "https://quartetcom/composer" + } + }, composer.json $ vendor/bin/satis build satis.json web/ Scanning packages Wrote packages to docs/p2/quartetcom/repo1.json Wrote packages to docs/p2/quartetcom/repo1~dev.json … Writing packages.json Pruning include directories Writing web view
メリット💡 • satis.jsonに再利用対象のリポジトリを追加→buildするだけでok • 複数パッケージを一括管理しやすい • 一覧画面もいい感じにできる👉 • Basic認証で制限も可能 •
ビルドインwebサーバで無料で簡単にできる $ php -S localhost:8888 -t web • GitHub Pagesでも作れました🎉 https://kin29.github.io/composer-repository/
kin29/repo1 - v0.0.1 - v0.0.2🆕 POST (おまけ)GitHub Actionsでsatis buildを自動化してみた! on:
release: types: [published] jobs: run: | curl --request POST 'https://api.github.com/repos/kin29/coposer-repository/dispatches' \ --header 'Authorization: Bearer ${{secrets.MY_TOKEN}}' \ --header 'Content-Type: application/json' \ --data-raw '{"event_type": "repository-updated"}' kin29/composer-repository on: repository_dispatch: types: [repository-updated] jobs: - name: satis build run: | composer config --global github-oauth.github.com ${{secrets.MY_TOKEN}} vendor/bin/satis build satis.json docs - name: Push build files run: | git remote set-url origin https://github-actions:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPO} git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" if (git diff --shortstat | grep '[0-9]'); then \ git add .; \ git commit -m "👕 Fixed satis build files by github-actions"; \ git push origin HEAD:${GITHUB_REF}; \ fi
private packagistというサービスもあります • https://packagist.com/ • 無料トライアルあり(その後は課金制)
ところで
実はComposer、 Symfonyコミュニティから生まれました!
カルテットはSymfonyで開発をしています! エンジニア・デザイナー大募集中です。 私のようにフルリモートで働くことができたり、 子育て中でも働きやすい環境です^^ ご興味がある方はこちらからどうぞ👇 https://quartetcom.co.jp/recruit/engineer/
ご清聴ありがとうございました 参考: https://getcomposer.org/doc/articles/handling-private-packages.md https://github.com/composer/satis