-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix(export): fix --bundle breaks games including audio #1506
Conversation
@@ -183,7 +183,7 @@ describe("exportHTML", function () { | |||
expect(fsx.statSync(path.join(dest, "audio", "dummyse.ogg"))).toBeTruthy(); | |||
expect(fsx.statSync(path.join(dest, "audio", "dummyse.aac"))).toBeTruthy(); | |||
expect(fsx.statSync(path.join(dest, "audio", "dummyse.m4a"))).toBeTruthy(); | |||
expect(() => void fsx.statSync(path.join(dest, "audio", "dummyse.invalidext"))).toThrow(); | |||
expect(() => fsx.statSync(path.join(dest, "audio", "dummyse.invalidext"))).toThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
別件。こうなっている経緯がよくわかっていません (およそうっかり書くような演算子ではない) が、エディタ上で implicit any として怒られるので削っています。
@@ -12,8 +12,7 @@ import { rollup } from "rollup"; | |||
import type { MinifyOptions } from "terser"; | |||
import { minify_sync } from "terser"; | |||
import * as liceneUtil from "../licenseUtil.js"; | |||
import * as utils from "../utils.js"; | |||
import { validateGameJson } from "../utils.js"; | |||
import { validateGameJson, warnLackOfAudioFile } from "../utils.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
別件2。import 方法を統一しておきます。
gcu.removeAssets(gamejson, (asset) => preservingFilePathSet.has(asset.path)); | ||
// preservingFilePathSet (維持するファイル一覧) にないものは game.json から削除する。 | ||
// 暫定措置: audio は常に残す。(path に拡張子がないので preservingFilePathSet と比較できない。今後 audio を bundle しない限り動作上の悪影響はない) | ||
gcu.removeAssets(gamejson, (asset) => (asset.type === "audio") || preservingFilePathSet.has(asset.path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本題ここだけです。
掲題どおり。
--bundle
時、不要ファイルを削除する際に音声アセットが全て消される問題を解消します。「不要ファイル」の判定は
preservingFilePathSet
とasset.path
で行われていますが、音声アセットの場合に限りasset.path
が拡張子を含まないため、間違って全部不要と判定されていました。( #1486 の最後でつけたコメント #1486 (comment) が誤りでした。) 元々現状では音声アセットが減ることはない=全て残るだけなので、暫定的に type: "audio" のアセットは常に残すように変更します。#1465 同様に、ミニマムコンテンツのほか、ニコニコスネーク と リリアと魔女 [LILIEA - Act1] で動作を確認しています。ユニットテストでは扱えていない範囲で、prerelease 後に reftest で動作確認を行います。