@next2d/builder 0.0.9 → 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 -41
  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,30 +117,27 @@ const CAPACITOR_CONFIG_NAME = "capacitor.config.json";
117
117
  * @method
118
118
  * @public
119
119
  */
120
- const loadConfig = () => {
121
- return new Promise(async (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
- const config = await loadConfigFromFile({
130
- "command": "build",
131
- "mode": "build"
132
- }, `${process.cwd()}/vite.config.${ext}`);
133
- // update config
134
- $configObject = config;
135
- $outDir = $configObject.config?.build?.outDir || "dist";
136
- $buildDir = `${process.cwd()}/${$outDir}/${platformDir}/${environment}`;
137
- if (!fs.existsSync(`${$buildDir}`)) {
138
- fs.mkdirSync(`${$buildDir}`, { "recursive": true });
139
- console.log(pc.green(`Create build directory: ${$buildDir}`));
140
- console.log();
141
- }
142
- resolve();
143
- });
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
+ }
144
141
  };
145
142
  /**
146
143
  * @description Web用アプリの書き出し関数
@@ -153,18 +150,26 @@ const loadConfig = () => {
153
150
  const buildWeb = () => {
154
151
  return new Promise((resolve, reject) => {
155
152
  const stream = cp.spawn("npx", [
156
- "vite",
157
- "--outDir",
158
- $buildDir,
159
- "build"
153
+ "@next2d/vite-plugin-next2d-auto-loader"
160
154
  ], { "stdio": "inherit" });
161
155
  stream.on("close", (code) => {
162
156
  if (code !== 0) {
163
- reject("Export of `HTML` and `JavaScript` failed.");
157
+ reject("vite plugin command failed.");
164
158
  }
165
- console.log();
166
- console.log(pc.green("`HTML` and `JavaScript` files are written out."));
167
- 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
+ });
168
173
  });
169
174
  });
170
175
  };
@@ -361,7 +366,7 @@ const runNative = async () => {
361
366
  * @method
362
367
  * @public
363
368
  */
364
- const multiBuild = () => {
369
+ const multiBuild = async () => {
365
370
  switch (platform) {
366
371
  case "windows":
367
372
  case "macos":
@@ -369,12 +374,12 @@ const multiBuild = () => {
369
374
  case "steam:windows":
370
375
  case "steam:macos":
371
376
  case "steam:linux":
372
- buildSteam();
377
+ await buildSteam();
373
378
  break;
374
379
  case "ios":
375
380
  case "android":
376
381
  if (preview) {
377
- runNative();
382
+ await runNative();
378
383
  }
379
384
  break;
380
385
  case "web":
@@ -394,12 +399,14 @@ const multiBuild = () => {
394
399
  * @public
395
400
  */
396
401
  const execute = async () => {
397
- await loadConfig();
398
- buildWeb()
399
- .then(multiBuild)
400
- .catch((error) => {
401
- console.log(pc.red(error));
402
+ try {
403
+ await loadConfig();
404
+ await buildWeb();
405
+ await multiBuild();
406
+ }
407
+ catch (error) {
408
+ console.error(error);
402
409
  process.exit(1);
403
- });
410
+ }
404
411
  };
405
412
  execute();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/builder",
3
- "version": "0.0.9",
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
  }