Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version info "core:" will be incorrect if viewer and core have different versions #217

Open
MurakamiShinyu opened this issue Sep 30, 2021 · 0 comments

Comments

@MurakamiShinyu
Copy link
Member

現在の vivliostyle-cli では --version オプションでバージョン情報を表示させると、次のように cli と core のバージョンが出ます。

$ vivliostyle --version
cli: 4.2.1
core: 2.10.0

このうち core のバージョンの取得をしているところでは、次のように実際は viewer のバージョンを見ています:

export const { version: coreVersion }: { version: string } = JSON.parse(
fs.readFileSync(
resolvePkg('@vivliostyle/viewer', { cwd: __dirname })! + '/package.json',
'utf8',
),
);

このようにしている理由は、 core と viewer はモノレポの vivliostyle.js で作られており、基本的に同じバージョンであり、viewerのビルド済みのjsプログラム @vivliostyle/viewer/lib/js/vivliostyle-viewer.js には core のプログラムがバンドルされているため、直接 core のバージョンを得ることができないためです。

core と viewer はモノレポ化してから、基本的に同じバージョンでしたが、vivliostyle.js の version:bump スクリプトでバージョン更新するときに viewer のみ更新されている場合は、core のバージョンは更新されません。
最近の vivliostyle.js v2.11.0 のリリースでこの状態となりました。
この状態で、viewer をこのバージョンに更新した vivliostyle-cli を作成した場合、 --version で "core: 2.11.0" と表示されることになりますが、実際の core のバージョンは "2.10.0" のままです。

いくつかの解決方法のアイデア:

  • バージョン表示の "core:" を別のものに変える
  • 現在 @vivliostyle/viewer/package.json を見ているところを @vivliostyle/core/package.json を見るように変える。
    そうした場合の問題は、@vivliostyle/viewer/lib/js/vivliostyle-viewer.js 内にバンドルされている core と @vivliostyle/core/package.json のバージョンが一致しない可能性があること
  • viewer 側にバンドルされている core のバージョンを得るためのAPIか何かを設けてそれを使うようにする
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

No branches or pull requests

1 participant