schultek / jaspr

Modern web framework for building websites in Dart. Supports SPAs and SSR.
https://jasprpad.schultek.de
MIT License
1k stars 59 forks source link

fix: jaspr create client incomplete #143

Closed Tienisto closed 4 months ago

Tienisto commented 7 months ago

Description

After running jaspr create my_project, then selecting client, the command jaspr generate fails with the following error:

[CRITICAL] Cannot find entry point. Create a main.dart in lib/ or web/, or specify a file using --input.

This is strange. Here is the generated web/main.dart file:

// any .dart file inside the /web directory is compiled bundled to javascript
// and executed in the browser

// browser-specific jaspr import
import 'package:jaspr/browser.dart';

import 'package:my_project/app.dart';

void main() {
  // attaches the [App] component to the <body> of the page
  // - attachment target can be changed using the [attachTo] parameter of [runApp]
  runApp(App());
}

Also, the generated pubspec.yaml misses the jaspr_builder dependency I think.

Steps To Reproduce

  1. jaspr create my_project
  2. select client
  3. select one of both options
  4. run jaspr generate
  5. it fails

Doctor Output

[✓] Flutter (Channel stable, 3.16.1, on macOS 14.1.1 23B81 darwin-arm64, locale de-DE)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.4)
[✓] VS Code (version 1.84.2)
[✓] Connected device (2 available)
[✓] Network resources

Expected Behavior

Should run successfully.

Additional Context

cybertheory commented 6 months ago

I face the same issue, although I fixed it by using the classic template or specifying a path with --input

schultek commented 6 months ago

The client template is for client-side-rendering only, so jaspr generate which tries to do static site generation (which is a subform of server-side-rendering) natually won't work.

But I can do a better job communicating this in the docs and cli.