@next2d/builder 0.0.10 → 0.0.11

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.
Files changed (3) hide show
  1. package/README.md +33 -10
  2. package/dist/index.js +48 -43
  3. package/package.json +13 -9
package/README.md CHANGED
@@ -7,21 +7,44 @@ Multi-platform Builder
7
7
  [![license](https://img.shields.io/github/license/Next2D/builder)](https://github.com/Next2D/builder/blob/main/LICENSE)
8
8
 
9
9
  [日本語]\
10
- Next2D Frameworkのマルチプラットフォームビルダー、Steam用のWindows、macOS、Linux、スマートフォン(iOS、Android)、Web(HTML)など、各種プラットフォームへの書き出しに対応
10
+ 1つのプロジェクトから多種多様なプラットフォーム向けのアプリケーションを作成するマルチプラットフォームビルダー。
11
+
12
+ * Steam:Steamに対応したWindows版、macOS版、Linux版のアプリケーションの書き出しが可能。
13
+ * デスクトップ:デスクトップ環境向けに、Windows、macOS、Linux向けのアプリケーションを出力できます。
14
+ * スマートフォン:iOSおよびAndroidに対応したスマートフォン用アプリケーションとしての書き出しもサポート。
15
+ * Web(HTML):ブラウザ上で動作するHTML形式のコンテンツも簡単に生成可能。
16
+
17
+ Next2D Frameworkを使えば、1つのソースコードから多様なデバイスやOSに最適化されたアプリケーションを効率的に開発・展開することができます。
11
18
 
12
19
  [English]\
13
- Multi-platform builder for Next2D Framework, export to various platforms including Windows, macOS, Linux, Smartphones (iOS, Android) and Web (HTML) for Steam
20
+ Multi-platform builder to create applications for a wide variety of platforms from a single project.
21
+
22
+ * Steam: Allows export of applications for Windows, macOS, and Linux versions that are compatible with Steam.
23
+ * Desktop: Export of applications for Windows, macOS, and Linux for desktop environments is supported.
24
+ * Smartphone: Export as smartphone applications compatible with iOS and Android is also supported.
25
+ * Web (HTML): Easily generate HTML-format content that runs in a browser.
26
+
27
+ With Next2D Framework, you can efficiently develop and deploy applications optimized for diverse devices and operating systems from a single source code.
14
28
 
15
29
  ## Supported
16
30
 
17
- | platform | detail |
18
- |----------|--------------------------|
19
- | Windows | Export an exe file |
20
- | macOS | Export dmg, app file |
21
- | Linux | Export deb file |
22
- | iOS | Implementing... |
23
- | Android | Implementing... |
24
- | web | Export minfy'd JS files |
31
+ | platform | detail |
32
+ |-----------------|--------------------------|
33
+ | Windows | Export an exe file |
34
+ | macOS | Export dmg, app file |
35
+ | Linux | Export deb file |
36
+ | Steam:Windows | Export an exe file |
37
+ | Steam:macOS | Export dmg, app file |
38
+ | Steam:Linux | Export deb file |
39
+ | web | Export minfy'd JS files |
40
+
41
+ ### Scheduled introduction
42
+
43
+ | platform |
44
+ |-----------------|
45
+ | iOS |
46
+ | Android |
47
+ | Nintendo Switch |
25
48
 
26
49
  ### build example.
27
50
 
package/dist/index.js CHANGED
@@ -117,32 +117,27 @@ const CAPACITOR_CONFIG_NAME = "capacitor.config.json";
117
117
  * @method
118
118
  * @public
119
119
  */
120
- const loadConfig = () => {
121
- return new Promise((resolve) => {
122
- const packageJson = JSON.parse(fs.readFileSync(`${process.cwd()}/package.json`, { "encoding": "utf8" }));
123
- if (packageJson.type !== "module") {
124
- packageJson.type = "module";
125
- // overwride
126
- fs.writeFileSync(`${process.cwd()}/package.json`, JSON.stringify(packageJson, null, 2));
127
- }
128
- const ext = fs.existsSync(`${process.cwd()}/vite.config.ts`) ? "ts" : "js";
129
- loadConfigFromFile({
130
- "command": "build",
131
- "mode": "build"
132
- }, `${process.cwd()}/vite.config.${ext}`)
133
- .then((config) => {
134
- // update config
135
- $configObject = config;
136
- $outDir = $configObject.config?.build?.outDir || "dist";
137
- $buildDir = `${process.cwd()}/${$outDir}/${platformDir}/${environment}`;
138
- if (!fs.existsSync(`${$buildDir}`)) {
139
- fs.mkdirSync(`${$buildDir}`, { "recursive": true });
140
- console.log(pc.green(`Create build directory: ${$buildDir}`));
141
- console.log();
142
- }
143
- resolve();
144
- });
145
- });
120
+ const loadConfig = async () => {
121
+ const packageJson = JSON.parse(fs.readFileSync(`${process.cwd()}/package.json`, { "encoding": "utf8" }));
122
+ if (packageJson.type !== "module") {
123
+ packageJson.type = "module";
124
+ // overwride
125
+ fs.writeFileSync(`${process.cwd()}/package.json`, JSON.stringify(packageJson, null, 2));
126
+ }
127
+ const ext = fs.existsSync(`${process.cwd()}/vite.config.ts`) ? "ts" : "js";
128
+ const config = await loadConfigFromFile({
129
+ "command": "build",
130
+ "mode": "build"
131
+ }, `${process.cwd()}/vite.config.${ext}`);
132
+ // update config
133
+ $configObject = config;
134
+ $outDir = $configObject.config?.build?.outDir || "dist";
135
+ $buildDir = `${process.cwd()}/${$outDir}/${platformDir}/${environment}`;
136
+ if (!fs.existsSync(`${$buildDir}`)) {
137
+ fs.mkdirSync(`${$buildDir}`, { "recursive": true });
138
+ console.log(pc.green(`Create build directory: ${$buildDir}`));
139
+ console.log();
140
+ }
146
141
  };
147
142
  /**
148
143
  * @description Web用アプリの書き出し関数
@@ -155,18 +150,26 @@ const loadConfig = () => {
155
150
  const buildWeb = () => {
156
151
  return new Promise((resolve, reject) => {
157
152
  const stream = cp.spawn("npx", [
158
- "vite",
159
- "--outDir",
160
- $buildDir,
161
- "build"
153
+ "@next2d/vite-plugin-next2d-auto-loader"
162
154
  ], { "stdio": "inherit" });
163
155
  stream.on("close", (code) => {
164
156
  if (code !== 0) {
165
- reject("Export of `HTML` and `JavaScript` failed.");
157
+ reject("vite plugin command failed.");
166
158
  }
167
- console.log();
168
- console.log(pc.green("`HTML` and `JavaScript` files are written out."));
169
- resolve();
159
+ const stream = cp.spawn("npx", [
160
+ "vite",
161
+ "--outDir",
162
+ $buildDir,
163
+ "build"
164
+ ], { "stdio": "inherit" });
165
+ stream.on("close", (code) => {
166
+ if (code !== 0) {
167
+ reject("Export of `HTML` and `JavaScript` failed.");
168
+ }
169
+ console.log();
170
+ console.log(pc.green("`HTML` and `JavaScript` files are written out."));
171
+ resolve();
172
+ });
170
173
  });
171
174
  });
172
175
  };
@@ -363,7 +366,7 @@ const runNative = async () => {
363
366
  * @method
364
367
  * @public
365
368
  */
366
- const multiBuild = () => {
369
+ const multiBuild = async () => {
367
370
  switch (platform) {
368
371
  case "windows":
369
372
  case "macos":
@@ -371,12 +374,12 @@ const multiBuild = () => {
371
374
  case "steam:windows":
372
375
  case "steam:macos":
373
376
  case "steam:linux":
374
- buildSteam();
377
+ await buildSteam();
375
378
  break;
376
379
  case "ios":
377
380
  case "android":
378
381
  if (preview) {
379
- runNative();
382
+ await runNative();
380
383
  }
381
384
  break;
382
385
  case "web":
@@ -396,12 +399,14 @@ const multiBuild = () => {
396
399
  * @public
397
400
  */
398
401
  const execute = async () => {
399
- await loadConfig();
400
- buildWeb()
401
- .then(multiBuild)
402
- .catch((error) => {
403
- console.log(pc.red(error));
402
+ try {
403
+ await loadConfig();
404
+ await buildWeb();
405
+ await multiBuild();
406
+ }
407
+ catch (error) {
408
+ console.error(error);
404
409
  process.exit(1);
405
- });
410
+ }
406
411
  };
407
412
  execute();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/builder",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Multi-platform builder for Next2d Framework, supporting export to various platforms such as macOS, Windows, iOS, Android and Web(HTML)",
5
5
  "author": "Toshiyuki Ienaga <ienaga@next2d.app>",
6
6
  "license": "MIT",
@@ -34,15 +34,19 @@
34
34
  "@next2d/builder": "dist/index.js"
35
35
  },
36
36
  "dependencies": {
37
- "@electron-forge/core": "^6.4.2",
38
- "@types/node": "^20.9.0",
39
- "picocolors": "^1.0.0",
40
- "vite": "^4.5.0"
37
+ "@electron-forge/core": "^7.7.0",
38
+ "@types/node": "^22.13.11",
39
+ "picocolors": "^1.1.1",
40
+ "vite": "^6.2.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@typescript-eslint/eslint-plugin": "^6.10.0",
44
- "@typescript-eslint/parser": "^6.10.0",
45
- "eslint": "^8.53.0",
46
- "typescript": "^5.2.2"
43
+ "@eslint/eslintrc": "^3.3.1",
44
+ "@eslint/js": "^9.23.0",
45
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
46
+ "@typescript-eslint/parser": "^8.27.0",
47
+ "eslint": "^9.23.0",
48
+ "eslint-plugin-unused-imports": "^4.1.4",
49
+ "globals": "^16.0.0",
50
+ "typescript": "^5.8.2"
47
51
  }
48
52
  }