seed-rs / seed-quickstart Goto Github PK
View Code? Open in Web Editor NEWBare essentials to start a Seed app.
Home Page: https://seed-rs.org/
Bare essentials to start a Seed app.
Home Page: https://seed-rs.org/
Line 18 in a00625a
On mac when cloning and then cargo make serve
I get the following error on Chrome and Firefox:
The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
error: Found argument '--out-name' which wasn't expected, or isn't valid in this context
Did you mean --out-dir?```
Every single file is marked as executable, when none of them should be.
Cargo generate is a cargo subcommand for templating new projects.
Integrating with it should only require a few changes to cargo.toml and then anyone who uses cargo-generate will be happy :)
I'd like to make a pull request for these.
Example usage of cargo generate to use this quickstart:
cargo generate --git https://github.com/seed-rs/seed-quickstart --name my-new-seed-project
Related PR from Seed repo: seed-rs/seed#185
quickstart's Makefile.toml
:
[tasks.create_wasm]
description = "Build with wasm-pack"
install_crate = "wasm-pack"
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package", "--dev"]
[tasks.create_wasm_release]
description = "Build with wasm-pack"
install_crate = "wasm-pack"
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package"]
also quickstart's Makefile.toml
:
[tasks.test]
description = "Run tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]"
clear = true
workspace = false
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
command = "wasm-pack"
args = ["test", "--${@}"]
See install_crate
. The first two tasks should be probably updated with
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
RealWorld example is based on this quickstart, so I want to write a list of changes / missing features before I forget:
Makefile.toml
doesn't make sense in quickstart's context (e.g. "Run Seed's tests. Ex:..").clippy
, fmt
, verify
, verify_only
, ..rustfmt.toml
, .travis.yml
and maybe netlify.toml
.wasm-bindgen-test
is missing in dev-dependencies
.cargo make watch
builds before starting watcher so its annoying if you have more compilation errors and want to start watcher for easier debugging.*.wasm
size (it's possible to strip several hundred of KBs):
opt-level
should be s
or z
).wasm-pack
. Or it can be probably installed with cargo-make
. I'm using NodeJS API wrapper - see this script in seed-quickstart-webpack
.this commit updates the seed crate to 0.6.0 or later. There is no 0.6.0 crate released as of time of writing. This commit should be reverted or moved to a working branch until 0.6.0 is out.
Nice addition. Ideally, it would automatically install cargo-watch, but I've been unable to get it to do so; must install explicitly before.
I tried to uninstall cargo-watch
and then run cargo make watch
- it fails with a cargo-watch
compilation error, because cargo-make
installs version 7.0.8
(see source code) which seems to be buggy. The latest version 7.2.1
works for me.
[tasks.watch]
description = "Build, and create wasms, then watch files for changes"
workspace = false
dependencies = ["build", "create_wasm"]
watch = { ignore_pattern="pkg/*", version="7.2.1" }
If it's working for you as well, please, create issue in cargo-make repo.
What command do I run to generate a folder I can plop on a webserver and show others what I've built?
The website provides more context and referring to that could could prevent duplication issues.
The Readme in this repo could serve for more conceptual content, with things like instructions, guides, etc., managed from the site and linked to.
I think using this pattern doesn't make it obvious for how users might expand on the example. If a user does decide to use a struct as their model, the code written in update and view also need to updated, while not always obvious. For example, a user might try to do this:
struct Model {
name: String,
}
fn view(model: &Model) -> Node<Msg> {
div![
button![model],
]
}
...and not realize that you can't use model in this way as you could when it was a type alias. I think more modular the first example is the best it is for the user experience.
cargo make watch
in the terminal, then, so many errors occurs, like this, error[E0425]: cannot find value `IPV6_V6ONLY` in this scope
--> C:\Users\zh\.cargo\registry\src\github.com-1ecc6299db9ec823\net2-0.2.34\src\ext.rs:871:50
|
871 | get_opt(self.as_sock(), v(IPPROTO_IPV6), IPV6_V6ONLY).map(int2bool)
| ^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value `SOL_SOCKET` in this scope
--> C:\Users\zh\.cargo\registry\src\github.com-1ecc6299db9ec823\net2-0.2.34\src\ext.rs:879:33
|
879 | get_opt(self.as_sock(), SOL_SOCKET, SO_ERROR).map(int2err)
| ^^^^^^^^^^ not found in this scope
Example:
[tasks.build_dist]
description = "Build with wasm-pack in release mode and move important files to dist folder"
dependencies = ["build_release"]
script = [
'''
#!@duckscript
rm -r dist
mkdir dist
cp public dist
cp netlify.toml dist/netlify.toml
cp index.html dist/index.html
cp pkg/package.js dist/pkg/package.js
cp pkg/package_bg.wasm dist/pkg/package_bg.wasm
'''
]
Hello, guys. I'm not very js-guy, and I have tried to make a little project with a seed library and publish it as a github.io page.
And i know, that it is not a seed bug, but can you help me to understand, how to import the package.js correct way? Every time I have 404 error because of when i opens my github.io page from the browser, it is makes next get request for package.js:
GET https://ivmazurenko.github.io/pkg/package.js
But as I understands, it should make
GET https://ivmazurenko.github.io/protodec/pkg/package.js
So, I have an next structure:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="css/new.css">
<link rel="stylesheet" href="css/app.css">
</head>
<body>
<section id="app"></section>
<script type="module">
import init from '/pkg/package.js';
init('/pkg/package_bg.wasm');
</script>
</body>
</html>
And the pkg directory in entire repository is published like this:
.
├── build.rs
├── Cargo.lock
├── Cargo.toml
├── css
│ ├── app.css
│ └── new.css
├── index.html
├── Makefile.toml
├── pkg
│ ├── package_bg.d.ts
│ ├── package_bg.wasm
│ ├── package.d.ts
│ ├── package.js
│ ├── package.json
│ └── README.md
├── README.md
└── src
https://github.com/ivmazurenko/protodec is a my pet project, currently my problem is reproducing on it. So, if you can help a little, it will be very nice.
Thanks for any answers!
Hi!
I try to build the example
cargo build --target wasm32-unknown-unknown
and I got the error:
error[E0107]: wrong number of type arguments: expected 2, found 1
--> src/lib.rs:29:38
|
29 | fn update(msg: Msg, model: Model) -> Update<Model> {
| ^^^^^^^^^^^^^ expected 2 type arguments
error: aborting due to previous error
For more information about this error, try `rustc --explain E0107`.
error: Could not compile `appname`.
git clone https://github.com/David-OConnor/seed-quickstart
cd seed-quickstart/
git checkout 2980c62f9f866c3e3e43fddcf13e8add1542036e
cargo make serve
I have run cargo clean
, and tried to do cargo c
multiple times.
Even desperately restart my machine (sometimes works if there is a problem with cargo).
Now it doesn't.
Am I missing something?
seed-quickstart on master [!] is 📦 v0.1.0 via 🦀 v1.50.0 took 53s
❯ cargo c
Checking cfg-if v1.0.0
Compiling libc v0.2.81
Checking itoa v0.4.7
Checking futures-sink v0.3.8
Checking futures-core v0.3.8
Checking once_cell v1.5.2
Checking futures-io v0.3.8
Checking ppv-lite86 v0.2.10
Checking pin-utils v0.1.0
Checking slab v0.4.2
Checking unicode-width v0.1.8
Checking hashbrown v0.9.1
Checking cfg-if v0.1.10
Checking percent-encoding v2.1.0
Checking enclose v1.1.8
Compiling wasm-bindgen v0.2.69
Compiling getrandom v0.1.16
Compiling memchr v2.3.4
Compiling proc-macro-nested v0.1.6
Checking futures-channel v0.3.8
Compiling bitflags v1.2.1
Compiling pulldown-cmark v0.8.0
Checking futures-task v0.3.8
Compiling unicase v2.6.0
Compiling time v0.2.23
Compiling cookie v0.14.3
Compiling seed v0.8.0
Compiling log v0.4.11
Checking ryu v1.0.5
Compiling const_fn v0.4.5
Compiling indexmap v1.6.1
error: unexpected closing delimiter: `}`
--> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.11/src/macros.rs:181:1
|
147 | macro_rules! debug {
| - this opening brace...
...
154 | }
| - ...matches this closing brace
...
181 | }
| ^ unexpected closing delimiter
error: aborting due to previous error
error: could not compile `log`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
The seed
README recommends using trunk to quickstart, but this template doesn't use it. If you do use trunk
, much of this template is unnecessary: index.html
can be much simpler, Makefile.toml
can just be deleted, and you can use a binary project instead of a cdylib
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.