add github package publish workflow - #1146
Open
KosukeTakahashi0410 wants to merge 8 commits into
Open
Conversation
Renaming the packages left every cross-package reference pointing at the old unscoped names, which broke the build. Drop the ESLint config resolution block in DefaultCommand as well: its path arithmetic assumed an unscoped layout, and the module.paths it pushed were never read because no require follows it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The shared ESLint config loads eslint-plugin-wantedly, whose main entry is its build output. The lint job never built, so ESLint failed to load whenever the job had files to lint. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The rewrite now touches .js sources, so the temp commit tripped the pre-commit hook: lint-staged runs ESLint against names that only exist on npm. Skip the hook, fail the step if the rewrite matches nothing, and point the generated pre-commit hook at the scoped install path so the npm rewrite restores it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
npmへのリリースに際して、現在はGranular access tokensを生成してPublishを行っている
しかしGranular access tokensは90日間でローテーションする、また、トークンの漏洩リスクは存在している
Github Packagesへの移行を行うことで一定上記の問題が解消できるため、Github Packagesへ移行を行う
What
追加の修正
CI を green にするために以下を追加した。
改名で壊れた参照の修正
@wantedly/*への改名にリポジトリ内の相互参照が追従しておらず、build と lint が失敗していた。.prettierrc/eslint.config.mjs/ 各 config パッケージのbase.jsreact.js/packages/frolint/srcの参照を改名後の名前に更新したmeta.nameを実際のパッケージ名に合わせ、スナップショットを更新したDefaultCommandの ESLint config 解決ブロックを削除した。パス計算がスコープ無しの配置を前提にしており改名で壊れるうえ、module.pathsへ push した値はその後にrequireが無いので読まれないpublish の修正
create-release-prjob にregistry-urlとscopeを指定した setup-node を足した。これが無いと GitHub Packages 用の_authTokenがどこにも書かれず publish が 401 になる。install より後に置いているのは、先に置くと public な依存の解決まで GitHub Packages に向いてしまうためpackages/frolint/lib/utils/prettier.jsなどがスコープ付きの名前で require しており、package.json の名前だけ戻すと npm 側のパッケージが壊れるenvを削除した。どちらの環境変数も参照されておらず、//は YAML のコメントではないので値にゴミが入っていたlint job の修正
lint job だけ build を挟んでおらず、共有 ESLint config が読み込む
eslint-plugin-wantedlyの main(ビルド成果物)が存在しないため ESLint が起動できなかった。この PR の改名とは無関係の既存の問題で、lint 対象のファイルがある PR では必ず失敗する。補足
changeset は追加していない。改名後のパッケージは GitHub Packages 上にまだ存在しないので、
changeset publishが現行バージョンをそのまま publish する。利用側が名前を差し替えるときにバージョンを据え置けるので、そのほうが移行しやすい。publish は master への merge 後にしか走らないため、この PR の CI では検証できない。