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
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
890
めんそ〜れ!モブプロ!!!
kin29
0
840
Other Decks in Programming
See All in Programming
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.4k
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
550
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
250
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
590
C# and C++ Interoperability - cho-dotnetnew
harukasao
0
280
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
13k
AIで効率化できた業務・日常
ochtum
0
140
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
350
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
200
Lessons from Spec-Driven Development
simas
PRO
0
210
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
210
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
250
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
My Coaching Mixtape
mlcsv
0
150
Information Architects: The Missing Link in Design Systems
soysaucechin
0
970
Context Engineering - Making Every Token Count
addyosmani
9
970
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
750
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
200
Fireside Chat
paigeccino
42
4k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
30 Presentation Tips
portentint
PRO
1
330
Between Models and Reality
mayunak
4
340
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