From 84cb22054868e9d5242539da9b36a0ab71bc3e73 Mon Sep 17 00:00:00 2001 From: ienaga Date: Thu, 9 Nov 2023 00:47:27 +0900 Subject: [PATCH 1/5] =?UTF-8?q?#11=20Vite=E3=81=AB=E7=A7=BB=E8=A1=8C(WIP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 25 +++++++++++++++++-- LICENSE | 2 +- template.json | 7 +++++- template/capacitor.config.json | 2 +- template/electron.build.js | 33 ------------------------- template/electron.build.json | 45 ++++++++++++++++++++++++++++++++++ template/package.json | 25 +++++++++---------- template/vite.config.ts | 7 ++++-- 8 files changed, 93 insertions(+), 53 deletions(-) delete mode 100644 template/electron.build.js create mode 100644 template/electron.build.json diff --git a/.gitignore b/.gitignore index 3db055b..54f07af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,24 @@ -.DS_Store +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json .idea -Thumbs.db \ No newline at end of file +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? \ No newline at end of file diff --git a/LICENSE b/LICENSE index a536abe..d520559 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Next2D +Copyright (c) 2021 - 2023 Next2D Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/template.json b/template.json index 500a20f..765f35c 100644 --- a/template.json +++ b/template.json @@ -4,7 +4,12 @@ "@typescript-eslint/eslint-plugin": "*", "@typescript-eslint/parser": "*", "typescript": "*", - "eslint": "*" + "eslint": "*", + "electron": "*", + "@capacitor/cli": "*", + "@capacitor/core": "*", + "@capacitor/ios": "*", + "@capacitor/android": "*" } } } \ No newline at end of file diff --git a/template/capacitor.config.json b/template/capacitor.config.json index b41232c..6fb124f 100644 --- a/template/capacitor.config.json +++ b/template/capacitor.config.json @@ -1,7 +1,7 @@ { "appId": "app.example.appId", "appName": "Example-Product-Name", - "webDir": "./dist/web/prd/", + "webDir": "dist/ios/prd/", "bundledWebRuntime": false, "plugins": { "SplashScreen": { diff --git a/template/electron.build.js b/template/electron.build.js deleted file mode 100644 index e502195..0000000 --- a/template/electron.build.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - "appId": "app.example.appId", - "productName": "Example-Product-Name", - "directories": { - "output": "dist" - }, - "copyright": "Copyright ©2023 Example-Product-Name", - "extraMetadata": { - "version": "0.0.1", - "main": "electron.js" - }, - "files": [ - "!__tests__/{,/**/*}", - "!file/{,/**/*}", - "!mock/{,/**/*}", - "!src/{,/**/*}", - "!icon/{,/**/*}", - "!ios/{,/**/*}", - "!android/{,/**/*}" - ], - "mac": { - "target": "dmg", - "icon": "icon/macos/icon.icns" - }, - "win": { - "target": "nsis", - "icon": "icon/windows/icon.png" - }, - "nsis": { - "oneClick": false, - "allowToChangeInstallationDirectory": true - } -}; \ No newline at end of file diff --git a/template/electron.build.json b/template/electron.build.json new file mode 100644 index 0000000..3d11865 --- /dev/null +++ b/template/electron.build.json @@ -0,0 +1,45 @@ +{ + "appId": "app.example.appId", + "productName": "Example-Product-Name", + "directories": { + "output": "dist" + }, + "copyright": "Copyright ©2023 Example-Product-Name", + "extraMetadata": { + "version": "0.0.1", + "main": "electron.js" + }, + "files": [ + "!file/*", + "!mock/*", + "!src/*", + "!icon/*", + "!ios/*", + "!android/*", + "!**/.vscode/*", + "!**/.github/*", + "!.eslintignore", + "!.eslintrc.json", + "!.gitattributes", + "!.gitignore", + "!capacitor.config.json", + "!electron.build.json", + "!index.html", + "!README.md", + "!tsconfig.eslint.json", + "!tsconfig.json", + "!vite.config.ts" + ], + "mac": { + "target": "dmg", + "icon": "icon/macos/icon.icns" + }, + "win": { + "target": "portable", + "icon": "icon/windows/icon.png" + }, + "linux": { + "target": "deb", + "icon": "icon/linux/icon.png" + } +} \ No newline at end of file diff --git a/template/package.json b/template/package.json index 0267735..5bd227c 100644 --- a/template/package.json +++ b/template/package.json @@ -8,16 +8,16 @@ "type": "module", "scripts": { "start": "vite", - "dev:ios": "npx @next2d/builder run ios --platform ios --debug", - "dev:android": "npx @next2d/builder run android --platform android --debug", - "dev:macos": "npx @next2d/builder --platform macos --debug", - "dev:windows": "npx @next2d/builder --platform windows --debug", - "dev:linux": "npx @next2d/builder --platform linux --debug", + "preview:ios": "npx @next2d/builder run ios --platform ios --debug", + "preview:android": "npx @next2d/builder run android --platform android --debug", + "preview:macos": "npx @next2d/builder --platform macos --debug", + "preview:windows": "npx @next2d/builder --platform windows --debug", + "preview:linux": "npx @next2d/builder --platform linux --debug", "build:steam:windows": "npx @next2d/builder --platform steam:windows --env prd", - "build:steam:mac": "npx @next2d/builder --platform steam:mac --env prd", + "build:steam:macos": "npx @next2d/builder --platform steam:macos --env prd", "build:steam:linux": "npx @next2d/builder --platform steam:linux --env prd", "build:web": "npx @next2d/builder --platform web --env prd", - "build": "vite build", + "build": "npx @next2d/builder", "lint": "eslint src/**/*.ts", "test": "npx vitest", "generate": "npx @next2d/view-generator" @@ -27,12 +27,11 @@ "@capacitor/cli": "^5.5.1", "@capacitor/core": "^5.5.1", "@capacitor/ios": "^5.5.1", - "@next2d/env": "^2.0.2", - "@next2d/framework": "^2.0.0", + "@next2d/framework": "^2.0.1", "@next2d/player": "^1.18.9", - "@next2d/vite-auto-loader-plugin": "^0.0.7", - "@typescript-eslint/eslint-plugin": "^6.9.1", - "@typescript-eslint/parser": "^6.9.1", + "@next2d/vite-auto-loader-plugin": "^0.0.8", + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", "electron": "^27.0.3", "eslint": "^8.53.0", "jsdom": "^22.1.0", @@ -40,4 +39,4 @@ "vite": "^4.5.0", "vitest": "^0.34.6" } -} +} \ No newline at end of file diff --git a/template/vite.config.ts b/template/vite.config.ts index 7bb4a80..830d171 100644 --- a/template/vite.config.ts +++ b/template/vite.config.ts @@ -1,11 +1,14 @@ +/// + import { defineConfig } from "vite"; import path from "path"; -import env from "@next2d/env"; import autoLoader from "@next2d/vite-auto-loader-plugin"; const port: number = 5173; export default defineConfig({ + "base": "./", "build": { + "outDir": "dist", "target": "esnext", "modulePreload": { "polyfill": false @@ -17,7 +20,7 @@ export default defineConfig({ } }, "plugins": [ - autoLoader(env()) + autoLoader() ], "server": { "open": "index.html", From 9bcf09c7059f185e9ad0757c8928db74922aba70 Mon Sep 17 00:00:00 2001 From: ienaga Date: Thu, 9 Nov 2023 08:29:55 +0900 Subject: [PATCH 2/5] =?UTF-8?q?#11=20=E5=90=84=E7=A8=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/capacitor.config.json | 2 +- template/electron.build.json | 4 +++- template/package.json | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/template/capacitor.config.json b/template/capacitor.config.json index 6fb124f..53a6fe7 100644 --- a/template/capacitor.config.json +++ b/template/capacitor.config.json @@ -1,7 +1,7 @@ { "appId": "app.example.appId", "appName": "Example-Product-Name", - "webDir": "dist/ios/prd/", + "webDir": "dist/android/prd/", "bundledWebRuntime": false, "plugins": { "SplashScreen": { diff --git a/template/electron.build.json b/template/electron.build.json index 3d11865..f092640 100644 --- a/template/electron.build.json +++ b/template/electron.build.json @@ -4,16 +4,18 @@ "directories": { "output": "dist" }, + "asar": false, "copyright": "Copyright ©2023 Example-Product-Name", "extraMetadata": { "version": "0.0.1", "main": "electron.js" }, "files": [ + "!@types/*", "!file/*", + "!icon/*", "!mock/*", "!src/*", - "!icon/*", "!ios/*", "!android/*", "!**/.vscode/*", diff --git a/template/package.json b/template/package.json index 5bd227c..18a3972 100644 --- a/template/package.json +++ b/template/package.json @@ -8,11 +8,11 @@ "type": "module", "scripts": { "start": "vite", - "preview:ios": "npx @next2d/builder run ios --platform ios --debug", - "preview:android": "npx @next2d/builder run android --platform android --debug", - "preview:macos": "npx @next2d/builder --platform macos --debug", - "preview:windows": "npx @next2d/builder --platform windows --debug", - "preview:linux": "npx @next2d/builder --platform linux --debug", + "preview:ios": "npx @next2d/builder --platform ios --preview", + "preview:android": "npx @next2d/builder --platform android --preview", + "preview:macos": "npx @next2d/builder --platform macos --preview", + "preview:windows": "npx @next2d/builder --platform windows --preview", + "preview:linux": "npx @next2d/builder --platform linux --preview", "build:steam:windows": "npx @next2d/builder --platform steam:windows --env prd", "build:steam:macos": "npx @next2d/builder --platform steam:macos --env prd", "build:steam:linux": "npx @next2d/builder --platform steam:linux --env prd", @@ -32,7 +32,7 @@ "@next2d/vite-auto-loader-plugin": "^0.0.8", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", - "electron": "^27.0.3", + "electron": "^27.0.4", "eslint": "^8.53.0", "jsdom": "^22.1.0", "typescript": "^5.2.2", From d7d6cb82e2c3f21c8c284cbc984f472636ee7406 Mon Sep 17 00:00:00 2001 From: ienaga Date: Thu, 9 Nov 2023 13:08:32 +0900 Subject: [PATCH 3/5] =?UTF-8?q?#11=20Vite=E3=81=AB=E7=A7=BB=E8=A1=8C?= =?UTF-8?q?=E3=80=81=E3=83=9E=E3=83=AB=E3=83=81=E3=83=93=E3=83=AB=E3=83=89?= =?UTF-8?q?=E5=AE=9F=E8=A3=85(WIP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmignore | 6 +++++- template.json | 7 +------ template/electron.build.json | 33 +++++++++++++-------------------- template/package.json | 3 +-- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/.npmignore b/.npmignore index e9aadee..420b0ae 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,11 @@ .github +.gitattributes +.gitignore template/dist +template/ios +template/android template/node_modules template/package.json template/src/Packages.ts template/src/config/Config.ts -template/electron.index.json +template/electron.index.json \ No newline at end of file diff --git a/template.json b/template.json index 765f35c..500a20f 100644 --- a/template.json +++ b/template.json @@ -4,12 +4,7 @@ "@typescript-eslint/eslint-plugin": "*", "@typescript-eslint/parser": "*", "typescript": "*", - "eslint": "*", - "electron": "*", - "@capacitor/cli": "*", - "@capacitor/core": "*", - "@capacitor/ios": "*", - "@capacitor/android": "*" + "eslint": "*" } } } \ No newline at end of file diff --git a/template/electron.build.json b/template/electron.build.json index f092640..ad2aed0 100644 --- a/template/electron.build.json +++ b/template/electron.build.json @@ -11,26 +11,19 @@ "main": "electron.js" }, "files": [ - "!@types/*", - "!file/*", - "!icon/*", - "!mock/*", - "!src/*", - "!ios/*", - "!android/*", - "!**/.vscode/*", - "!**/.github/*", - "!.eslintignore", - "!.eslintrc.json", - "!.gitattributes", - "!.gitignore", - "!capacitor.config.json", - "!electron.build.json", - "!index.html", - "!README.md", - "!tsconfig.eslint.json", - "!tsconfig.json", - "!vite.config.ts" + "node_modules/", + "electron.index.json", + "package.json", + "electron.js", + "!node_modules/@next2d", + "!node_modules/@eslint", + "!node_modules/@jest", + "!node_modules/@vitest", + "!node_modules/@ionic", + "!node_modules/@capacitor", + "!node_modules/vite", + "!node_modules/vite-node", + "!node_modules/vitest" ], "mac": { "target": "dmg", diff --git a/template/package.json b/template/package.json index 18a3972..e699148 100644 --- a/template/package.json +++ b/template/package.json @@ -4,7 +4,6 @@ "description": "Next2D Framework TypeScript template.", "author": "Toshiyuki Ienaga ", "license": "MIT", - "main": "src/index.ts", "type": "module", "scripts": { "start": "vite", @@ -29,7 +28,7 @@ "@capacitor/ios": "^5.5.1", "@next2d/framework": "^2.0.1", "@next2d/player": "^1.18.9", - "@next2d/vite-auto-loader-plugin": "^0.0.8", + "@next2d/vite-auto-loader-plugin": "^1.0.0", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", "electron": "^27.0.4", From df083e77a0945593ddd4f092183b4abf62afd5bf Mon Sep 17 00:00:00 2001 From: ienaga Date: Sat, 11 Nov 2023 08:54:03 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=E3=83=9E=E3=83=AB=E3=83=81=E3=83=93?= =?UTF-8?q?=E3=83=AB=E3=83=89=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/.gitignore | 3 ++- template/capacitor.config.json | 2 +- template/electron.build.json | 46 ++++++++++++++++++++-------------- template/electron.js | 2 +- template/package.json | 11 ++++---- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/template/.gitignore b/template/.gitignore index fb28a55..850723b 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -25,4 +25,5 @@ dist-ssr src/Packages.ts src/config/Config.ts -electron.index.json \ No newline at end of file +electron.index.json +out/ \ No newline at end of file diff --git a/template/capacitor.config.json b/template/capacitor.config.json index 53a6fe7..6fb124f 100644 --- a/template/capacitor.config.json +++ b/template/capacitor.config.json @@ -1,7 +1,7 @@ { "appId": "app.example.appId", "appName": "Example-Product-Name", - "webDir": "dist/android/prd/", + "webDir": "dist/ios/prd/", "bundledWebRuntime": false, "plugins": { "SplashScreen": { diff --git a/template/electron.build.json b/template/electron.build.json index ad2aed0..263d82a 100644 --- a/template/electron.build.json +++ b/template/electron.build.json @@ -1,40 +1,48 @@ { "appId": "app.example.appId", - "productName": "Example-Product-Name", "directories": { "output": "dist" }, - "asar": false, - "copyright": "Copyright ©2023 Example-Product-Name", + "copyright": "Copyright ©2023 ExampleProductName", "extraMetadata": { - "version": "0.0.1", - "main": "electron.js" + "name": "ExampleProductName", + "author": "You'r name.", + "main": "electron.js", + "type": "commonjs" }, "files": [ + "!node_modules/@next2d/", + "!node_modules/@eslint/", + "!node_modules/@jest/", + "!node_modules/@vitest/", + "!node_modules/@ionic/", + "!node_modules/@capacitor/", + "!node_modules/vite/", + "!node_modules/vite-node/", + "!node_modules/vitest/", + "!package.json", "node_modules/", - "electron.index.json", - "package.json", "electron.js", - "!node_modules/@next2d", - "!node_modules/@eslint", - "!node_modules/@jest", - "!node_modules/@vitest", - "!node_modules/@ionic", - "!node_modules/@capacitor", - "!node_modules/vite", - "!node_modules/vite-node", - "!node_modules/vitest" + "electron.index.json" ], "mac": { - "target": "dmg", + "target": [{ + "target": "zip", + "arch": ["universal"] + }], + "category": "Games", "icon": "icon/macos/icon.icns" }, "win": { - "target": "portable", + "target": [{ + "target": "nsis", + "arch": ["x64"] + }], "icon": "icon/windows/icon.png" }, "linux": { - "target": "deb", + "target": "zip", + "category": "Games", "icon": "icon/linux/icon.png" } } \ No newline at end of file diff --git a/template/electron.js b/template/electron.js index 5e115bc..6917120 100644 --- a/template/electron.js +++ b/template/electron.js @@ -14,7 +14,7 @@ const createWindow = () => { const browserWindow = new BrowserWindow({ "fullscreen": true, - "autoHideMenuBar": true, + "autoHideMenuBar": false, "webPreferences": { "nodeIntegration": false } diff --git a/template/package.json b/template/package.json index e699148..471acfb 100644 --- a/template/package.json +++ b/template/package.json @@ -2,11 +2,10 @@ "name": "@next2d/framework-typescript-template", "version": "0.0.1", "description": "Next2D Framework TypeScript template.", - "author": "Toshiyuki Ienaga ", - "license": "MIT", + "main": "src/index.ts", "type": "module", "scripts": { - "start": "vite", + "start": "electron-forge start", "preview:ios": "npx @next2d/builder --platform ios --preview", "preview:android": "npx @next2d/builder --platform android --preview", "preview:macos": "npx @next2d/builder --platform macos --preview", @@ -19,7 +18,9 @@ "build": "npx @next2d/builder", "lint": "eslint src/**/*.ts", "test": "npx vitest", - "generate": "npx @next2d/view-generator" + "generate": "npx @next2d/view-generator", + "package": "electron-forge package", + "make": "electron-forge make" }, "devDependencies": { "@capacitor/android": "^5.5.1", @@ -38,4 +39,4 @@ "vite": "^4.5.0", "vitest": "^0.34.6" } -} \ No newline at end of file +} From d3e0c3bb4b03c5bb7e391192a21a00332eb7727b Mon Sep 17 00:00:00 2001 From: ienaga Date: Sat, 11 Nov 2023 09:30:02 +0900 Subject: [PATCH 5/5] =?UTF-8?q?#11=20Vite=E3=81=AB=E7=A7=BB=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/package.json b/template/package.json index 471acfb..27a343e 100644 --- a/template/package.json +++ b/template/package.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "type": "module", "scripts": { - "start": "electron-forge start", + "start": "vite", "preview:ios": "npx @next2d/builder --platform ios --preview", "preview:android": "npx @next2d/builder --platform android --preview", "preview:macos": "npx @next2d/builder --platform macos --preview",