-
Notifications
You must be signed in to change notification settings - Fork 0
ios/androidのopenコマンド、buildコマンドを追加 #50
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
Conversation
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.
Pull request overview
This pull request adds --open and --build command options for iOS and Android platforms to the Next2D builder tool, enabling developers to open native IDEs (Xcode/Android Studio) and build native apps directly from the command line.
Key changes:
- Added
openNative()andbuildNative()functions to handle opening and building iOS/Android projects - Introduced
--openand--buildcommand-line flags for native platform operations - Updated recommended Node.js version from 18 to 22
- Bumped package version from 0.0.22 to 0.0.23 with dependency updates
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Added --open and --build flags, implemented openNative() and buildNative() functions, updated recommended Node version to 22, and added logic to handle new commands in multiBuild() |
| tsconfig.json | Removed baseUrl configuration option |
| package.json | Version bump to 0.0.23, updated dependencies (@types/node, vite) and devDependencies (eslint packages, globals), corrected bugs URL to point to builder repo |
| package-lock.json | Lockfile updates corresponding to package.json dependency changes |
| README.md | Updated supported platforms table to include iOS and Android with descriptions of opening IDEs and exporting apps |
| .github/workflows/publish.yml | Updated GitHub Actions to use v6 versions and removed node-version and registry-url configuration |
| .github/workflows/lint.yml | Updated GitHub Actions to use v6 versions of checkout and setup-node |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const openNative = async (): Promise<void> => | ||
| { | ||
| await generateNativeProject(); | ||
|
|
||
| /** | ||
| * Capacitorの書き出しに必要な設定を生成 | ||
| * Generate settings necessary for exporting Capacitor | ||
| */ | ||
| const config = JSON.parse( | ||
| fs.readFileSync(`${process.cwd()}/${CAPACITOR_CONFIG_NAME}`, { "encoding": "utf8" }) | ||
| ); | ||
|
|
||
| config.webDir = `${$outDir}/${platformDir}/${environment}/`; | ||
|
|
||
| fs.writeFileSync( | ||
| `${process.cwd()}/${CAPACITOR_CONFIG_NAME}`, | ||
| JSON.stringify(config, null, 2) | ||
| ); | ||
|
|
||
| const stream = cp.spawn("npx", [ | ||
| "cap", | ||
| "sync", | ||
| platform | ||
| ], { "stdio": "inherit" }); | ||
|
|
||
| stream.on("close", (code: number): void => | ||
| { | ||
| if (code !== 0) { | ||
| console.log(pc.red(`Failed to sync ${platform} project.`)); | ||
| return; | ||
| } | ||
|
|
||
| cp.spawn("npx", [ | ||
| "cap", | ||
| "open", | ||
| platform | ||
| ], { "stdio": "inherit" }); | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * @description iOS/Androidアプリのビルド関数 | ||
| * Build function for iOS/Android apps | ||
| * | ||
| * @return {Promise} | ||
| * @method | ||
| * @public | ||
| */ | ||
| const buildNative = async (): Promise<void> => | ||
| { | ||
| await generateNativeProject(); | ||
|
|
||
| /** | ||
| * Capacitorの書き出しに必要な設定を生成 | ||
| * Generate settings necessary for exporting Capacitor | ||
| */ | ||
| const config = JSON.parse( | ||
| fs.readFileSync(`${process.cwd()}/${CAPACITOR_CONFIG_NAME}`, { "encoding": "utf8" }) | ||
| ); | ||
|
|
||
| config.webDir = `${$outDir}/${platformDir}/${environment}/`; | ||
|
|
||
| fs.writeFileSync( | ||
| `${process.cwd()}/${CAPACITOR_CONFIG_NAME}`, | ||
| JSON.stringify(config, null, 2) | ||
| ); | ||
|
|
||
| const stream = cp.spawn("npx", [ | ||
| "cap", | ||
| "sync", | ||
| platform | ||
| ], { "stdio": "inherit" }); | ||
|
|
||
| stream.on("close", (code: number): void => | ||
| { | ||
| if (code !== 0) { | ||
| console.log(pc.red(`Failed to sync ${platform} project.`)); | ||
| return; | ||
| } | ||
|
|
||
| cp.spawn("npx", [ | ||
| "cap", | ||
| "build", | ||
| platform | ||
| ], { "stdio": "inherit" }); | ||
| }); | ||
| }; |
Copilot
AI
Nov 30, 2025
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.
There is significant code duplication between openNative, buildNative, and runNative functions. All three share the same logic for:
- Calling
generateNativeProject() - Reading and modifying the Capacitor config
- Running
cap sync
Consider extracting the common logic into a shared helper function to reduce duplication and improve maintainability.
| | Steam:Windows | Export an exe file | | ||
| | Steam:macOS | Export dmg, app file | | ||
| | Steam:Linux | Export deb file | | ||
| | web | Export minfy'd JS files | |
Copilot
AI
Nov 30, 2025
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.
The spelling of "minify'd" is incorrect. It should be "minified".
| | web | Export minfy'd JS files | | |
| | web | Export minified JS files | |
| | Steam:Linux | Export deb file | | ||
| | web | Export minfy'd JS files | | ||
| | iOS | open Xcode, and Export ipa | | ||
| | iOS | open Android Studio, and Export apk | |
Copilot
AI
Nov 30, 2025
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.
The table row for iOS and Android appears to be incorrect. Line 41 has "iOS" as the platform but describes "open Android Studio, and Export apk" which is for Android. This should be a separate row with "Android" as the platform name.
| | iOS | open Android Studio, and Export apk | | |
| | Android | open Android Studio, and Export apk | |
| case "open:ios": | ||
| await openNative(); | ||
| break; | ||
|
|
Copilot
AI
Nov 30, 2025
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.
The open:ios case appears to be unreachable or serves an unclear purpose. When platform is set to "ios" or "android", the code already handles the open flag within the switch statement at lines 599-615. This separate case for "open:ios" is inconsistent with the pattern and may indicate dead code or a design issue. Consider removing this case or clarifying its intended use.
| case "open:ios": | |
| await openNative(); | |
| break; |
| node-version: "22.x" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-node@v6 |
Copilot
AI
Nov 30, 2025
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.
The removal of node-version: "22.x" and registry-url: "https://registry.npmjs.org" parameters from actions/setup-node may cause issues with npm publishing. The registry-url parameter is typically required to set up authentication for publishing to npm. Without it, the NODE_AUTH_TOKEN may not be properly configured. Consider restoring these parameters.
| - uses: actions/setup-node@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22.x" | |
| registry-url: "https://registry.npmjs.org" |
No description provided.