-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support to run local game.json #23
Conversation
@@ -0,0 +1,157 @@ | |||
import { setSystemLogger } from "../Logger"; |
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.
こちらはテスト分割による差分です。
テスト内容に変更はありません。
@@ -0,0 +1,449 @@ | |||
import { GetStartPointOptions, StartPoint } from "@akashic/amflow"; |
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.
こちらはテスト分割による差分です。
テスト内容に変更はありません。
@@ -863,6 +215,73 @@ describe("コンテンツ動作テスト", () => { | |||
}); | |||
}); | |||
|
|||
describe("ローカルコンテンツの動作テスト", () => { |
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.
こちらが本修正によるテストになります。
return await this.loadJSON(contentUrl); | ||
} | ||
|
||
protected async resolveGameConfiguration<T>(gameJsonUrl: string): Promise<T> { |
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.
型にバリエーションがあるような名前に見えませんが、この T
は必要なんでしょうか……?
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.
a3114f8
こちら generics を利用しないように修正しました。
|
||
export interface PlayWithContentDir { | ||
/** | ||
* game.json を含むディレクトリ。 |
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.
「game.json を含むディレクトリ」を指定することになっていますが、game.json のパスを指定するようにはできないでしょうか。というのも、「ローカルディレクトリか URL か」と「game.json か content.json か」は独立だと思えるからです。headless-driver は概念的には「content.json を含むディレクトリ」や「game.json の URL」も扱えていいと思います。
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.
こちら少し迷った部分だったのですが、おっしゃる通り game.json
のローカルパスを指定する gameJsonPath
に変更しました。
- ローカルの content.json を扱う (
contentPath
) - URL上の game.json を扱う (
gameJsonUrl
)
については別 PullRequest での対応とさせてください。
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.
ホスティング時のテスト部分で結構無理をしているため、先にそちらの改修を行いたいためです。
headless-driver/packages/headless-driver/src/__tests__/helpers/MockRunnerManager.ts
Lines 11 to 26 in ddc8a75
protected async resolveContent(contentUrl: string): Promise<any> { | |
const config = await loadFile<any>(contentUrl, { json: true }); | |
if (config.content_url === "v1_content_url") { | |
config.content_url = gameJsonUrlV1; | |
} else if (config.content_url === "v2_content_url") { | |
config.content_url = gameJsonUrlV2; | |
} else if (config.content_url === "v2_content_cascade_url") { | |
config.content_url = cascadeGameJsonUrlV2; | |
} | |
if (config.asset_base_url === "v1_asset_base_url") { | |
config.asset_base_url = assetBaseUrlV1; | |
} else if (config.asset_base_url === "v2_asset_base_url") { | |
config.asset_base_url = assetBaseUrlV2; | |
} | |
return config; | |
} |
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.
コメントつけましたが approved.
export type Play = (PlayWithContentUrl | PlayWithContentDir) & BasePlay; | ||
export type Play = PlayLocation & BasePlay; | ||
|
||
export type PlayLocation = (PlayWithContentUrl | PlayWithGameJsonPath); |
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.
play に場所はなさそうに思え、これはむしろ ContentLocation
とでも呼ぶ方が実情に近いのではないでしょうか。
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.
おっしゃる通りでしたので修正しました。
a807d86
このPullRequestが解決する内容