-
My goal is: When using the mongoose-os mjs app environment, I see list of libraries (thru ‘mos ls’ command) that are added to the device while flashing the code. I want to remove/stop the compiler from adding the libraries to my code.
-
My actions are: I have tried fiddling with the mos.yml file. I tried to remove the library
- origin: https://github.com/mongoose-os-libs/js-demo-bundle
(because I think it adds all the libraries in bundle) and tried to include the github paths of the only libraries that i am using such as
-
The result I see is: The result shows some error with file fetching thru build_ctx file.
-
My expectation & question is: I just want to remove the libraries that I am not using and only add the one which I am using in my code. I tried to build both online and local but with no luck. Please guide me.
Try to manually delete with mos rm filename
all modules you won’t use and then build with --clean
flag and flash, maybe it works
Thanks for the suggestion. I think that when we give mos rm , it just removes the file from the device itself and does not affect the build configuration/files. I tried your suggestion but it did not work.
Ok, next suggestion: maybe the cause is in the mos.yml - section config_schema? Try to remove i2c.enable if you not include path to i2c lib)
I am afraid that might not work as config schema is just for setting configurations . Perhaps @nliviu can guide us here on how to remove libraries…
I always include in my applications the following libraries:
libs:
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/rpc-ws
- origin: https://github.com/mongoose-os-libs/wifi
- origin: https://github.com/mongoose-os-libs/sntp
- origin: https://github.com/mongoose-os-libs/ota-http-server
rpc-*
for the RPC services over uart and websocket, wifi
for network connectivity, sntp
for time synchronization, ota-http-server
to push OTA updates after the first flash of the application.
If I need mqtt, I add in the libs
section
- origin: https://github.com/mongoose-os-libs/mqtt
and in the config_schema
- ["mqtt.enable", true]
- ["mqtt.server", "my_mqtt_server:port"] #port may be omitted. It defaults to 1883
If I need i2c
and/or spi
, I add the library, enable it and add the pin definitions.
E.g:
- ["i2c.enable", true]
conds:
- when: mos.platform == "esp32"
apply:
config_schema:
- ["i2c1.enable", false]
- ["i2c.sda_gpio", 32]
- ["i2c.scl_gpio", 33]
- when: mos.platform == "esp8266"
apply:
config_schema:
- ["i2c.sda_gpio", 12]
- ["i2c.scl_gpio", 14]
I think I found what you need: https://github.com/mongoose-os-libs/mjs/issues/5 (see case and example)