launch-unity 0.10.0 → 0.11.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/README.ja.md CHANGED
@@ -18,29 +18,30 @@ npx launch-unity
18
18
  ## 使い方
19
19
  ```bash
20
20
  # 構文
21
- launch-unity [OPTIONS] [PROJECT_PATH] [PLATFORM] [-- UNITY_ARGS...]
21
+ launch-unity [OPTIONS] [PROJECT_PATH] [-- UNITY_ARGS...]
22
22
  launch-unity update
23
23
 
24
24
  # 引数
25
25
  # PROJECT_PATH Unityプロジェクトのディレクトリ(省略時は3階層下まで探索)
26
- # PLATFORM Unityの -buildTarget に渡す値(例: StandaloneOSX, Android, iOS)
27
26
 
28
27
  # オプション
29
- # -h, --help ヘルプを表示
30
- # -r, --restart Unityを再起動
28
+ # -h, --help ヘルプを表示
29
+ # -r, --restart Unityを再起動
30
+ # -p, --platform <P> Unityの -buildTarget に渡す値(例: StandaloneOSX, Android, iOS)
31
31
  # -a, -u, --add-unity-hub, --unity-hub-entry
32
- # Unity Hub に登録(Unityは起動しない)
33
- # -f, --favorite Unity Hub にお気に入りとして登録(Unityは起動しない)
32
+ # Unity Hub に登録(Unityは起動しない)
33
+ # -f, --favorite Unity Hub にお気に入りとして登録(Unityは起動しない)
34
34
 
35
35
  # 例
36
- npx launch-unity # プロジェクトを探索して開く
37
- npx launch-unity /path/to/Proj # 指定プロジェクトを開く
38
- npx launch-unity /path Android # ビルドターゲットを指定
39
- npx launch-unity -r # Unityを再起動
40
- npx launch-unity -a # Unity Hub に登録のみ(Unityは起動しない)
41
- npx launch-unity -f # Unity Hub にお気に入り登録(Unityは起動しない)
36
+ npx launch-unity # プロジェクトを探索して開く
37
+ npx launch-unity /path/to/Proj # 指定プロジェクトを開く
38
+ npx launch-unity -p Android # ビルドターゲットを指定
39
+ npx launch-unity /path -p Android # パスとビルドターゲットを指定
40
+ npx launch-unity -r # Unityを再起動
41
+ npx launch-unity -a # Unity Hub に登録のみ(Unityは起動しない)
42
+ npx launch-unity -f # Unity Hub にお気に入り登録(Unityは起動しない)
42
43
  npx launch-unity . -- -batchmode -quit -nographics -logFile - # Unity引数を渡す
43
- npx launch-unity /path Android -- -executeMethod My.Build.Entry
44
+ npx launch-unity /path -p Android -- -executeMethod My.Build.Entry
44
45
 
45
46
  # 自己更新(npmグローバルインストール向け)
46
47
  launch-unity update
package/README.md CHANGED
@@ -18,29 +18,30 @@ npx launch-unity
18
18
  ## Usage
19
19
  ```bash
20
20
  # Syntax
21
- launch-unity [OPTIONS] [PROJECT_PATH] [PLATFORM] [-- UNITY_ARGS...]
21
+ launch-unity [OPTIONS] [PROJECT_PATH] [-- UNITY_ARGS...]
22
22
  launch-unity update
23
23
 
24
24
  # Arguments
25
- # PROJECT_PATH Unity project directory (searches up to 3 levels deep if omitted)
26
- # PLATFORM Passed to Unity as -buildTarget (e.g., StandaloneOSX, Android, iOS)
25
+ # PROJECT_PATH Unity project directory (searches up to 3 levels deep if omitted)
27
26
 
28
27
  # Options
