diff --git a/.npmignore b/.npmignore index 638915e..179ccb3 100644 --- a/.npmignore +++ b/.npmignore @@ -3,4 +3,11 @@ .gitignore template/ios template/android -template/package.json \ No newline at end of file +template/xbox +template/dist +template/package.json +template/package-lock.json +template/src/Packages.js +template/src/Packages.ts +template/src/config/Config.js +template/src/config/Config.ts diff --git a/package.json b/package.json index 8e5e3b6..4109b24 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@next2d/framework-typescript-template", "description": "Next2D Framework default TypeScript template.", - "version": "4.0.1", + "version": "5.0.0", "homepage": "https://next2d.app", "bugs": "https://github.com/Next2D/framework-typescript-template/issues/new", "author": "Toshiyuki Ienaga", diff --git a/template.json b/template.json index e86a8f3..078825b 100644 --- a/template.json +++ b/template.json @@ -7,7 +7,12 @@ "@eslint/js": "*", "typescript": "*", "eslint": "*", - "eslint-plugin-unused-imports": "*" + "eslint-plugin-unused-imports": "*", + "globals": "*" + }, + "scripts": { + "lint": "eslint src", + "typecheck": "npx @next2d/vite-plugin-next2d-auto-loader && tsc --noEmit" } } -} \ No newline at end of file +} diff --git a/template/.gitignore b/template/.gitignore index 0618bf9..896d440 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -25,5 +25,6 @@ dist-ssr src/Packages.ts src/config/Config.ts -electron/resources -electron/package-lock.json \ No newline at end of file + +# Xbox: builder が生成する C++/CMake ホスト一式 (MicrosoftGame.config はルートで管理) +/xbox diff --git a/template/MicrosoftGame.config b/template/MicrosoftGame.config new file mode 100644 index 0000000..6afc28a --- /dev/null +++ b/template/MicrosoftGame.config @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + 00000000000000000000000000000000 + 00000000 + 0000000000000000 + + + + + + diff --git a/template/README.md b/template/README.md index fac6a0c..6ff76a9 100644 --- a/template/README.md +++ b/template/README.md @@ -26,7 +26,7 @@ This project was bootstrapped with [Create Next2D App](https://github.com/Next2D | ツール / Tool | バージョン / Version | |--------------|---------------------| -| Node.js | 22.x 以上 / 22.x or higher | +| Node.js | 22.12 以上 / 22.12 or higher | | npm | 10.x 以上 / 10.x or higher | ### オプション / Optional @@ -37,6 +37,7 @@ For iOS/Android builds, the following are also required: - **iOS**: Xcode 14 以上、macOS - **Android**: Android Studio、JDK 21 以上 +- **Xbox (試作 / prototype)**: Windows、Visual Studio 2022、Microsoft GDK、CMake 3.26 以上 --- @@ -154,11 +155,12 @@ You can specify the environment with the `--env` option (`dev`, `stg`, `prd`, et | コマンド / Command | プラットフォーム / Platform | |-------------------|---------------------------| -| `npm run preview:windows -- --env prd` | Windows | -| `npm run preview:macos -- --env prd` | macOS | -| `npm run preview:linux -- --env prd` | Linux | -| `npm run preview:ios -- --env prd` | iOS | -| `npm run preview:android -- --env prd` | Android | +| `npm run preview:web` | Web (HTML) | +| `npm run preview:windows` | Windows | +| `npm run preview:macos` | macOS | +| `npm run preview:linux` | Linux | +| `npm run preview:ios` | iOS | +| `npm run preview:android` | Android | --- @@ -193,12 +195,29 @@ You can specify the environment with the `--env` option. | コマンド / Command | プラットフォーム / Platform | 出力先 / Output | |-------------------|---------------------------|----------------| -| `npm run build:web -- --env prd` | Web (HTML) | `dist/web/prd/` | -| `npm run build:steam:windows -- --env prd` | Windows (Steam) | `dist/steam/windows/` | -| `npm run build:steam:macos -- --env prd` | macOS (Steam) | `dist/steam/macos/` | -| `npm run build:steam:linux -- --env prd` | Linux (Steam) | `dist/steam/linux/` | -| `npm run build:ios -- --env prd` | iOS | Xcode project | -| `npm run build:android -- --env prd` | Android | Android Studio project | +| `npm run build:web` | Web (HTML) | `dist/web/prd/` | +| `npm run build:steam:windows` | Windows (Steam) | `dist/steam/windows/build/prd/` | +| `npm run build:steam:macos` | macOS (Steam) | `dist/steam/macos/build/prd/` | +| `npm run build:steam:linux` | Linux (Steam) | `dist/steam/linux/build/prd/` | +| `npm run build:steam:manifest` | Steam 共有Depot / Shared depot | `dist/steam/shared/prd/` | +| `npm run build:ios` | iOS | `ios/` (Xcode) | +| `npm run build:android` | Android | `android/` (Android Studio) | +| `npm run build:xbox` | Xbox (試作 / prototype) | `xbox/` (GDK host) | + +各スクリプトの既定環境は `prd` です。別の環境は `npm run build:web -- --env dev` のように上書きします。 + +Each script defaults to the `prd` environment. Override it like `npm run build:web -- --env dev`. + +### Steam アップロード / Steam upload + +```bash +npm run upload:steam:dry-run # ローカル検証のみ / Local validation only +npm run upload:steam # 全OSの成果物をSteamPipeへアップロード / Upload all OS packages +``` + +`electron.config.json` の `steam.appId` / `steam.depots` と、環境変数 `STEAM_USERNAME`(任意で `STEAMCMD`)が必要です。 + +Requires `steam.appId` / `steam.depots` in `electron.config.json` and the `STEAM_USERNAME` (optionally `STEAMCMD`) environment variable. ### 環境設定 / Environment Configuration @@ -222,9 +241,16 @@ src/ │ ├── animation/ # アニメーション定義 / Animation definitions │ ├── component/ │ │ ├── atom/ # 最小コンポーネント / Smallest components -│ │ └── molecule/ # 複合コンポーネント / Composite components +│ │ ├── molecule/ # 複合コンポーネント / Composite components +│ │ ├── organism/ # Moleculeの組み合わせ / Combinations of molecules +│ │ ├── page/ # ページ / Pages +│ │ └── template/ # ページテンプレート / Page templates │ └── content/ # Animation Tool 生成 / Generated content └── view/ # View & ViewModel + +capacitor.config.json # iOS / Android 設定 / iOS / Android settings +electron.config.json # Electron / Steam 設定 / Electron / Steam settings +MicrosoftGame.config # Xbox (GDK) 設定 / Xbox (GDK) settings ``` 各ディレクトリの詳細は、ディレクトリ内の `README.md` を参照してください。 @@ -284,4 +310,84 @@ MIT License - [Next2D Player](https://github.com/Next2D/player) - レンダリングエンジン / Rendering engine - [Next2D Framework](https://github.com/Next2D/framework) - フレームワーク / Framework - [Create Next2D App](https://github.com/Next2D/create-next2d-app) - プロジェクト生成ツール / Project generator -- [Next2D Animation Tool](https://tool.next2d.app/) - アニメーション作成ツール / Animation creation tool \ No newline at end of file +- [Next2D Animation Tool](https://tool.next2d.app/) - アニメーション作成ツール / Animation creation tool + +## iOS / Android dependencies + +Capacitor's CLI, core and platform SDKs are managed by `@next2d/builder`. +The npm scripts invoke the builder through `npx`; neither the builder nor Capacitor +packages are added as game dependencies. Keep `capacitor.config.json`, native projects and +game-specific plugins in the game. Use `npm run open:ios` or +`npm run open:android` to sync and open the native project. +Both the template and generated apps use the published builder package through `npx`. + +## Electron / Steam configuration + +`electron.config.json` manages the app name, bundle ID, executable name, icons, +CPU architectures, window settings and Steam IDs. `create-next2d-app` initializes +`appId`, `appName`, `executableName` and `companyName` from the project name. +For example, `my-game` uses `app.example.my-game` and the app name `my-game`. +Replace the example bundle ID and company name before distribution. + +| Platform | Default architecture | Supported architectures | +|---|---|---| +| Windows | `x64` | `x64`, `arm64` | +| macOS | `universal` | `x64`, `arm64`, `universal` | +| Linux | `x64` | `x64`, `arm64` | + +32-bit Windows (`ia32`) is not supported. The `win32` in an output directory such +as `My Game-win32-x64` is Electron's Windows platform name; this is a **64-bit** build. +Use `architectures.windows` or a CLI override to select ARM64: + +```sh +npm run build:steam:windows # x64 by default +npm run build:steam:windows -- --arch arm64 # ARM64 override +``` + +Steam exports default to `prd`; append `-- --env dev` to override the environment. +macOS universal packages must be built on macOS. Preview uses the host OS and CPU. + +Platform icons are included as Next2D placeholders in `src/assets/icons/` and are +referenced by `electron.config.json`: `icon.ico` for Windows, `icon.icns` for macOS, +and `icon.png` for Linux. Replace these images for your game. Paths are relative +to the project root. Omitting an icon path uses the builder's bundled placeholder. + +`steam.appId` and `steam.depots` are `null` until you enter the IDs assigned in +Steamworks. Local packaging works without IDs. Multiple operating systems may use +the same Depot ID. The builder maps their packages to `windows/`, `macos/`, and +`linux/` in the shared depot, generating combined VDFs once every required OS's +package is available. Separate Depot IDs still produce separate upload scripts. + +When collecting exports from separate machines, keep each OS's `build//` +contents (including `steam-package.json`) in `dist/steam//build//`, then run: + +```sh +npm run build:steam:manifest +``` + +This generates shared depot manifests without rebuilding any application, on any +host OS. Shared VDFs and launch settings are in +`dist/steam/shared//depot-/`; preserve the entire `dist/steam/` tree when +moving them. Configure Steamworks launch options from `launch.json`, including the +OS-specific path prefixes for shared depots. The command fails if required packages +are missing or their metadata does not match the project. + +`macos.sign` and `macos.notarize` default to `false` for local testing. Enable both +for distribution and supply `APPLE_SIGNING_IDENTITY` / `APPLE_NOTARY_PROFILE` via +the environment. The builder never uploads or publishes to Steam automatically. + +Use a version of `@next2d/builder` that supports the generated host and shared depot +manifests. Only `electron.config.json` is needed for Electron configuration. The +builder owns the host and runtime version, generates a temporary host for each +export, then removes it. No `electron/` directory, Electron install, or Electron +lockfile is needed in the game. + +## Xbox configuration (prototype) + +`MicrosoftGame.config` holds the game-specific Microsoft GDK settings, in the same way +`capacitor.config.json` does for iOS / Android. Replace `TitleId`, `StoreId`, `MSAAppId` +and the store logo paths with the values issued by ID@Xbox / Partner Center. +`npm run build:xbox` generates the C++ / CMake host in `xbox/` (ignored by git) from the +builder's template and injects this file. On macOS / Linux only host generation and asset +packing run; building the executable requires Windows with Visual Studio 2022 and the GDK. +Xbox support in `@next2d/builder` is still a prototype. diff --git a/template/electron.config.json b/template/electron.config.json new file mode 100644 index 0000000..a8a43c0 --- /dev/null +++ b/template/electron.config.json @@ -0,0 +1,34 @@ +{ + "appId": "app.example.appId", + "appName": "Example-Product-Name", + "executableName": "example-product-name", + "companyName": "Example Company", + "icons": { + "windows": "src/assets/icons/icon.ico", + "macos": "src/assets/icons/icon.icns", + "linux": "src/assets/icons/icon.png" + }, + "architectures": { + "windows": "x64", + "macos": "universal", + "linux": "x64" + }, + "window": { + "width": 1280, + "height": 720, + "fullscreen": false + }, + "steam": { + "appId": null, + "branch": "internal", + "depots": { + "windows": null, + "macos": null, + "linux": null + } + }, + "macos": { + "sign": false, + "notarize": false + } +} diff --git a/template/electron/README.md b/template/electron/README.md deleted file mode 100644 index ff659ff..0000000 --- a/template/electron/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# Electron Configuration - -Windows、macOS、Linux向けのデスクトップアプリケーションビルドに使用するElectron設定ディレクトリです。 - -Directory for Electron configuration used to build desktop applications for Windows, macOS, and Linux. - -## ディレクトリ構造 / Directory Structure - -``` -electron/ -├── icons/ # アプリケーションアイコン -├── index.js # メインプロセス -└── package.json # 依存関係 -``` - -## ファイル説明 / File Description - -### index.js - -Electronのメインプロセスを定義します。ウィンドウの作成、アプリケーションのライフサイクル管理などを行います。 - -Defines the Electron main process. Handles window creation, application lifecycle management, etc. - -### package.json - -Electron用の依存関係と設定を管理します。 - -Manages Electron-specific dependencies and configuration. - -### icons/ - -各プラットフォーム向けのアプリケーションアイコンを格納します。詳細は [icons/README.md](./icons/README.md) を参照してください。 - -Contains application icons for each platform. See [icons/README.md](./icons/README.md) for details. - -## ビルドコマンド / Build Commands - -```bash -# Windows向けビルド / Build for Windows -npm run build:steam:windows -- --env prd - -# macOS向けビルド / Build for macOS -npm run build:steam:macos -- --env prd - -# Linux向けビルド / Build for Linux -npm run build:steam:linux -- --env prd -``` - -## エミュレーター / Emulator - -開発中にデスクトップアプリとしてプレビューできます。 - -Preview as a desktop application during development. - -```bash -# Windows / macOS / Linux エミュレーター -npm run preview:windows -- --env dev -npm run preview:macos -- --env dev -npm run preview:linux -- --env dev -``` - -## カスタマイズ / Customization - -### ウィンドウ設定 / Window Settings - -`index.js` でウィンドウのサイズや設定をカスタマイズできます。 - -Customize window size and settings in `index.js`. - -### アイコン変更 / Icon Change - -`icons/` ディレクトリ内の画像を置き換えてアプリケーションアイコンを変更します。 - -Replace images in the `icons/` directory to change application icons. - -## 関連ドキュメント / Related Documentation - -- [README.md](../README.md) - プロジェクト全体の説明 -- [icons/README.md](./icons/README.md) - アイコン設定 diff --git a/template/electron/icons/README.md b/template/electron/icons/README.md deleted file mode 100644 index 9080fdc..0000000 --- a/template/electron/icons/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# App Icons - -Windows、macOSのアプリケーションで利用するアイコン画像を格納してます。 -デフォルトはNext2Dのロゴを配置しているので、アプリケーションのイメージに合わせて上書きしてください。 - -Icon images used for Windows and macOS applications are stored. -The default is the Next2D logo, which can be overridden to match the image of the application. \ No newline at end of file diff --git a/template/electron/index.js b/template/electron/index.js deleted file mode 100644 index dfc53c9..0000000 --- a/template/electron/index.js +++ /dev/null @@ -1,55 +0,0 @@ -process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "1"; - -const { app, screen, BrowserWindow } = require("electron"); - -app.commandLine.appendSwitch("disable-http-cache"); - -const createWindow = () => -{ - const primaryDisplay = screen.getPrimaryDisplay(); - const { width, height } = primaryDisplay.workAreaSize; - - const browserWindow = new BrowserWindow({ - "width": width, - "height": height, - "titleBarStyle": "hidden", - "webPreferences": { - "nodeIntegration": false - } - }); - - /** - * Chrome Developer Tools - */ - // browserWindow.webContents.openDevTools(); - - browserWindow.loadFile("./resources/index.html"); -}; - -app - .whenReady() - .then(createWindow); - -app - .on("window-all-closed", () => - { - /** - * windowsならアプリを終了、macならdockに滞在 - * Exit apps if windows, stay in dock if mac - */ - if (process.platform !== "darwin") { - app.quit(); - } - }); - -app - .on("activate", () => - { - /** - * アプリで起動している画面がなければアプリを起動 - * If there is no screen running on the application, start the application. - */ - if (BrowserWindow.getAllWindows().length === 0) { - createWindow(); - } - }); \ No newline at end of file diff --git a/template/electron/package.json b/template/electron/package.json deleted file mode 100644 index bffc8fe..0000000 --- a/template/electron/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-product-name", - "version": "0.0.1", - "description": "Your Production Description", - "main": "index.js", - "config": { - "forge": { - "packagerConfig": { - "icon": "./electron/icons/icon.icns", - "asar": true - } - } - }, - "devDependencies": { - "electron": "*" - } -} diff --git a/template/package.json b/template/package.json index 03ac368..9f89e39 100644 --- a/template/package.json +++ b/template/package.json @@ -2,46 +2,49 @@ "name": "@next2d/framework-typescript-template", "version": "0.0.1", "description": "Next2D Framework TypeScript template.", + "private": true, "type": "module", "scripts": { "start": "vite --host", - "preview:ios": "npx @next2d/builder --platform ios --preview", - "preview:android": "npx @next2d/builder --platform android --preview", - "preview:macos": "npx @next2d/builder --platform macos --preview", - "preview:windows": "npx @next2d/builder --platform windows --preview", - "preview:linux": "npx @next2d/builder --platform linux --preview", - "open:ios": "npx @next2d/builder --platform ios --open", - "open:android": "npx @next2d/builder --platform android --open", - "build:steam:windows": "npx @next2d/builder --platform steam:windows", - "build:steam:macos": "npx @next2d/builder --platform steam:macos", - "build:steam:linux": "npx @next2d/builder --platform steam:linux", - "build:web": "npx @next2d/builder --platform web", - "build:ios": "npx @next2d/builder --platform ios --build", - "build:android": "npx @next2d/builder --platform android --build", - "build": "npx @next2d/builder", + "preview:web": "npx @next2d/builder --platform web --env prd --preview", + "preview:ios": "npx @next2d/builder --platform ios --env prd --preview", + "preview:android": "npx @next2d/builder --platform android --env prd --preview", + "preview:macos": "npx @next2d/builder --platform macos --env prd --preview", + "preview:windows": "npx @next2d/builder --platform windows --env prd --preview", + "preview:linux": "npx @next2d/builder --platform linux --env prd --preview", + "open:ios": "npx @next2d/builder --platform ios --env prd --open", + "open:android": "npx @next2d/builder --platform android --env prd --open", + "open:xbox": "npx @next2d/builder --platform xbox --env prd --open", + "build:web": "npx @next2d/builder --platform web --env prd", + "build:ios": "npx @next2d/builder --platform ios --env prd --build", + "build:android": "npx @next2d/builder --platform android --env prd --build", + "build:xbox": "npx @next2d/builder --platform xbox --env prd", + "build:steam:windows": "npx @next2d/builder --platform steam:windows --env prd", + "build:steam:macos": "npx @next2d/builder --platform steam:macos --env prd", + "build:steam:linux": "npx @next2d/builder --platform steam:linux --env prd", + "build:steam:manifest": "npx @next2d/builder --platform steam:macos --env prd --steam-manifest", + "upload:steam": "npx @next2d/builder --steam-upload --env prd", + "upload:steam:dry-run": "npx @next2d/builder --steam-upload --env prd --dry-run", + "lint": "eslint src", + "typecheck": "npx @next2d/vite-plugin-next2d-auto-loader && tsc --noEmit", "test": "npx vitest", "generate": "npx @next2d/view-generator" }, "devDependencies": { - "@capacitor/android": "^8.1.0", - "@capacitor/cli": "^8.1.0", - "@capacitor/core": "^8.1.0", - "@capacitor/ios": "^8.1.0", - "@eslint/eslintrc": "^3.3.4", + "@eslint/eslintrc": "^3.3.7", "@eslint/js": "^10.0.1", - "@next2d/vite-plugin-next2d-auto-loader": "^3.1.13", - "@types/node": "^25.3.3", - "@typescript-eslint/eslint-plugin": "^8.56.1", - "@typescript-eslint/parser": "^8.56.1", - "@vitest/web-worker": "^4.0.18", - "eslint": "^10.0.2", + "@next2d/vite-plugin-next2d-auto-loader": "^3.1.21", + "@types/node": "^26.6.6", + "@typescript-eslint/eslint-plugin": "^8.72.1", + "@typescript-eslint/parser": "^8.72.1", + "@vitest/web-worker": "^5.0.5", + "eslint": "^10.14.0", "eslint-plugin-unused-imports": "^4.4.1", - "globals": "^17.4.0", - "jsdom": "^28.1.0", - "typescript": "^5.9.3", - "vite": "^7.3.1", - "vite-tsconfig-paths": "^6.1.1", - "vitest": "^4.0.18", + "globals": "^17.14.0", + "jsdom": "^30.1.3", + "typescript": "^6.0.3", + "vite": "^8.3.5", + "vitest": "^5.0.5", "vitest-webgl-canvas-mock": "^1.1.0" }, "peerDependencies": { @@ -60,6 +63,7 @@ "@next2d/text": "file:../../player/packages/text", "@next2d/texture-packer": "file:../../player/packages/texture-packer", "@next2d/ui": "file:../../player/packages/ui", - "@next2d/webgl": "file:../../player/packages/webgl" + "@next2d/webgl": "file:../../player/packages/webgl", + "@next2d/webgpu": "file:../../player/packages/webgpu" } } diff --git a/template/specs/commands.md b/template/specs/commands.md index 33934e6..0435d0b 100644 --- a/template/specs/commands.md +++ b/template/specs/commands.md @@ -13,6 +13,13 @@ npm start # 開発サーバー起動 (http://localhost:5173) npm run generate # routing.jsonからView/ViewModelクラスを自動生成 ``` +## Lint / Type Check + +```bash +npm run lint # ESLint +npm run typecheck # Packages.ts / Config.ts を生成してから tsc --noEmit +``` + ## Testing ```bash @@ -25,21 +32,37 @@ npm test -- --coverage # カバレッジレポート | Command | Platform | Output | |---------|----------|--------| -| `npm run build:web -- --env prd` | Web (HTML) | `dist/web/prd/` | -| `npm run build:steam:windows -- --env prd` | Windows (Steam) | `dist/steam/windows/` | -| `npm run build:steam:macos -- --env prd` | macOS (Steam) | `dist/steam/macos/` | -| `npm run build:steam:linux -- --env prd` | Linux (Steam) | `dist/steam/linux/` | -| `npm run build:ios -- --env prd` | iOS | Xcode project | -| `npm run build:android -- --env prd` | Android | Android Studio project | +| `npm run build:web` | Web (HTML) | `dist/web/prd/` | +| `npm run build:steam:windows` | Windows (Steam) | `dist/steam/windows/build/prd/` | +| `npm run build:steam:macos` | macOS (Steam) | `dist/steam/macos/build/prd/` | +| `npm run build:steam:linux` | Linux (Steam) | `dist/steam/linux/build/prd/` | +| `npm run build:steam:manifest` | Steam共有Depot | `dist/steam/shared/prd/` | +| `npm run open:ios` | iOS | 同期してXcodeで開く | +| `npm run open:android` | Android | 同期してAndroid Studioで開く | +| `npm run build:ios` | iOS | 同期・ビルド(Xcodeと署名設定が必要) | +| `npm run build:android` | Android | 同期・ビルド(SDK/JDKと署名設定が必要) | +| `npm run build:xbox` | Xbox(試作) | `xbox/` にGDKホストを生成・ビルド | +| `npm run open:xbox` | Xbox(試作) | CMake構成後にVisual Studioで開く(Windowsのみ) | + +全スクリプトの既定環境は `prd`。`npm run build:web -- --env dev` のように `--env` で上書きする。 + +## iOS / Androidの依存管理 + +`@capacitor/cli`・`@capacitor/core`・`@capacitor/ios`・`@capacitor/android` はbuilderが管理する。 +builderはnpmスクリプトから `npx` で起動し、builder・Capacitorともゲームの直接依存には追加しない。 +ゲーム側は `capacitor.config.json`、既存のネイティブプロジェクト、ゲーム固有のプラグインを管理する。 +builderは `webDir` を更新してからプロジェクトを生成・同期し、既存のネイティブ設定を維持する。 +ゲームのコードから `@capacitor/core` を直接importする場合だけ、互換バージョンの直接依存も宣言する。 ## Platform Emulators ```bash -npm run preview:windows -- --env prd # Windows -npm run preview:macos -- --env prd # macOS -npm run preview:linux -- --env prd # Linux -npm run preview:ios -- --env prd # iOS -npm run preview:android -- --env prd # Android +npm run preview:web # Web +npm run preview:windows # Windows +npm run preview:macos # macOS +npm run preview:linux # Linux +npm run preview:ios # iOS +npm run preview:android # Android ``` `--env` オプション: `local`, `dev`, `stg`, `prd` @@ -47,3 +70,33 @@ npm run preview:android -- --env prd # Android ## Environment Configuration 環境ごとの設定は`src/config/config.json`で管理。`--env`で指定した環境名の設定値と`all`の設定値がマージされる。 + +## Electron / Steam + +- Electron設定はルートの `electron.config.json` に集約。ホストとElectronバージョンはbuilderが管理し、`electron/` は不要。 +- Windowsは `x64` が既定、`arm64` も対応。32bit (`ia32`) は非対応。出力名の `win32-x64` は64bit版Windowsを意味する。 +- macOSは `universal`、Linuxは `x64` が既定。CPU設定はJSONまたは `--arch` で指定する。 +- アイコンは `src/assets/icons/icon.ico` / `icon.icns` / `icon.png` を参照。仮のNext2D画像を製品用に置き換える。 +- App ID・Depot IDは未発行なら `null`。複数OSで同一Depot IDを指定可能。 +- 共有Depotは全対象OSの成果物が揃うと `dist/steam/shared//depot-/` に統合VDFを生成する。 +- 別マシンの成果物を集めた場合は `npm run build:steam:manifest` で再ビルドせず統合する。共有Depotへの配置先はOS別サブフォルダ。 + +```sh +npm run build:steam:windows -- --arch arm64 +npm run build:steam:manifest -- --env prd +``` + +### Steamアップロード + +```sh +npm run upload:steam:dry-run # ローカル検証のみ +npm run upload:steam # 全OSの成果物を1回でアップロード(STEAM_USERNAME、任意でSTEAMCMDが必要) +``` + +反映先ブランチは `electron.config.json` の `steam.branch`(既定 `internal`)。`--steam-branch` で上書きできる。 + +## Xbox(試作) + +- GDK設定はルートの `MicrosoftGame.config` で管理する。`TitleId`・`StoreId`・`MSAAppId`・ストアロゴをPartner Centerの値に置き換える。 +- `npm run build:xbox` でbuilder同梱テンプレートから `xbox/`(C++/CMakeホスト、git管理外)を生成し、設定を注入する。 +- 実行ファイルのビルドはWindows + Visual Studio 2022 + Microsoft GDK + CMake 3.26以上が必要。macOS / Linuxはホスト生成とアセット準備まで。 diff --git a/template/specs/config.md b/template/specs/config.md index 72b4e5a..f6efae3 100644 --- a/template/specs/config.md +++ b/template/specs/config.md @@ -21,6 +21,11 @@ | `options.tagId` | string | null | 描画先のエレメントID | | `options.bgColor` | string | "transparent" | 背景色 (16進数) | +> [!WARNING] +> `stage.json` で設定できるのは上記の `width`・`height`・`fps`・`options` の**み**です。 +> **Next2D Player は Flash Player の派生ではありません。** `scaleMode`・`align`・`quality`・`wmode` 等の Flash 由来オプションは存在せず、記述してもフレームワークが一切処理しません。 +> 画面いっぱいに合わせたい場合は `options.fullScreen: true` を使ってください。上記にないキーは設定ミスとして削除してください。 + ### Example ```json diff --git a/template/specs/overview.md b/template/specs/overview.md index aa80d80..ab52789 100644 --- a/template/specs/overview.md +++ b/template/specs/overview.md @@ -13,7 +13,7 @@ Next2D Frameworkを使用したTypeScriptプロジェクトテンプレート。 ## Requirements -- Node.js 22.x以上 +- Node.js 22.12以上 - npm 10.x以上 - iOS: Xcode 14以上 (iOS/Androidビルド時のみ) - Android: Android Studio, JDK 21以上 (iOS/Androidビルド時のみ) @@ -78,7 +78,9 @@ src/ └── assets/ # 静的ファイル (画像, JSON) @types/ # グローバル型定義 (.d.ts) -electron/ # Electron設定 (デスクトップビルド用) +capacitor.config.json # iOS / Android設定 (Capacitor SDKはbuilderが管理) +electron.config.json # Electron / Steam設定 (ホストはbuilderが生成) +MicrosoftGame.config # Xbox (GDK) 設定 (xbox/ ホストはbuilderが生成) file/ # Animation Tool n2dファイル mock/ # 開発用モックデータ (API, Content, 画像) ``` diff --git a/template/electron/icons/icon.icns b/template/src/assets/icons/icon.icns similarity index 100% rename from template/electron/icons/icon.icns rename to template/src/assets/icons/icon.icns diff --git a/template/src/assets/icons/icon.ico b/template/src/assets/icons/icon.ico new file mode 100644 index 0000000..3d07c9d Binary files /dev/null and b/template/src/assets/icons/icon.ico differ diff --git a/template/electron/icons/icon.png b/template/src/assets/icons/icon.png similarity index 100% rename from template/electron/icons/icon.png rename to template/src/assets/icons/icon.png diff --git a/template/vite.config.ts b/template/vite.config.ts index 3e41b2b..073753d 100644 --- a/template/vite.config.ts +++ b/template/vite.config.ts @@ -9,10 +9,11 @@ export default defineConfig({ "build": { "outDir": "dist", "target": "esnext", + "chunkSizeWarningLimit": 1024, "modulePreload": { "polyfill": false }, - "rollupOptions": { + "rolldownOptions": { "output": { "entryFileNames": "assets/js/app.js" } @@ -37,12 +38,18 @@ export default defineConfig({ }, "resolve": { "alias": { - "@": path.resolve(__dirname, "src") + "@": path.resolve(import.meta.dirname, "src") } }, "test": { "globals": true, "environment": "jsdom", + "server": { + "deps": { + // 公開版の @next2d/* は拡張子なしの ESM import を含むため Vite で変換する + "inline": [/\/node_modules\/@next2d\//] + } + }, "setupFiles": [ "@vitest/web-worker", "vitest-webgl-canvas-mock"