Files
feuerwerk/vite.config.ts
T
adminandClaude Opus 5 5ba796a2b6
game-maker / gate (push) Successful in 3m32s
game-maker / suite (push) Failing after 8m21s
Plugins belong to the project, and they load before it: the project file gained the field plugins: ["demo-plugin.js"] (default empty, no formatVersion bump), the Plugins tab's switch writes into it as an ordinary undo step (SetPluginActiveCommand) instead of into a server-wide plugins.json, and the start order is turned around - startPlugins only fetches the list of files, then editor.boot() runs and ProjectStore.load(id, prepare) hands the raw JSON through before it is deserialized, where pluginsOf(raw) reads the list and PluginManager.syncTo() activates exactly those; that is the point of the issue, because what a plugin registers has to stand there before normalizeGraph would throw it away as unknown (#126, #127), a project switch first stops what the new project does not name and then starts what it does, a file the server does not have is passed over silently, and after signing out the manager is dead so a late event cannot start anything in a torn-down session; on the server plugins.json, PluginStore::setActive, isActive, the route PUT ?r=plugins/{file} and the 403 for inactive modules are gone and GET ?r=plugins only answers {file,bytes,updatedAt}, which makes every plugin file fetchable - the consequence accepted in #117, written down in the wiki for #115 and #116; publishPlugins(root) only copies files now, the seeder switches the demo plugin on in the fixture project, and the Plugins tab carries a puzzle piece as its icon while only a plugin's own tab still goes without one (the knob and the socket are cubic curves, not arcs, which Pixi's parser draws as a spike after an L); 3 new e2e checks in module 38 and 5 new unit tests cover the project as the owner of the switch, its undo, the order, pluginsOf against crude input and an unknown file name (#119)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-20 14:24:27 +02:00

72 lines
2.3 KiB
TypeScript

import { copyFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig, type Plugin } from 'vite';
import { publishPlugins } from './tools/lib/plugins.mjs';
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
* The workspace folder itself is what nginx serves under https://nockal.com/game-maker/.
* The Vite source page lives in `web/index.html`; the build writes hashed assets into
* `dist/` and this plugin copies the built HTML to the folder root so that the site URL
* loads the production bundle while `api/` and `data/` sit next to it.
*/
function publishIndexHtml(): Plugin {
return {
name: 'game-maker:publish-index-html',
apply: 'build',
closeBundle() {
copyFileSync(resolve(__dirname, 'dist/index.html'), resolve(__dirname, 'index.html'));
},
};
}
/**
* Editor plugins are loaded from `data/plugins/`, which is not in the repository; the ones that
* ship with it live in `plugins/` and are put there on every build. A file of the same name is
* replaced, anything else in the folder is left alone. Whether one runs is the open project's
* business, not the build's (#119).
*/
function shipPlugins(): Plugin {
return {
name: 'game-maker:publish-plugins',
apply: 'build',
closeBundle() {
publishPlugins(__dirname);
},
};
}
export default defineConfig({
root: 'web',
base: '/game-maker/dist/',
publicDir: false,
plugins: [publishIndexHtml(), shipPlugins()],
build: {
outDir: '../dist',
emptyOutDir: true,
target: 'es2022',
sourcemap: true,
},
server: {
port: 5175,
// During development the PHP API is served by the production nginx; proxy it.
proxy: {
'/game-maker/api': {
target: 'https://nockal.com',
changeOrigin: true,
},
},
},
test: {
root: '.',
include: ['tests/**/*.test.ts'],
environment: 'node',
// Unset locally, so vitest keeps its own guess (one worker per core). CI sets it while the
// gate runs next to the editor suite: the two jobs share four cores, and the suite measures
// text widths and frame counts, which a machine under full load reports differently.
maxWorkers: Number(process.env.GM_TEST_WORKERS) || undefined,
},
});