29
- # -h, --help Show help
30
- # -r, --restart Kill running Unity and restart
28
+ # -h, --help Show help
29
+ # -r, --restart Kill running Unity and restart
30
+ # -p, --platform <P> Passed to Unity as -buildTarget (e.g., StandaloneOSX, Android, iOS)
31
31
  # -a, -u, --add-unity-hub, --unity-hub-entry
32
- # Register to Unity Hub (does not launch Unity)
33
- # -f, --favorite Register to Unity Hub as favorite (does not launch Unity)
32
+ # Register to Unity Hub (does not launch Unity)
33
+ # -f, --favorite Register to Unity Hub as favorite (does not launch Unity)
34
34
 
35
35
  # Examples
36
- npx launch-unity # Search for project and open
37
- npx launch-unity /path/to/Proj # Open specific project
38
- npx launch-unity /path Android # Specify build target
39
- npx launch-unity -r # Restart Unity
40
- npx launch-unity -a # Register to Unity Hub only (does not launch Unity)
41
- npx launch-unity -f # Register as favorite (does not launch Unity)
36
+ npx launch-unity # Search for project and open
37
+ npx launch-unity /path/to/Proj # Open specific project
38
+ npx launch-unity -p Android # Specify build target
39
+ npx launch-unity /path -p Android # Specify path and build target
40
+ npx launch-unity -r # Restart Unity
41
+ npx launch-unity -a # Register to Unity Hub only (does not launch Unity)
42
+ npx launch-unity -f # Register as favorite (does not launch Unity)
42
43
  npx launch-unity . -- -batchmode -quit -nographics -logFile - # Pass Unity args
43
- npx launch-unity /path Android -- -executeMethod My.Build.Entry
44
+ npx launch-unity /path -p Android -- -executeMethod My.Build.Entry
44
45
 
45
46
  # Self update (for npm global install)
46
47
  launch-unity update
