flareact/flareact-template

Fresh install isn't working

joaumg opened this issue · 6 comments

Running the installation script fails on my machine...

λ joaumg [~] → wrangler generate foobar https://github.com/flareact/flareact-template    

 Creating project called `foobar`...
Error: liquid: Cannot read file
  with:
    path=/home/joaumg/foobar/public/favicon.ico

Error: tried running command:
/home/joaumg/.cache/.wrangler/cargo-generate-0.5.0/cargo-generate generate --git https://github.com/flareact/flareact-template --name foobar --force
exited with exit code: 1

Some extra info:

$ cargo -V
cargo 1.42.0 (86334295e 2020-01-31)
$ yarn -v
1.22.10
$ npm -v
7.9.0
$ wrangler --version
1.16.0
$ cat /etc/os-release
Debian 10 (buster)

Sorry I'm not a rust developer so I can't find out the reason, maybe caused by Wrangler.

I forked the template and remove favicon.ico, works fine.
If you want to keep the public directory, you can add a .gitkeep to the dir.

This is being caused by #2, would be great if it could be fixed.

A little bit of digging...

This doesn't happen because of the favicon on it's own. There is nothing wrong with the favicon.
The issue is when cargo-generate runs, it trys to open the file for possible liquid template substitutions ...
And since the favicon.ico is a binary... well... that doesn't end well (;
Upstream issue: cargo-generate/cargo-generate#204

The most straightfoward solution here is to add the favicon.ico to the .genignore as documented in cargo-generate README.

https://crates.io/crates/cargo-generate

You can also add a .genignore file to your template. The files listed in the .genignore file will be removed from the local machine when cargo-generate is run on the end user's machine. The .genignore file is always ignored, so there is no need to list it in the .genignore file.

Good digging.

The problem I guess is that adding favicon.ico to .genignore would mean it wouldn't get included in the new project, which was what #2 tried to achieve.

The cargo-generate issue has been around since 2019, and there's no sign of an imminent fix, seems like removing favicon.ico would be the quickest fix in this repo?

Well. I would try using .genignore first and seeing the result.
There is also the possibility of using Include / Exclude (on cargo-generate readme).
And sure, in last case, the favicon.ico could be removed.

But I'm not that familiar with rust yet.

Thanks y'all. I'll revert this morning until there is a better solution!