Hey there folks,
I wanted to give the heads up that a couple of library related features were just deployed to the IDE. These features are pretty straight forward but there are some concepts that merit deeper explanation and discussion.
Forkable library examples
If you have a core connected, you can now try a library without typing a single keystroke: click “use this example” then hit the flash button: boom, a binary being flashed to your core that exhibits the library in action.
We’re hoping library authors embrace this capability by including awesome example applications when they publish libraries. As we all know, usable documentation is great; but executable, editable documentation is better because it allows people to interact and see the magic in action.
Attention library authors: This feature is for you. Show how awesome your library is by documenting the required hardware and assembly instructions well in the README and providing kickass examples to illustrate how stellar your library is.
This feature was introduced to make it easier for people to test and verify that libraries work as expected before they publish them to the broader community. It is also the first step toward enabling a modern GitHub-style development flow for community library refinement.
When you hit the “contribute library” button, you’ll be taken to the same library validation page as before, however, instead of publishing them immediately after validation, you’ll “import” them–which makes the library usable within your apps (i.e. a private library).
After you’ve imported the library, you can give it whirl by simply clicking “use this example” on one of your library examples then hit the flash button. You can also include into an existing app just like a published library. If you need to make subsequent refinements to the library, you’ll need to bump the version up in the spark.json, commit some changes to the repo, hit the “contribute library” button again, and import it in again. You’ll then have a new library version you can test against.
Library development flow
To contextualize these features, the following describes the basic process of how you contribute a library, test it, and ship it publicly. As we enhance the library system in response to people’s feedback, our concept of development flow will evolve, but right now here is the happy path:
- Identify a need for code reuse or opportunity for code sharing in your applications.
- Click “Contribute Button”, add your GitHub repo containing your reusable code.
- Get your library code past the validator to that ensure it’s structured the way it needs to be.
- Click “Import” so you can use it in your apps.
- Use it, test it, flash apps with it, make sure it works as expected
- Click “Publish” so others can use it in their apps and flash your forkable library examples.
As always, please let us know what you think! We thrive on the feedback you guys provide us.