Skip to content

Conversation

@ienaga
Copy link
Member

@ienaga ienaga commented Nov 30, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 30, 2025 23:40
Copy link

Copilot AI left a 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() and buildNative() functions to handle opening and building iOS/Android projects
  • Introduced --open and --build command-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.

Comment on lines +488 to +574
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" });
});
};
Copy link

Copilot AI Nov 30, 2025

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:

  1. Calling generateNativeProject()
  2. Reading and modifying the Capacitor config
  3. Running cap sync

Consider extracting the common logic into a shared helper function to reduce duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
| Steam:Windows | Export an exe file |
| Steam:macOS | Export dmg, app file |
| Steam:Linux | Export deb file |
| web | Export minfy'd JS files |
Copy link

Copilot AI Nov 30, 2025

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".

Suggested change
| web | Export minfy'd JS files |
| web | Export minified JS files |

Copilot uses AI. Check for mistakes.
| Steam:Linux | Export deb file |
| web | Export minfy'd JS files |
| iOS | open Xcode, and Export ipa |
| iOS | open Android Studio, and Export apk |
Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
| iOS | open Android Studio, and Export apk |
| Android | open Android Studio, and Export apk |

Copilot uses AI. Check for mistakes.
Comment on lines +618 to +621
case "open:ios":
await openNative();
break;

Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
case "open:ios":
await openNative();
break;

Copilot uses AI. Check for mistakes.
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
- uses: actions/setup-node@v6
- uses: actions/setup-node@v6
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"

Copilot uses AI. Check for mistakes.
@ienaga ienaga merged commit fba176f into main Nov 30, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants