-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
Tauri right now assumes that its source always live in a src-tauri folder.
To Reproduce
- Take any valid Tauri app.
- Rename the
src-taurifolder to anything else. - Try to run any command like
cargo tauri devorcargo tauri build.
Expected behavior
The application builds as usual.
Screenshots
N/A.
Platform and Versions (required):
Operating System - Windows, version 10.0.19043 X64
Webview2 - 93.0.961.52
Node.js environment
Node.js - 16.9.1
@tauri-apps/cli - 1.0.0-beta.10
Global packages
npm - 7.24.0
yarn - 1.22.11
Rust environment
rustc - 1.54.0
cargo - 1.54.0
Additional context
We use Tauri in our monorepo of Rust code which contains many binaries, several of which are actually Tauri applications. Their frontends are generated in various ways and not tied to a particular frontend framework (like vue.js for instance).
My understanding is that Tauri assumes so far that it lives on top of an existing frontend code but there seem to be no strong technical reason why it couldn't be considered as an entrypoint that just loads an opaque dist folder of web-related files.
To give some context, our current Rust repository structure looks like:
lib/
...
client/
editor/ <-- Tauri app.
Cargo.toml
tauri.conf.json
src/
frontend/ <-- Root of the web frontend project.
dist/ <-- Compiled web files.
package.json
node_modules/
...
...
viewer/ <-- Another Tauri app.
...
compiler/ <-- A Rust app, but not a Tauri one.
Cargo.toml
src/
...
...
merger/
...
...
Any attempt to run cargo tauri dev or cargo tauri build in that structure yields an error, as this line clearly expects the Cargo.toml and associated Rust directory-structure to be under a src-tauri-named folder.
While we could technically add an extra folder on top of all Tauri-based clients, we'd like to avoid it as:
- It breaks symmetry with the other clients that are not Tauri-based.
- It really doesn't look nice from a cosmetic PoV.
Are we attempting something that just should not be done and are we missing obvious reasons why it cannot work ?
I wonder if just looking for the first folder that contains the tauri.conf.json file, regardless of whether it is actually called src-tauri instead would work equally well, while permitting more liberal directory structures.
If that's a scenario that you think should be supported, I'd be more than happy to contribute to this awesome project and make the necessary changes and PRs to make this happen. Let me know!
Stack Trace
PS C:\Users\<redacted>\monorepo\client\editor> cargo tauri dev
thread 'main' panicked at 'Couldn't recognize the current folder as a Tauri project.', src\helpers\app_paths.rs:29:3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace