Repository navigation
fix(desktop): app não abre no macOS (MAIN_VITE_NATIVEPHP_BUILD_PATH ausente) - #13
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b6e7cef71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1 @@ | |||
| MAIN_VITE_NATIVEPHP_BUILD_PATH='../../../build' | |||
There was a problem hiding this comment.
Exempt the Vite environment files from the publication gate
On a clean checkout of this commit, php scripts/check-publication.php exits 1 because scripts/check-publication.php:44–47 exempts only .env.example and rejects both newly tracked Vite environment files as private_or_python_file. This check runs in .github/workflows/php-ci.yml:41–42 and .github/workflows/desktop-release.yml:97–102, so PHP verification fails and every installer job is blocked before packaging. Add narrowly scoped exceptions for these two non-secret build configuration files to the publication checker, not just .gitignore, while retaining the restrictions on other environment files.
Useful? React with 👍 / 👎.
9108fb8 to
bb010e6
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb010e64e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // If Vite inlines `undefined`, the packaged app crashes on launch (ERR_INVALID_ARG_TYPE). | ||
| test('production main bundle embeds a defined build path', () => { | ||
| const root = fileURLToPath(new URL('..', import.meta.url)); | ||
| execFileSync('npx', ['electron-vite', 'build'], { cwd: root, stdio: 'pipe' }); |
There was a problem hiding this comment.
Use a Windows-compatible executable to launch the build test
On a standard Windows Node/npm installation, npx is provided through a npx.cmd shim, which execFileSync cannot execute without a command shell. This makes the new regression test fail before Electron Vite runs, even when all build dependencies are installed. Invoke Electron Vite's local JavaScript CLI with process.execPath, or explicitly handle Windows shell execution, so the test can run on all supported desktop platforms.
Useful? React with 👍 / 👎.
bb010e6 to
8489b7e
Compare
The main bundle reads MAIN_VITE_NATIVEPHP_BUILD_PATH from nativephp/electron/.env.production, which was never committed because the root .gitignore ignores .env.*. Vite then inlined undefined and path.resolve crashed the packaged app on launch (ERR_INVALID_ARG_TYPE). Define the value in electron.vite.config.mjs instead and add a test that builds the bundle and fails if the path is undefined. Fixes LibreCodeCoop#12 Signed-off-by: Luis Amorim <principal@felps.zip>
8489b7e to
b9e4b8d
Compare
Objetivo
Corrigir a falha de inicialização do app empacotado no macOS (v0.4.0):
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined.Fixes #12
Causa
nativephp/electron/src/main/index.jsresolve o build compath.resolve(import.meta.dirname, import.meta.env.MAIN_VITE_NATIVEPHP_BUILD_PATH).nativephp/electron/.env.production(fornecido pelo NativePHP), que nunca foi versionado: o.gitignoreda raiz ignora.env.*, e o arquivo se perdeu na mudança de layout (f948128).undefinedno build e o app fecha ao abrir, sem criar janela. O código é o mesmo em todas as plataformas.Mudanças
electron.vite.config.mjspassa a definirimport.meta.env.MAIN_VITE_NATIVEPHP_BUILD_PATHviadefine:'../../../build'em produção (igual ao.env.productiondo NativePHP) eNATIVEPHP_BUILD_PATHem desenvolvimento..env.*(ignorados pelo git e rejeitados porscripts/check-publication.php); nenhuma alteração em CI ou no.gitignore.build/vite-env.test.mjsrodaelectron-vite builde falha se o bundle embutirundefined. Ainda não está ligado a nenhum workflow.Verificações
node --test nativephp/electron/build/vite-env.test.mjs: aprovado, sem nenhum.env.*no disco.php scripts/check-publication.php:PUBLICATION_CHECK_OK.native:build mac arm64(sem assinatura) concluído; o bundle embute"../../../build"e o app empacotado abriu e permaneceu em execução, sem o erropaths[1].Limites
undefined; é necessário um novo release.