From 1e39e7dd6367ae2a56604a83083fa18cbf7534b9 Mon Sep 17 00:00:00 2001 From: wazint Date: Wed, 1 Mar 2023 23:06:44 +0200 Subject: [PATCH] doc: Fix dev guide for getting started with extensions --- docs/devs/extensions.md | 15 +++++++++------ docs/guide/extension-install.md | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/devs/extensions.md b/docs/devs/extensions.md index 5e5c2e8b..0dc75ddd 100644 --- a/docs/devs/extensions.md +++ b/docs/devs/extensions.md @@ -9,11 +9,14 @@ nav_order: 2 Making extensions ================= -Start off by copying the example extension in `lnbits/extensions/example` into your own: +Start off by cloning the [example extension](https://github.com/lnbits/example) into your `lnbits/extensions` folder and renaming it to `mysuperplugin`: ```sh -cp lnbits/extensions/example lnbits/extensions/mysuperplugin -r # Let's not use dashes or anything; it doesn't like those. -cd lnbits/extensions/mysuperplugin +cd lnbits/extensions +git clone https://github.com/lnbits/example.git --depth=1 mysuperplugin # Let's not use dashes or anything; it doesn't like those. +cd mysuperplugin +rm -rf .git/ find . -type f -print0 | xargs -0 sed -i 's/example/mysuperplugin/g' # Change all occurrences of 'example' to your plugin name 'mysuperplugin'. +mv templates/example templates/mysuperplugin # Rename templates folder. ``` - if you are on macOS and having difficulty with 'sed', consider `brew install gnu-sed` and use 'gsed', without -0 option after xargs. @@ -28,9 +31,9 @@ Going over the example extension's structure: Adding new dependencies ----------------------- -DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are availabe in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others. +DO NOT ADD NEW DEPENDENCIES. Try to use the dependencies that are available in `pyproject.toml`. Getting the LNbits project to accept a new dependency is time consuming and uncertain, and may result in your extension NOT being made available to others. -If for some reason your extensions must have a new python package to work, and its nees are not met in `pyproject.toml`, you can add a new package using `venv`, or `poerty`: +If for some reason your extensions must have a new python package to work, and its needs are not met in `pyproject.toml`, you can add a new package using `venv`, or `poerty`: ```sh $ poetry add @@ -39,7 +42,7 @@ $ ./venv/bin/pip install ``` **But we need an extra step to make sure LNbits doesn't break in production.** -Dependencies need to be added to `pyproject.toml` and `requirements.txt`, then tested by running on `venv` and `poetry` compatability can be tested with `nix build .#checks.x86_64-linux.vmTest`. +Dependencies need to be added to `pyproject.toml` and `requirements.txt`, then tested by running on `venv` and `poetry` compatibility can be tested with `nix build .#checks.x86_64-linux.vmTest`. SQLite to PostgreSQL migration diff --git a/docs/guide/extension-install.md b/docs/guide/extension-install.md index 7cae5900..ce421d3e 100644 --- a/docs/guide/extension-install.md +++ b/docs/guide/extension-install.md @@ -1,6 +1,6 @@ # Extension Install -Anyone can create an extension by following the [example extension](https://github.com/lnbits/lnbits/tree/extension_install_02/lnbits/extensions/example). +Anyone can create an extension by following the [example extension](https://github.com/lnbits/example) and [making extensions](https://github.com/lnbits/lnbits/blob/main/docs/devs/extensions.md) dev guide. Extensions can be installed by an admin user after the **LNbits** instance has been started. @@ -12,7 +12,7 @@ Go to `Manage Server` > `Server` > `Extensions Manifests` An `Extension Manifest` is a link to a `JSON` file which contains information about various extensions that can be installed (repository of extensions). -Multiple repositories can be configured. For more information check the [Manifest File](https://github.com/lnbits/lnbits/blob/extension_install_02/docs/guide/extension-install.md#manifest-file) section. +Multiple repositories can be configured. For more information check the [Manifest File](https://github.com/lnbits/lnbits/blob/main/docs/guide/extension-install.md#manifest-file) section. **LNbits** administrators should configure their instances to use repositories that they trust (like the [lnbits-extensions](https://github.com/lnbits/lnbits-extensions/) one).