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

Client (configures assets for frontend serving) #858

Closed
nagashi opened this issue Oct 17, 2024 · 2 comments
Closed

Client (configures assets for frontend serving) #858

nagashi opened this issue Oct 17, 2024 · 2 comments

Comments

@nagashi
Copy link

nagashi commented Oct 17, 2024

Description
According to the documentation at https://loco.rs/docs/getting-started/guide/? , the user is instructed to run the command loco newand make the following choices:
✔ ❯ App name? · myapp
✔ ❯ What would you like to build? · SaaS app (with DB and user auth)
✔ ❯ Select a DB Provider · Sqlite
✔ ❯ Select your background worker type · Async (in-process tokio async tasks)
✔ ❯ Select an asset serving configuration · Client (configures assets for frontend serving)

According to the doc, the next instructions are:
You can now switch to to myapp: (to to myapp should be to myapp)

$ cd myapp
Starting the server
cargo loco start

After running local new and making the stated selections, Loco app generated successfully, however, I received the output "- assets: You've selected clientside for your asset serving configuration (remember to build your frontend in frontend/) " I had no clue what this line meant. After some time, I just happened to go into the config directory and look at development.yaml. It was there, under (2) Client side app static config, that I saw the following task I needed to perform:
Note that you need to go in frontend and run your frontend build first, e.g.: $ npm install & npm build. By the way, npm build should be changed to npm run build.

To Reproduce

Expected Behavior

Provide a straightforward and brief explanation of your anticipated outcome.
The following piece of information would be helpful in the doc/ the output after selecting "Client (configures assets for frontend serving)" ,
Note that you need to go to the frontend directory and run your frontend build first, e.g.: $ npm install & npm run build.

Environment:
My OS is a Mac, which is up to date. Rust version is 1.81.0 (not nightly), loco-cli version is 0.2.9 with loco-rs version 0.10.1. My dependencies are as follows:
[dependencies]

loco-rs = { version = "0.10.1" }
migration = { path = "migration" }

serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1.33.0", default-features = false }
async-trait = "0.1.74"
tracing = "0.1.40"
chrono = "0.4"
validator = { version = "0.18" }
sea-orm = { version = "1.0.0", features = [
"sqlx-sqlite",
"sqlx-postgres",
"runtime-tokio-rustls",
"macros",
] }

axum = "0.7.5"
include_dir = "0.7"
uuid = { version = "1.6.0", features = ["v4"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }

view engine i18n

fluent-templates = { version = "0.8.0", features = ["tera"] }
unic-langid = "0.9.4"

/view engine

[[bin]]
name = "myapp-cli"
path = "src/bin/main.rs"
required-features = []

[[bin]]
name = "tool"
path = "src/bin/tool.rs"
required-features = []

[dev-dependencies]
serial_test = "3.1.1"
rstest = "0.21.0"
loco-rs = { version = "0.10.1", features = ["testing"] }
insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] }

Additional Context

I find this framework enjoyable and look forward to learning more about it. Let me know if there's anything in my submittals that I can do to make your life easier. Thanks.

@isaacdonaldson
Copy link
Contributor

I mentioned on your other issue, but it's very hard to read unformatted code blocks.

In terms of what you described, there is a line: You've selected clientside for your asset serving configuration (remember to build your frontend in frontend/) that does tell you to build your frontend for the Client option. This is after you run your loco new step. It will also throw on error on startup if you have not built it, so there are a couple reminders.

That being said, I do agree that the documentation should also say it, so I opened a PR a while back that added some clarity around the loco new options, but it has not been merged yet: #795

@nagashi
Copy link
Author

nagashi commented Oct 19, 2024

Thanks Issac. I didn't know to look in the frontend directory. According to the README.md file in the frontend directory, I just have to run pnpm build to get the app running successfully. is that correct?

@nagashi nagashi closed this as completed Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants