Skip to content

Fix ESM output and add npm release workflows - #4

Merged
rdlabo merged 4 commits into
mainfrom
fix/npm-release-and-esm
Sep 24, 2026
Merged

rdlabo merged 4 commits into
mainfrom
fix/npm-release-and-esm

Conversation

@rdlabo

@rdlabo rdlabo commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Emit Node-compatible ESM by using NodeNext and explicit .js relative specifiers.
  • Add an ESM import smoke check to CI.
  • Port the ios27 npm release flow: immutable package candidates on PR/main, beta publication after a successful PR merge or an authorized /beta comment, and SemVer tag publication (latest for stable, next for prerelease).

Verification

  • npm run build
  • npm test (16 tests)
  • npm run lint
  • npm run fmt:check
  • actionlint .github/workflows/*.yml
  • node --input-type=module -e "await import('./dist/index.js')"
  • npm pack --dry-run --json includes dist/index.js

Related to rdlabo-dev/ionic-theme-ios27#217. npm trusted publishing must be configured for this repository before its first publication.


Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Comment on lines +380 to +381
const trustedPackage = await getTrustedPackage(targetBranch);
const version = `${trustedPackage.baseVersion}-beta.pr${prNumber}.sha${headSha.slice(0, 12)}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 バージョン更新を含む PR のベータ公開が失敗する

PR でバージョンを更新すると、候補パッケージは PR 側のバージョンで作られます。ここでは main 側のバージョンを期待するため、公開時に一致せず失敗します。

Learn more

候補ワークフローは PR の先頭コミットをチェックアウトし、その package.json のバージョンを使ってアーカイブを作ります。承認側は main の package.json から期待するバージョンを作るため、PR にバージョン更新が含まれると両者は一致しません。アーカイブの名前とバージョンの検査は 公開ステップで行われ、公開が止まります。公開直前の再検証にも同じ前提があります。

Example: main が 0.1.0、PR が 0.2.0 なら、候補は 0.2.0-beta.pr4.sha...、承認側の期待値は 0.1.0-beta.pr4.sha... です。CI と候補の作成が成功しても /beta で公開できません。

Recommended fix: PR の候補バージョンを承認処理と再検証でも同じコミットから算出してください。パッケージ名など main に固定すべき項目は別途 main と照合し、候補のバージョンと混同しないでください。

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +104 to +113
- name: Publish packages
run: |
VERSION="${{ steps.tag_version.outputs.version }}"
IS_STABLE=$(echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' && echo true || echo false)

echo "Publishing... $IS_STABLE"
if [ "$IS_STABLE" = "true" ]; then
npm publish --provenance --access public --tag latest
elif echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+-[0-9A-Za-z.-]+$'; then
npm publish --provenance --access public --tag next

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 配布方法の説明が npm リリースフローと食い違う

README の利用案内は TypeScript ソースのコンパイルと Git タグ依存を前提にしています。npm 版と ESM 出力の利用方法も案内する必要があるか確認してください。

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@rdlabo
rdlabo merged commit 8999197 into main Sep 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant