It’s now possible to publish libraries using the CLI. Those libraries must be in the library 2.0 format
To create a new library, do particle library init
in an empty directory and follow the prompts.
To publish a new version of an existing library, migrate it to 2.0 format with particle library migrate
Since the new library format is compatible with Arduino, you should be able to clone an Arduino library, make minor modifications for platform differences and publish it as a Particle library.
Update the source files for the library in src/
and the examples in examples/
.
To try the library in your own project before publishing it, copy-paste or symbolic link the entire library directory inside the lib/
directory of your project like so:
+- lib
| +- MyLibrary
| +- src
| | +- MyLibrary.h
| | +- MyLibrary.cpp
| +- library.properties
+- src
| +- my_project_test.cpp
+- project.properties <-- mandatory for extended project, even if blank
Compile your project with the library copy like any other project:
particle compile photon .
When the library works, you can contribute a private version of the library that only you can use.
particle library contribute
particle library upload
At this point you can add your new library to one of your projects with
particle library add my_library
When you tested the private version, go ahead and publish the library to be used by others.
particle library publish my_library
Note 1: nobody else can use a library you contributed until you publish it.
Note 2: you won’t see the new version of the library in Build until we deploy a new version with libs 2.0 support.
Go ahead and give this a whirl and let me know if something is weird.