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

Add a CLI check that all the tuono versions in the projects are aligned #406

Closed
marcalexiei opened this issue Jan 22, 2025 · 6 comments
Closed
Labels
rust Requires rust knowledge

Comments

@marcalexiei
Copy link
Member

marcalexiei commented Jan 22, 2025

Within a tuono app, there are plenty of reference to the tuono:

  • the tuono CLI
  • the tuono crate in Cargo.toml
  • the tuono package in package.json

In order to prevent wrong mismatch between packages/CLI versions, we could add warning on tuono build and tuono dev command to highlight such a mismatch.

Additional context

@marcalexiei marcalexiei converted this from a draft issue Jan 22, 2025
@marcalexiei marcalexiei added the rust Requires rust knowledge label Jan 22, 2025
@jacobhq
Copy link
Contributor

jacobhq commented Jan 23, 2025

Can I look into this one?

@marcalexiei
Copy link
Member Author

marcalexiei commented Jan 24, 2025

Yes,
before starting your work I would like to add a consideration:

we could add warning on tuono build and tuono dev command to highlight such a mismatch.

The warning is not blocking,
however to avoid version mismatch in CI environment (like #404)
an error would be more appropriate IMHO since it will cause the CI to fail.

Solution 1

  • Add the warning to tuono dev and tuono lint
  • Add a new command tuono check (?) that performs preflight checks.
    (At the current status only version consistency will be checked)

Solution 2

Add --check-version CLI argument on tuono dev and tuono build
If set to version mismatch throws an error, otherwise it logs a warning.

Solution 3

Starting setup a check (?) config option.
The first available option inside check will be versionMismatch (?)
If set to true version mismatch throws an error, otherwise it logs a warning.

I would consider to set this option to true by default.

// tuono.config.ts
import type { TuonoConfig } from 'tuono/config'

const config: TuonoConfig = {
  // ...
  check: {
    versionMismatch: true,
  }
}

export default config

Additional features related to this approach:

  • add --no-checks on tuono dev and tuono build to avoid / override config checks
  • add new tuono check which will just perform the check without running additional commands

I personally like solution 3 because gives us more space for additional checks in the future.

Let me know what do you think about this!

@Valerioageno
Copy link
Member

Valerioageno commented Jan 24, 2025

Hey guys! I'd descope this task since next in line for development for the CLI are:

@marcalexiei
Copy link
Member Author

I moved this issue and all the relevant content inside a "Add a CLI check that all the tuono versions in the projects are aligned" draft item of V1 project

@marcalexiei marcalexiei closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in Road to V1 Jan 24, 2025
@jacobhq
Copy link
Contributor

jacobhq commented Jan 29, 2025

I think we should add some kind of remedy for this, especially since old CLI versions don't work in new tuono projects.

Demo repro (from 'apps/documentation`):

cargo install --version 0.17.5 tuono
tuono dev

This gives an error (docs currently on 0.17.6)

error[E0599]: no method named `start` found for opaque type `impl Future<Output = tuono_lib::Server>` in the current scope
  --> .tuono/main.rs:27:32
   |
27 |     Server::init(router, MODE).start().await
   |                                ^^^^^ method not found in `impl Future<Output = Server>`
   |
help: consider `await`ing on the `Future` and calling the method on its `Output`
   |
27 |     Server::init(router, MODE).await.start().await
   |                                ++++++

For more information about this error, try `rustc --explain E0599`.
error: could not compile `tuono` (bin "tuono") due to 1 previous error

Maybe we should do this after we've finished writing the rest of the docs?

@Valerioageno
Copy link
Member

Yeah, when there are breaking changes in the CLI/server contract, it is very easy that a version mismatch breaks the build.
Thanks for raising! I'm refactoring the prioritization framework, but the task is already in the backlog!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Requires rust knowledge
Projects
Status: Done
Development

No branches or pull requests

3 participants