@mpgd/cli 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/templates/phaser-game/README.md +11 -2
- package/templates/phaser-game/apps/target-ait/package.json +1 -0
- package/templates/phaser-game/apps/target-ait/src/main.ts +4 -9
- package/templates/phaser-game/apps/target-ait/src/runtime-config.types.ts +12 -0
- package/templates/phaser-game/apps/target-ait/vite.config.ts +29 -7
- package/templates/phaser-game/package.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Gunshi CLI for mpgd-kit starter generation and target workflow orchestration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"@types/node": "^24.0.0",
|
|
53
53
|
"ttsc": "0.18.4",
|
|
54
54
|
"typescript": "7.0.2",
|
|
55
|
-
"@mpgd/adapter-
|
|
56
|
-
"@mpgd/adapter-
|
|
57
|
-
"@mpgd/adapter-devvit": "0.9.
|
|
58
|
-
"@mpgd/adapter-browser": "0.7.
|
|
59
|
-
"@mpgd/adapter-verse8": "0.3.
|
|
60
|
-
"@mpgd/analytics": "0.3.
|
|
55
|
+
"@mpgd/adapter-capacitor": "0.4.8",
|
|
56
|
+
"@mpgd/adapter-ait": "0.12.0",
|
|
57
|
+
"@mpgd/adapter-devvit": "0.9.5",
|
|
58
|
+
"@mpgd/adapter-browser": "0.7.2",
|
|
59
|
+
"@mpgd/adapter-verse8": "0.3.3",
|
|
60
|
+
"@mpgd/analytics": "0.3.11",
|
|
61
61
|
"@mpgd/bridge": "0.9.0",
|
|
62
|
-
"@mpgd/
|
|
63
|
-
"@mpgd/
|
|
64
|
-
"@mpgd/i18n": "0.5.6",
|
|
62
|
+
"@mpgd/catalog": "0.7.1",
|
|
63
|
+
"@mpgd/game-services": "0.13.1",
|
|
65
64
|
"@mpgd/phaser-assets": "0.4.1",
|
|
66
|
-
"@mpgd/
|
|
67
|
-
"@mpgd/
|
|
65
|
+
"@mpgd/platform": "0.11.0",
|
|
66
|
+
"@mpgd/target-config": "0.13.1",
|
|
67
|
+
"@mpgd/i18n": "0.5.7"
|
|
68
68
|
},
|
|
69
69
|
"main": "./dist/index.js",
|
|
70
70
|
"types": "./dist/index.d.ts",
|
|
@@ -277,13 +277,22 @@ and non-native flow checks:
|
|
|
277
277
|
```sh
|
|
278
278
|
pnpm ait:wrapper:dev
|
|
279
279
|
pnpm ait:wrapper:dev:plain
|
|
280
|
+
pnpm ait:wrapper:dev:sandbox
|
|
280
281
|
```
|
|
281
282
|
|
|
282
283
|
`ait:wrapper:dev` loads the last game bundle copied by `pnpm build:ait` from the
|
|
283
284
|
wrapper's `public/game` directory, so run `pnpm build:ait` again after game
|
|
284
285
|
changes before opening it. The local mock deliberately keeps ads, promotions,
|
|
285
|
-
and IAP unavailable
|
|
286
|
-
|
|
286
|
+
and IAP unavailable.
|
|
287
|
+
|
|
288
|
+
`ait:wrapper:dev:sandbox` disables every local bridge and identity mock so the
|
|
289
|
+
official Apps in Toss Sandbox host can inject its native SDK. Supply any
|
|
290
|
+
game-owned staging endpoints, product SKUs, and server-authority configuration
|
|
291
|
+
as environment variables before starting it. Use this route for native identity,
|
|
292
|
+
one-time IAP, and Game Center tests; it is not a normal browser preview. The
|
|
293
|
+
Sandbox does not support ads, so upload a staging `.ait` bundle and use the
|
|
294
|
+
console `intoss-private://` QR in the Toss app for test-ad and final integration
|
|
295
|
+
checks.
|
|
287
296
|
|
|
288
297
|
The starter includes `@ait-co/console-cli`, the Apps in Toss community console
|
|
289
298
|
CLI, as a dev dependency for project-local console automation:
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "MPGD_AIT_LOCAL_MOCK=1 VITE_MPGD_AIT_MOCK_IDENTITY=1 vite --host 0.0.0.0",
|
|
8
8
|
"dev:plain": "pnpm dev",
|
|
9
|
+
"dev:sandbox": "MPGD_AIT_LOCAL_MOCK=0 VITE_MPGD_AIT_MOCK_IDENTITY=0 vite --host 0.0.0.0",
|
|
9
10
|
"build": "vite build && ait build",
|
|
10
11
|
"ait:build": "ait build",
|
|
11
12
|
"ait:deploy": "ait deploy --api-key \"$AIT_API_KEY\"",
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import './styles.css';
|
|
2
2
|
|
|
3
|
-
import type { AitAdPlacementType } from '@mpgd/adapter-ait/ad-config';
|
|
4
3
|
import { installAitHostBridge, type InstallAitHostBridgeOptions } from '@mpgd/adapter-ait/host';
|
|
5
4
|
import { installAitSafeAreaCssVariables } from '@mpgd/adapter-ait/safe-area';
|
|
6
5
|
import { mountAitGameBundle } from '@mpgd/adapter-ait/wrapper';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
declare const __MPGD_AIT_AD_GROUP_IDS__: Readonly<Record<string, string>>;
|
|
10
|
-
declare const __MPGD_AIT_AD_PLACEMENT_TYPES__: Readonly<
|
|
11
|
-
Record<string, AitAdPlacementType>
|
|
12
|
-
>;
|
|
7
|
+
import runtimeConfig from 'virtual:mpgd-ait-runtime-config';
|
|
13
8
|
|
|
14
9
|
installAitSafeAreaCssVariables();
|
|
15
10
|
installAitHostBridge({
|
|
16
|
-
appName:
|
|
17
|
-
adGroupIds:
|
|
18
|
-
adPlacementTypes:
|
|
11
|
+
appName: runtimeConfig.appName,
|
|
12
|
+
adGroupIds: runtimeConfig.adGroupIds,
|
|
13
|
+
adPlacementTypes: runtimeConfig.adPlacementTypes,
|
|
19
14
|
...identityBridgeOptions(),
|
|
20
15
|
});
|
|
21
16
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module 'virtual:mpgd-ait-runtime-config' {
|
|
2
|
+
const runtimeConfig: Readonly<{
|
|
3
|
+
readonly appName: string;
|
|
4
|
+
readonly adGroupIds: Readonly<Record<string, string>>;
|
|
5
|
+
readonly adPlacementTypes: Readonly<Record<
|
|
6
|
+
string,
|
|
7
|
+
import('@mpgd/adapter-ait/ad-config').AitAdPlacementType
|
|
8
|
+
>>;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export default runtimeConfig;
|
|
12
|
+
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type AitAdBridgeConfig,
|
|
6
6
|
} from '@mpgd/adapter-ait/ad-config';
|
|
7
7
|
import ttsc from '@ttsc/unplugin/vite';
|
|
8
|
-
import { defineConfig } from 'vite';
|
|
8
|
+
import { defineConfig, type Plugin } from 'vite';
|
|
9
9
|
|
|
10
10
|
const aitAppName = process.env.MPGD_AIT_APP_NAME?.trim() || '__GAME_NAME__';
|
|
11
11
|
const aitAdConfig = readAitAdConfig(process.env.MPGD_AD_PLACEMENTS_FILE);
|
|
@@ -16,11 +16,6 @@ export default defineConfig(({ command, isPreview }) => {
|
|
|
16
16
|
&& process.env.MPGD_AIT_LOCAL_MOCK !== '0';
|
|
17
17
|
|
|
18
18
|
return {
|
|
19
|
-
define: {
|
|
20
|
-
__MPGD_AIT_APP_NAME__: JSON.stringify(aitAppName),
|
|
21
|
-
__MPGD_AIT_AD_GROUP_IDS__: JSON.stringify(aitAdConfig.adGroupIds),
|
|
22
|
-
__MPGD_AIT_AD_PLACEMENT_TYPES__: JSON.stringify(aitAdConfig.adPlacementTypes),
|
|
23
|
-
},
|
|
24
19
|
// Browser-only local development must not pretend that native rewards or
|
|
25
20
|
// purchases are available. Production and console builds use the real SDK.
|
|
26
21
|
...(enableLocalAitMock
|
|
@@ -33,7 +28,14 @@ export default defineConfig(({ command, isPreview }) => {
|
|
|
33
28
|
}
|
|
34
29
|
: {}),
|
|
35
30
|
plugins: [
|
|
36
|
-
|
|
31
|
+
createAitRuntimeConfigPlugin({
|
|
32
|
+
appName: aitAppName,
|
|
33
|
+
adGroupIds: aitAdConfig.adGroupIds,
|
|
34
|
+
adPlacementTypes: aitAdConfig.adPlacementTypes,
|
|
35
|
+
}),
|
|
36
|
+
...(command === 'build'
|
|
37
|
+
? [ttsc({ project: 'tsconfig.json', plugins: false })]
|
|
38
|
+
: []),
|
|
37
39
|
],
|
|
38
40
|
build: {
|
|
39
41
|
target: 'es2022',
|
|
@@ -43,6 +45,26 @@ export default defineConfig(({ command, isPreview }) => {
|
|
|
43
45
|
};
|
|
44
46
|
});
|
|
45
47
|
|
|
48
|
+
function createAitRuntimeConfigPlugin(input: Readonly<{
|
|
49
|
+
readonly appName: string;
|
|
50
|
+
readonly adGroupIds: Readonly<Record<string, string>>;
|
|
51
|
+
readonly adPlacementTypes: AitAdBridgeConfig['adPlacementTypes'];
|
|
52
|
+
}>): Plugin {
|
|
53
|
+
const publicId = 'virtual:mpgd-ait-runtime-config';
|
|
54
|
+
const resolvedId = `\0${publicId}`;
|
|
55
|
+
return {
|
|
56
|
+
name: 'mpgd-ait-runtime-config',
|
|
57
|
+
resolveId(id) {
|
|
58
|
+
return id === publicId ? resolvedId : null;
|
|
59
|
+
},
|
|
60
|
+
load(id) {
|
|
61
|
+
return id === resolvedId
|
|
62
|
+
? `export default Object.freeze(${JSON.stringify(input)});\n`
|
|
63
|
+
: null;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
46
68
|
function readAitAdConfig(path: string | undefined): AitAdBridgeConfig {
|
|
47
69
|
if (path === undefined || path.trim().length === 0) {
|
|
48
70
|
return { adGroupIds: {}, adPlacementTypes: {} };
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"smoke:ait": "pnpm exec mpgd target smoke ait --targets-file ./mpgd.targets.json --kit-path ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}",
|
|
20
20
|
"ait:wrapper:dev": "pnpm --dir apps/target-ait run dev",
|
|
21
21
|
"ait:wrapper:dev:plain": "pnpm --dir apps/target-ait run dev:plain",
|
|
22
|
+
"ait:wrapper:dev:sandbox": "pnpm --dir apps/target-ait run dev:sandbox",
|
|
22
23
|
"ait:console:login": "aitcc login",
|
|
23
24
|
"ait:console:whoami": "aitcc whoami",
|
|
24
25
|
"ait:console:init": "aitcc app init",
|