Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: tuono build can succeed on build failure #278

Closed
pveierland opened this issue Jan 2, 2025 · 1 comment · Fixed by #297
Closed

[Bug]: tuono build can succeed on build failure #278

pveierland opened this issue Jan 2, 2025 · 1 comment · Fixed by #297
Assignees
Labels
bug Something isn't working good first issue Good for newcomers rust Requires rust knowledge

Comments

@pveierland
Copy link

pveierland commented Jan 2, 2025

Description

tuono build does not appear to check the exit status of Command output results, e.g. in build_react_prod. Note that the exit status of a command needs to be checked by evaluating Output::status, see:

https://doc.rust-lang.org/beta/std/process/struct.Output.html

This issue is confirmed with tuono version 0.16.5 and 0.16.9. The issue applies to all uses of Command in the project.

Expected behaviour

It is expected that any error in tuono build is propagated as output on stderr and that the exit status of tuono is non-zero.

How to reproduce

Example of build error:

❯ ./node_modules/.bin/tuono-build-prod
node:internal/process/promises:391
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Could not resolve "../src/styles/global.css" from ".tuono/client-main.tsx"
file: /project/crates/web/.tuono/client-main.tsx
    at getRollupError (file:///project/crates/web/node_modules/tuono/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
    at error (file:///project/crates/web/node_modules/tuono/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
    at ModuleLoader.handleInvalidResolvedId (file:///project/crates/web/node_modules/tuono/node_modules/rollup/dist/es/shared/node-entry.js:20088:24)
    at file:///project/crates/web/node_modules/tuono/node_modules/rollup/dist/es/shared/node-entry.js:20048:26 {
  code: 'UNRESOLVED_IMPORT',
  exporter: '../src/styles/global.css',
  id: '/project/crates/web/.tuono/client-main.tsx',
  watchFiles: [
    '/project/crates/web/.tuono/client-main.tsx',
    '/project/crates/web/node_modules/tuono/dist/esm/hydration/index.js',
    '/project/crates/web/.tuono/routeTree.gen.ts'
  ]
}

Node.js v20.18.1

❯ echo $?
1

In the example, the tuono-build-prod script fails and has a non-zero exit status. However, as the exit code is not checked, tuono build will report success and the error is not propagated.

❯ tuono build
Build successfully finished

❯ echo $?
0

Screenshots

No response

System Info

System:
    OS: Linux 6.6 NixOS 24.05 (Uakari) 24.05 (Uakari)
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-1370P
    Memory: 43.84 GB / 62.45 GB
    Container: Yes
    Shell: 5.2.32 - /run/current-system/sw/bin/bash
  Binaries:
    Node: 20.18.1 - /nix/store/wfxq6w9bkp5dcfr8yb6789b0w7128gnb-nodejs-20.18.1/bin/node
    Yarn: 1.22.22 - /project/crates/web/node_modules/.bin/yarn
    npm: 10.9.2 - /project/crates/web/node_modules/.bin/npm
  npmPackages:
    tuono: ^0.16.5 => 0.16.5

System info (Rust)

rustc 1.85.0-nightly (4d669fb34 2024-12-08)
cargo 1.85.0-nightly (20a443231 2024-12-06)
tuono 0.16.5

Additional context

Note that it would be helpful to add a check in each function invoking a script to first check whether the script exists.

E.g. in build_react_prod it would be helpful to first check whether the BUILD_JS_SCRIPT file exists. If not, a separate error message could inform the user that they first need to install node modules.

@pveierland pveierland added the bug Something isn't working label Jan 2, 2025
@Valerioageno Valerioageno added good first issue Good for newcomers rust Requires rust knowledge labels Jan 2, 2025
@marcalexiei marcalexiei moved this to Ready in Road to V1 Jan 2, 2025
@LeNei
Copy link
Contributor

LeNei commented Jan 12, 2025

I can take care of that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers rust Requires rust knowledge
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants