diff --git a/automation/write-neu-config.ts b/automation/write-neu-config.ts deleted file mode 100644 index bd26919..0000000 --- a/automation/write-neu-config.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { team, title, team_dashed, title_dashed, git_count, neutralino } from './constants'; -import neuConf from './neu-template.json'; -import { writeFileSync } from 'fs'; - -export default function WriteNeuConfig(isProd = false) { - neuConf.applicationId = `${team_dashed}.${title_dashed}`; - neuConf.modes.window.title = `${title} by ${team}`; - neuConf.cli.binaryName = `${team_dashed}-${title_dashed}`; - neuConf.version = `0.0.${git_count}`; - if(isProd) { - neuConf.documentRoot = "/web/"; - neuConf.cli.resourcesPath = "/"; - neuConf.modes.window.icon = "/web/icon.png"; - } else { - neuConf.tokenSecurity = 'none'; - } - - neuConf.nativeAllowList = [...neuConf.nativeAllowList, ...neutralino.allow]; - - writeFileSync(isProd ? 'dist/neutralino.config.json' : 'neutralino.config.json', JSON.stringify(neuConf)); - writeFileSync('./src/public/__neutralino_globals.js', '// Dummy file'); -} diff --git a/game.config.json b/game.config.json index 0b1fea8..2dc968d 100644 --- a/game.config.json +++ b/game.config.json @@ -8,6 +8,7 @@ "game": "game-name" }, "neutralino": { - "allow": ["app.exit", "window.center", "storage.*"] + "allow": ["app.exit", "window.center", "storage.*"], + "window": {} } } diff --git a/package.json b/package.json index 531edbb..0fadbec 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "type": "module", "license": "MIT", "scripts": { - "start": "vite-node automation/dev.ts", - "dev": "vite-node automation/dev.ts", - "dev-neu": "vite-node automation/neu-dev.ts", + "start": "vite-node scripts/dev.ts", + "dev": "vite-node scripts/dev.ts", + "dev-neu": "vite-node scripts/neu-dev.ts", "build": "rimraf dist && vite build", - "postinstall": "vite-node automation/setup.ts" + "postinstall": "vite-node scripts/setup.ts" }, "dependencies": { "@neutralinojs/lib": "^5.5.0", @@ -16,8 +16,8 @@ "phaser3-rex-plugins": "^1.80.12" }, "devDependencies": { - "@electron/asar": "^3.2.10", - "@neutralinojs/neu": "^11.2.2", + "@electron/asar": "^3.2.17", + "@neutralinojs/neu": "^11.3.0", "png2icons": "^2.0.1", "resedit": "^2.0.3", "rimraf": "^6.0.1", @@ -25,7 +25,7 @@ "terser": "^5.37.0", "typescript": "^5.7.2", "vite": "^6.0.3", - "vite-node": "^2.0.5", + "vite-node": "^2.1.8", "vite-plugin-checker": "^0.8.0", "vite-plugin-image-optimizer": "^1.1.8", "vite-plugin-zip-pack": "^1.2.4", diff --git a/automation/build-cleanup.ts b/scripts/build-cleanup.ts similarity index 100% rename from automation/build-cleanup.ts rename to scripts/build-cleanup.ts diff --git a/automation/constants.ts b/scripts/constants.ts similarity index 100% rename from automation/constants.ts rename to scripts/constants.ts diff --git a/automation/dev.ts b/scripts/dev.ts similarity index 100% rename from automation/dev.ts rename to scripts/dev.ts diff --git a/automation/git-version.ts b/scripts/git-version.ts similarity index 100% rename from automation/git-version.ts rename to scripts/git-version.ts diff --git a/automation/linux-bundle.ts b/scripts/linux-bundle.ts similarity index 100% rename from automation/linux-bundle.ts rename to scripts/linux-bundle.ts diff --git a/automation/mac-bundle.ts b/scripts/mac-bundle.ts similarity index 100% rename from automation/mac-bundle.ts rename to scripts/mac-bundle.ts diff --git a/automation/neu-build.ts b/scripts/neu-build.ts similarity index 100% rename from automation/neu-build.ts rename to scripts/neu-build.ts diff --git a/automation/neu-dev.ts b/scripts/neu-dev.ts similarity index 100% rename from automation/neu-dev.ts rename to scripts/neu-dev.ts diff --git a/automation/neu-inject.ts b/scripts/neu-inject.ts similarity index 100% rename from automation/neu-inject.ts rename to scripts/neu-inject.ts diff --git a/automation/neu-template.json b/scripts/neu-template.json similarity index 100% rename from automation/neu-template.json rename to scripts/neu-template.json diff --git a/automation/pre-image-optimizer.ts b/scripts/pre-image-optimizer.ts similarity index 100% rename from automation/pre-image-optimizer.ts rename to scripts/pre-image-optimizer.ts diff --git a/automation/setup.ts b/scripts/setup.ts similarity index 100% rename from automation/setup.ts rename to scripts/setup.ts diff --git a/automation/win-bundle.ts b/scripts/win-bundle.ts similarity index 100% rename from automation/win-bundle.ts rename to scripts/win-bundle.ts diff --git a/scripts/write-neu-config.ts b/scripts/write-neu-config.ts new file mode 100644 index 0000000..b3658b4 --- /dev/null +++ b/scripts/write-neu-config.ts @@ -0,0 +1,33 @@ +import { + team, + title, + team_dashed, + title_dashed, + git_count, + neutralino, +} from "./constants"; +import neuConf from "./neu-template.json"; +import { writeFileSync } from "fs"; + +export default function WriteNeuConfig(isProd = false) { + neuConf.applicationId = `${team_dashed}.${title_dashed}`; + neuConf.modes.window.title = `${title} by ${team}`; + neuConf.cli.binaryName = `${team_dashed}-${title_dashed}`; + neuConf.version = `0.0.${git_count}`; + if (isProd) { + neuConf.documentRoot = "/web/"; + neuConf.cli.resourcesPath = "/"; + neuConf.modes.window.icon = "/web/icon.png"; + } else { + neuConf.tokenSecurity = "none"; + } + + neuConf.nativeAllowList = [...neuConf.nativeAllowList, ...neutralino.allow]; + neuConf.modes.window = { ...neuConf.modes.window, ...neutralino.window }; + + writeFileSync( + isProd ? "dist/neutralino.config.json" : "neutralino.config.json", + JSON.stringify(neuConf) + ); + writeFileSync("./src/public/__neutralino_globals.js", "// Dummy file"); +} diff --git a/vite.config.ts b/vite.config.ts index 5ce4b79..f7ba2fd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,70 +1,70 @@ -import { defineConfig } from 'vite'; +import { defineConfig } from "vite"; -import zip from 'vite-plugin-zip-pack'; -import checker from 'vite-plugin-checker'; -import tsconfigPaths from 'vite-tsconfig-paths'; -import getGitVersion from './automation/git-version'; -import preImageOptimizer from './automation/pre-image-optimizer'; -import neuBuild from './automation/neu-build'; -import neuInject from './automation/neu-inject'; -import bundleWinApp from './automation/win-bundle'; -import bundleMacApp from './automation/mac-bundle'; -import bundleLinuxApp from './automation/linux-bundle'; -import buildCleanup from './automation/build-cleanup'; +import zip from "vite-plugin-zip-pack"; +import checker from "vite-plugin-checker"; +import tsconfigPaths from "vite-tsconfig-paths"; +import getGitVersion from "./scripts/git-version"; +import preImageOptimizer from "./scripts/pre-image-optimizer"; +import neuBuild from "./scripts/neu-build"; +import neuInject from "./scripts/neu-inject"; +import bundleWinApp from "./scripts/win-bundle"; +import bundleMacApp from "./scripts/mac-bundle"; +import bundleLinuxApp from "./scripts/linux-bundle"; +import buildCleanup from "./scripts/build-cleanup"; -import { title, team, description, title_dashed } from './automation/constants'; +import { title, team, description, title_dashed } from "./scripts/constants"; export default () => { - process.env.VITE_GAME_TITLE = title; - process.env.VITE_GAME_TEAM = team; - process.env.VITE_GAME_DESCRIPTION = description; + process.env.VITE_GAME_TITLE = title; + process.env.VITE_GAME_TEAM = team; + process.env.VITE_GAME_DESCRIPTION = description; - return defineConfig({ - base: './', - root: 'src', - plugins: [ - tsconfigPaths(), - getGitVersion(), - checker({ - typescript: true, - }), - preImageOptimizer(), - neuInject(), - neuBuild(), - bundleWinApp(), - bundleMacApp(), - bundleLinuxApp(), - zip({ - inDir: './dist/web', - outDir: './dist', - outFileName: `${title_dashed}-web.zip`, - }), - zip({ - inDir: `./dist/win`, - outDir: './dist', - outFileName: `${title_dashed}-win.zip`, - }), - zip({ - inDir: `./dist/linux`, - outDir: './dist', - outFileName: `${title_dashed}-linux.zip`, - }), - buildCleanup(), - ], - build: { - outDir: '../dist/web', - chunkSizeWarningLimit: 4096, - assetsInlineLimit: 0, - target: 'ES2022', - minify: 'terser', - terserOptions: { - format: { - comments: false, - }, - }, - }, - server: { - host: 'localhost', - }, - }); + return defineConfig({ + base: "./", + root: "src", + plugins: [ + tsconfigPaths(), + getGitVersion(), + checker({ + typescript: true, + }), + preImageOptimizer(), + neuInject(), + neuBuild(), + bundleWinApp(), + bundleMacApp(), + bundleLinuxApp(), + zip({ + inDir: "./dist/web", + outDir: "./dist", + outFileName: `${title_dashed}-web.zip`, + }), + zip({ + inDir: `./dist/win`, + outDir: "./dist", + outFileName: `${title_dashed}-win.zip`, + }), + zip({ + inDir: `./dist/linux`, + outDir: "./dist", + outFileName: `${title_dashed}-linux.zip`, + }), + buildCleanup(), + ], + build: { + outDir: "../dist/web", + chunkSizeWarningLimit: 4096, + assetsInlineLimit: 0, + target: "ES2022", + minify: "terser", + terserOptions: { + format: { + comments: false, + }, + }, + }, + server: { + host: "localhost", + }, + }); };