Skip to content

Commit 6378e27

Browse files
committed
[FEATURE] improve link with perses script to support linking plugins
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
1 parent 6f883e6 commit 6378e27

2 files changed

Lines changed: 216 additions & 80 deletions

File tree

README.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,68 @@ npm run reinstall
8585
npm run clear-turbo-cache
8686
```
8787

88-
### Linking with the Perses UI
88+
### Linking with Local Projects
8989

90-
To link these shared libraries with your local Perses UI development environment, use the provided script:
90+
To link these shared libraries with your local Perses UI or plugins development environment, use the provided script:
9191

9292
```bash
9393
./scripts/link-with-perses/link-with-perses.sh
9494
```
9595

96-
The script will back up your current dependencies, build and link the shared libraries for local development. It will search for the Perses UI app as a sibling directory by default. See the script helper for more details:
96+
The script will back up your current dependencies, build and link the shared libraries for local development. By default, it will search for the Perses UI app as a sibling directory. You can also link with plugins by using the `--plugins` flag.
97+
98+
For detailed usage information:
9799

98100
```bash
99101
./scripts/link-with-perses/link-with-perses.sh --help
100102
```
101103

104+
Common commands:
105+
106+
```bash
107+
# Link with Perses UI (default, sibling directory at ../perses)
108+
./scripts/link-with-perses/link-with-perses.sh link
109+
110+
# Link with Perses UI at custom location
111+
./scripts/link-with-perses/link-with-perses.sh link --perses ~/projects/perses
112+
113+
# Link with plugins (sibling directory at ../plugins)
114+
./scripts/link-with-perses/link-with-perses.sh link --plugins
115+
116+
# Link with plugins at custom location
117+
./scripts/link-with-perses/link-with-perses.sh link --plugins ~/projects/plugins
118+
119+
# Check link status
120+
./scripts/link-with-perses/link-with-perses.sh status --plugins
121+
122+
# Unlink
123+
./scripts/link-with-perses/link-with-perses.sh unlink
124+
```
125+
102126
> [!WARNING]
103-
> As the shared dependencies are file references, you cannot build the Perses UI for production while linked to local shared libraries. Make sure to unlink the shared libraries before building for production.
127+
> As the shared dependencies are file references, you cannot build for production while linked to local shared libraries. Make sure to unlink the shared libraries before building for production.
104128
105-
#### Regular workflow
129+
#### Workflow for Perses UI Development
106130

107131
1. Clone the perses repo [https://github.com/perses/perses](https://github.com/perses/perses)
108132
2. From the perses `ui` folder install the ui dependencies with `npm install`.
109133
3. From the perses root folder, start the Perses API in dev mode with `./scripts/api_backend_dev.sh`.
110134
4. Clone this shared repo and install dependencies with `npm install`. ⚠️ Do not rename the cloned repo, otherwise it breaks the paths resolution on the perses repo side.
111-
5. From the shared root folder, run `./scripts/link-with-perses/link-with-perses.sh`. If your perses repo is in a different location than a sibling directory, use the `--path` option to specify its location.
135+
5. From the shared root folder, run `./scripts/link-with-perses/link-with-perses.sh link`. If your perses repo is in a different location than a sibling directory, use the `--perses` option to specify its location.
112136
6. From the perses `ui/app` folder, run `npm run start:shared` to start the Perses UI in dev mode using the linked shared libraries with hot module reloading.
113137
7. Make changes to the shared libraries and see them reflected in your local Perses UI.
114138
8. When done, run `./scripts/link-with-perses/link-with-perses.sh unlink` to restore the original dependencies in the Perses UI.
115139

140+
#### Workflow for Plugins Development
141+
142+
1. Clone the plugins repo [https://github.com/perses/plugins](https://github.com/perses/plugins)
143+
2. From the plugins root folder install dependencies with `npm install`.
144+
3. Clone this shared repo and install dependencies with `npm install`.
145+
4. From the shared root folder, run `./scripts/link-with-perses/link-with-perses.sh link --plugins`. If your plugins repo is in a different location than a sibling directory, use the `--plugins` option with the custom path.
146+
5. From the plugins root folder, run the appropriate development command for your plugin.
147+
6. Make changes to the shared libraries and see them reflected in your plugins.
148+
7. When done, run `./scripts/link-with-perses/link-with-perses.sh unlink --plugins` to restore the original dependencies in the plugins repo.
149+
116150
## Contributing
117151

118152
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our development process and how to submit pull requests.

0 commit comments

Comments
 (0)