Skip to content

Commit 7ca79e8

Browse files
committed
docs: udpate dev guide, working with our dependencies
1 parent f08f89e commit 7ca79e8

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

docs/development_guide.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ Access to fetch at 'http://localhost:3001/v1/torrents?page_size=50&page=0&sort=U
120120

121121
You need to enable the Cors layer with the permissive option setting the environment variable `TORRUST_INDEX_API_CORS_PERMISSIVE` to `true`.
122122

123+
For example:
124+
125+
```console
126+
TORRUST_INDEX_API_CORS_PERMISSIVE=true cargo run
127+
```
128+
123129
## Run the Index GUI
124130

125131
Requirements:
@@ -170,6 +176,47 @@ npm run build && npm run preview
170176

171177
More information about the [nuxt][nuxt] command can be found [here][nuxt_commands].
172178

179+
### Working with Torrust Dependencies
180+
181+
We have two internal dependencies:
182+
183+
- [torrust-index-types-lib](https://github.com/torrust/torrust-index-types-lib): Basic TypeScript types for the Index API.
184+
- [torrust-index-api-lib](https://github.com/torrust/torrust-index-api-lib): A wrapper in TypeScript for the INdex API.
185+
186+
Sometimes when the Index API changes, it might be useful to test the Index GUI with the new packages versions at the same time before releasing new versions for these packages. You could even be working on the Index API, the Index GUI and these packages at the same time if the feature requires changes in the API.
187+
188+
There are two ways of using local packages with NPM:
189+
190+
- [npm link](https://docs.npmjs.com/cli/v10/commands/npm-link).
191+
- [npm install](https://docs.npmjs.com/cli/v10/commands/npm-install).
192+
193+
We will describe the `npm install` option.
194+
195+
It's possible to install a local dependency by using its path:
196+
197+
```console
198+
npm install --save ../torrust-index-api-lib
199+
npm install --save ../torrust-index-types-lib
200+
```
201+
202+
After running those commands your `package.json` will have:
203+
204+
```json
205+
{
206+
"name": "torrust-index-gui",
207+
"dependencies": {
208+
"torrust-index-api-lib": "file:../torrust-index-api-lib",
209+
"torrust-index-types-lib": "file:../torrust-index-types-lib",
210+
}
211+
}
212+
```
213+
214+
And your `node_modules` should have symbolic links for these packages.
215+
216+
You can start changing any project. You will need to rebuild the dependency (`npm run build`) any time you make a change. If you are using `npm run dev` for the Index GUI you won't need to do anything else.
217+
218+
> Warning: You can't push these changes in the `package.json`. Once you are done you have to release a new package version and update the `package.json`.
219+
173220
## Testing
174221

175222
### Unit tests

0 commit comments

Comments
 (0)