feat: Portable build & CLI command execution for CI pipelines#8587
feat: Portable build & CLI command execution for CI pipelines#8587malec-palec wants to merge 8 commits into
Conversation
4ian
left a comment
There was a problem hiding this comment.
Looks solid overall. Added various comments but I think this is a good approach and implementation will be clean 👍
| - Change the number of the animation of MySpriteObject: = 1 | ||
| - Show GroupOfObjects | ||
| - Activate behavior PlatformerObject of GroupOfSpriteObjectsWithBehaviors: no | ||
| - Activate behavior PlatformerObject of GroupOfSpriteObjectsWithBehaviors: |
There was a problem hiding this comment.
Note: you might have an outdated libGD.js locally, relaunch npm run build in GDevelop.js and that should be solved.
There was a problem hiding this comment.
Reverted, thanks.
| @@ -0,0 +1,74 @@ | |||
| // @flow | |||
There was a problem hiding this comment.
Nitpicking: files are PascalCase in the IDE codebase.
There was a problem hiding this comment.
Renamed exportLocalHtml5Headless.js → ExportLocalHtml5Headless.js, updated all imports
| * Has no React dependencies; accepts a stub i18n like | ||
| * `{ _: msg => (msg && msg.message) || String(msg) }`. |
There was a problem hiding this comment.
| * Has no React dependencies; accepts a stub i18n like | |
| * `{ _: msg => (msg && msg.message) || String(msg) }`. |
I would remove:
- React mention unless it's important for something else
- The mention of the stub (it's not a module responsibility to be aware that ti's given a stub or not - if it's happen it's the responsibility of the test creating a stub to make it so like the module it's given to is not even noticing it). If anything, we actually prefer to avoid stubs :)
There was a problem hiding this comment.
Trimmed JSDoc to /** Headless HTML5 export — no UI, no dialogs. */
| import { type I18n as I18nType } from '@lingui/core'; | ||
| import { exportLocalHtml5Headless } from '../ExportAndShare/Headless/exportLocalHtml5Headless'; | ||
|
|
||
| // Commands registered here are awaited by the CLI dispatcher so the process |
| ResourcesLoader.burstAllUrlsCache(); | ||
| PixiResourcesLoader.burstCache(); | ||
|
|
||
| // Set the on-disk path before exposing the project via state so that |
There was a problem hiding this comment.
Sounds good, thanks for the comment.
| // Dispatch `--run-command` once the project is loaded. "Awaitable" commands | ||
| // (CliCommandRunner.js) are awaited for a proper exit code; others fall back | ||
| // to fire-and-forget via commandPaletteRef.launchCommand. | ||
| const cliCommandRanRef = React.useRef(false); |
There was a problem hiding this comment.
I suggest we move this into newIDE/app/src/MainFrame/CliCommandRunner.js, in a hook like useCliCommandRunner({ project: state.currentProject, ... })
There was a problem hiding this comment.
Extracted both useEffect blocks into useCliCommandRunner hook in CliCommandRunner.js, called from MainFrame/index.js
|
|
||
| const exitApp = (exitCode: number) => { | ||
| if (keepOpen) return; | ||
| const remoteModule = optionalRequire('@electron/remote'); |
There was a problem hiding this comment.
We tend to avoid creating new dependencies to @electron/remote in favor of IPC (https://www.electronjs.org/docs/latest/tutorial/ipc#ipc-channels) (in an ideal world, the renderer process would have 0 calls to Electron or Node.js apis, all optionalRequire would be removed).
Instead, for this kind of "one way" communication, you can use ipcRenderer.send. We don't use yet a "preload.js" script, but it will be easy to migrate everything to a preload.js + exposeInMainWorld once we've reduced all APIs to using ipcRenderer calls.
There was a problem hiding this comment.
Replaced optionalRequire('@electron/remote').app.exit() with ipcRenderer.send('app-exit', exitCode), added ipcMain.on('app-exit') handler in main.js
| [state.currentProject, i18n] | ||
| ); | ||
|
|
||
| const CLI_PROJECT_LOAD_TIMEOUT_MS = 120_000; |
There was a problem hiding this comment.
Same here, this can be part of the hook
There was a problem hiding this comment.
Moved timeout useEffect into the same useCliCommandRunner hook
| const gotTheLock = isCliRunCommand ? true : app.requestSingleInstanceLock(); | ||
|
|
||
| if (!gotTheLock) { | ||
| // Second instance attempted - quit immediately |
There was a problem hiding this comment.
Restored // Second instance attempted - quit immediately and // First instance - handle second-instance events
@4ian, main question - can the |
Portable self-contained zip bundle (
npm run build-portable) without code-signing, plus headless--run-commandCLI flag that executes any Command Palette command after loading a project.In CLI mode all blocking dialogs (autosave, changelog, confirmations) are auto-resolved, the window is hidden, and the process exits with a meaningful exit code.
Enables CI pipelines to run exports (e.g.
EXPORT_HTML5_EXTERNAL) using only the editor distribution - no installation or display required.