8000 Improve standalone emulator run cli by baileyluTCD · Pull Request #146 · wokwi/rp2040js · GitHub
[go: up one dir, main page]

Skip to content

Improve standalone emulator run cli #146

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

baileyluTCD
Copy link

Recently (in #143), the npm start script gained the ability to have a --image flag passed. I believe this functionality would be quite useful as a standalone packaged program, and hence am in the process of packaging for nix.

To that end, this pull request implements:

  • --help and --version flags for demo/emulator-run.ts to improve the general user experience from the command line.
  • A npm run build:demo script with it's own tsconfig.demo.json for building/running demo scripts as their own programs.

@urish
Copy link
Contributor
urish commented Jun 8, 2025

Thanks for the PR!

Note that there are some formatting issues with the modified code, please run prettier to fix them.

Also, note that we are not married to minimist - alternatives such as Commander.js or meow do stuff like handling --help automatically.

@urish urish added the enhancement New feature or request label Jun 8, 2025
@baileyluTCD baileyluTCD force-pushed the improve-standalone-emulator-run-cli branch from 8a6c19c to 8a4074e Compare June 8, 2025 20:05
@baileyluTCD
Copy link
Author

Note that there are some formatting issues with the modified code, please run prettier to fix them.

Should be fixed now, prettier did not support the 9775 with { type: "json" } addendum for imports hence I removed it.

Also, note that we are not married to minimist - alternatives such as Commander.js or meow do stuff like handling --help automatically.

In light of this I switched over to sade which does have automatic handling of --help and --version and as a bonus actually a smaller bundle size than minimist did.

Additionally you should note that if the original tsconfig.json and build scripts are modified a bit you could support npx rp2040js with the bin field of the package.json with very little effort, I'm happy to implement this here too if desired to make it easier for others to use directly from npm.

@baileyluTCD
Copy link
Author

I also applied similar changes to the micropython-run file too and did a minor bit of code refactoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0