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

docs: fix end-to-end example #386

Merged
merged 6 commits into from
Feb 28, 2024
Merged

docs: fix end-to-end example #386

merged 6 commits into from
Feb 28, 2024

Conversation

guybedford
Copy link
Collaborator

@guybedford guybedford commented Feb 28, 2024

This makes the existing example use ComponentizeJS to create the demo component so that it is a fully runnable end to end example.

Resolves #278.

@bakkot
Copy link

bakkot commented Feb 28, 2024

Nice! Went through it. Ran into the following problems:

  • Following the "install" instructions in the main readme will not put jco on your path, so the commands which say to run jco will not work. Users either need to install -g, or prefix all jco commands with npx, as in npx jco componentize cowsay.js --wit cowsay.wit -o cowsay.wasm.
  • The first time you run componentize it will fail and tell you that you need to run npm install @bytecodealliance/componentize-js.
  • Running the test file will fail because it's trying to import from a file (./cowsay/cowsay.js) which ends in .js, which npm treats as cjs by default. Users either need to be told to create a package.json with "type": "module" (as in the ComponentizeJS example), or the code could generate one, or (my preference) the code could generate .mjs files instead of .js.

(Also, typo "lets create" -> "let's create")

@guybedford
Copy link
Collaborator Author

Thanks for taking a look, added some install instructions and type: module instructions.

docs/src/example.md Outdated Show resolved Hide resolved
docs/src/example.md Outdated Show resolved Hide resolved
Copy link

@bakkot bakkot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following this as written worked for me and produced the claimed output. Much nicer!

docs/src/example.md Outdated Show resolved Hide resolved
@guybedford guybedford merged commit 2ac8263 into main Feb 28, 2024
8 checks passed
@guybedford guybedford deleted the docs-example branch February 28, 2024 01:08
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

Successfully merging this pull request may close these issues.

Current example provided in docs isn't very beginner-friendly
2 participants