package/dist/launch.js CHANGED
@@ -146,6 +146,7 @@ function parseArgs(argv) {
146
146
  let restart = false;
147
147
  let addUnityHub = false;
148
148
  let favoriteUnityHub = false;
149
+ let platform;
149
150
  for (let i = 0; i < cliArgs.length; i++) {
150
151
  const arg = cliArgs[i] ?? "";
151
152
  if (arg === "--help" || arg === "-h") {
@@ -171,6 +172,21 @@ function parseArgs(argv) {
171
172
  favoriteUnityHub = true;
172
173
  continue;
173
174
  }
175
+ if (arg === "-p" || arg === "--platform") {
176
+ const next = cliArgs[i + 1];
177
+ if (typeof next === "string" && !next.startsWith("-")) {
178
+ platform = next;
179
+ i += 1;
180
+ }
181
+ continue;
182
+ }
183
+ if (arg.startsWith("--platform=")) {
184
+ const value = arg.slice("--platform=".length);
185
+ if (value.length > 0) {
186
+ platform = value;
187
+ }
188
+ continue;
189
+ }
174
190
  if (arg.startsWith("--max-depth")) {
175
191
  const parts = arg.split("=");
176
192
  if (parts.length === 2) {
@@ -192,32 +208,19 @@ function parseArgs(argv) {
192
208
  continue;
193
209
  }
194
210
  if (arg.startsWith("-")) {
211
+ console.warn(`Warning: Unknown option ignored: ${arg}`);
195
212
  continue;
196
213
  }
197
214
  positionals.push(arg);
198
215
  }
199
216
  let projectPath;
200
- let platform;
201
- if (positionals.length === 0) {
202
- projectPath = undefined; // trigger search
203
- platform = undefined;
204
- }
205
- else if (positionals.length === 1) {
206
- const first = positionals[0] ?? "";
207
- const resolvedFirst = resolve(first);
208
- if (existsSync(resolvedFirst)) {
209
- projectPath = resolvedFirst;
210
- platform = undefined;
211
- }
212
- else {
213
- // Treat as platform when path does not exist
214
- projectPath = undefined; // trigger search
215
- platform = String(first);
216
- }
217
- }
218
- else {
217
+ if (positionals.length > 0) {
219
218
  projectPath = resolve(positionals[0] ?? "");
220
- platform = String(positionals[1] ?? "");
219
+ }
220
+ if (positionals.length > 1) {
221
+ const ignored = positionals.slice(1).join(", ");
222
+ console.warn(`Warning: Extra arguments ignored: ${ignored}`);
223
+ console.warn(" Use -p option for platform: launch-unity -p <platform>");
221
224
  }
222
225
  const options = {
223
226
  unityArgs,
@@ -247,23 +250,23 @@ function getVersion() {
247
250
  function printHelp() {
248
251
  const help = `
249
252
  Usage:
250
- launch-unity [PROJECT_PATH] [PLATFORM] -- [UNITY_ARGS...]
253
+ launch-unity [OPTIONS] [PROJECT_PATH] [-- UNITY_ARGS...]
251
254
  launch-unity update
252
255
 
253
256
  Open a Unity project with the matching Unity Editor version installed by Unity Hub.
254
257
 
255
258
  Arguments:
256
259
  PROJECT_PATH Optional. If omitted, searches under the current directory (see --max-depth)
257
- PLATFORM Optional. Passed to Unity as -buildTarget (e.g., StandaloneOSX, Android, iOS)
258
260
 
259
261
  Forwarding:
260
262
  Everything after -- is forwarded to Unity unchanged.
261
- If UNITY_ARGS includes -buildTarget, the PLATFORM argument is ignored.
263
+ If UNITY_ARGS includes -buildTarget, the -p option is ignored.
262
264
 
263
- Flags:
265
+ Options:
264
266
  -h, --help Show this help message
265
267
  -v, --version Show version number
266
268
  -r, --restart Kill running Unity and restart
269
+ -p, --platform <P> Passed to Unity as -buildTarget (e.g., StandaloneOSX, Android, iOS)
267
270
  --max-depth <N> Search depth when PROJECT_PATH is omitted (default 3, -1 unlimited)
268
271
  -u, -a, --unity-hub-entry, --add-unity-hub
269
272
  Add to Unity Hub if missing and update lastModified (does not launch Unity)
@@ -621,12 +624,7 @@ const EXCLUDED_DIR_NAMES = new Set([
621
624
  ]);
622
625
  function isUnityProjectRoot(candidateDir) {
623
626
  const versionFile = join(candidateDir, "ProjectSettings", "ProjectVersion.txt");
624
- const hasVersion = existsSync(versionFile);
625
- if (!hasVersion) {
626
- return false;
627
- }
628
- const libraryDir = join(candidateDir, "Library");
629
- return existsSync(libraryDir);
627
+ return existsSync(versionFile);
630
628
  }
631
629
  function listSubdirectoriesSorted(dir) {
632
630
  let entries = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "launch-unity",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Open a Unity project with the matching Editor version (macOS/Windows)",
5
5
  "type": "module",
6
6
  "main": "dist/launch.js",
@@ -38,16 +38,16 @@
38
38
  "node": ">=18"
39
39
  },
40
40
  "devDependencies": {
41
- "@types/node": "24.10.1",
42
- "@typescript-eslint/eslint-plugin": "8.48.1",
43
- "@typescript-eslint/parser": "8.48.1",
44
- "eslint": "9.39.1",
41
+ "@types/node": "25.0.6",
42
+ "@typescript-eslint/eslint-plugin": "8.53.0",
43
+ "@typescript-eslint/parser": "8.53.0",
44
+ "eslint": "9.39.2",
45
45
  "eslint-config-prettier": "10.1.8",
46
46
  "prettier": "3.7.4",
47
47
  "typescript": "5.9.3"
48
48
  },
49
49
  "dependencies": {
50
- "typescript-eslint": "8.48.1"
50
+ "typescript-eslint": "8.53.0"
51
51
  },
52
52
  "overrides": {
53
53
  "js-yaml": "4.1.1"