Skip to content

Commit 2c95b1b

Browse files
brichetjtpio
andauthored
Add a section to use local dependencies (#7292)
* Add a section to use local dependencies * prettier * Syntax Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com> * Update CONTRIBUTING.md Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com> * Update CONTRIBUTING.md Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com> * Update CONTRIBUTING.md Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com> * Update CONTRIBUTING.md Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com> --------- Co-authored-by: Jeremy Tuloup <jeremy.tuloup@gmail.com>
1 parent c66e6ad commit 2c95b1b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,40 @@ Then start Jupyter Notebook with:
6666
jupyter notebook
6767
```
6868

69+
### Local changes in Notebook dependencies
70+
71+
The development installation described above fetches JavaScript dependencies from [npmjs](https://www.npmjs.com/),
72+
according to the versions in the _package.json_ file.
73+
However, it is sometimes useful to be able to test changes in Notebook, with dependencies (e.g. `@jupyterlab` packages) that have not yet
74+
been published.
75+
76+
[yalc](https://github.com/wclr/yalc) can help use local JavaScript packages in your build of
77+
Notebook, acting as a local package repository.
78+
79+
- Install yalc globally in you environment:
80+
`npm install -g yalc`
81+
- Publish you dependency package:\
82+
`yalc publish`, from the package root directory.\
83+
For instance, if you have are developing on _@jupyterlab/ui-components_, this command must be executed from
84+
_path_to_jupyterlab/packages/ui-components_.
85+
- Depend on this local repository in Notebook:
86+
- from the Notebook root directory:\
87+
`yalc add your_package` : this will create a _dependencies_ entry in the main _package.json_ file.\
88+
With the previous example, it would be `yalc add @jupyterlab/ui-components`.
89+
- Notebook is a monerepo, so we want this dependency to be 'linked' as a resolution (for all sub-packages) instead
90+
of a dependency.\
91+
The easiest way is to manually move the new entry in _package.json_ from _dependencies_ to _resolutions_.
92+
- Build Notebook with the local dependency:\
93+
`jlpm install && jlpm build`
94+
95+
Changes in the dependency must then be built and pushed using `jlpm build && yalc push` (from the package root directory),
96+
and fetched from Notebook using `yarn install`.
97+
98+
**Warning**: you need to make sure that the dependencies of Notebook and the local package match correctly,
99+
otherwise there will be errors with webpack during build.\
100+
In the previous example, both _@jupyterlab/ui-components_ and Notebook depend on _@jupyterlab/coreutils_. We
101+
strongly advise you to depend on the same version.
102+
69103
## Running Tests
70104

71105
To run the tests:

0 commit comments

Comments
 (0)