Skip to content

Commit 7ac312d

Browse files
authored
Merge pull request #61 from ianhi/dev-install-instructions
Update dev-install instructions and update package.json scripts
2 parents 170718c + a437149 commit 7ac312d

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,40 @@ is used instead.
4848

4949
```bash
5050
# Create a new conda environment
51-
conda create -n jupyterlab-sidecar -c conda-forge jupyterlab ipywidgets nodejs
51+
conda create -n jupyterlab-sidecar -c conda-forge jupyterlab ipywidgets nodejs -y
5252

5353
# Activate the conda environment
5454
conda activate jupyterlab-sidecar
5555

56-
# Install dependencies
57-
jlpm
58-
59-
# Build Typescript source
60-
jlpm build
56+
# Install package in development mode
57+
pip install -e .
6158

6259
# Link your development version of the extension with JupyterLab
63-
jupyter labextension link .
60+
jupyter labextension develop . --overwrite
61+
62+
# Rebuild extension Typescript source after making changes
63+
jlpm run build
64+
```
65+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
66+
67+
```bash
68+
# Watch the source directory in one terminal, automatically rebuilding when needed
69+
jlpm run watch
70+
# Run JupyterLab in another terminal
71+
jupyter lab
72+
```
6473

65-
# Rebuild Typescript source after making changes
66-
jlpm build
6774

68-
# Rebuild JupyterLab after making any changes
69-
jupyter lab build
75+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
76+
77+
By default, the jlpm run build command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
78+
79+
```bash
80+
jupyter lab build --minimize=False
81+
```
82+
83+
## Uninstall
7084

71-
# Install the sidecar Python package
72-
python -m pip install -e .
7385
```
86+
pip uninstall jupyterlab-sidecar
87+
```

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,25 @@
2121
"url": "https://github.com/jupyter-widgets/jupyterlab-sidecar"
2222
},
2323
"scripts": {
24-
"build": "jlpm run build:lib && jlpm run build:labextension",
24+
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
25+
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
2526
"build:labextension": "jupyter labextension build .",
27+
"build:labextension:dev": "jupyter labextension build --development True .",
2628
"build:lib": "tsc",
27-
"clean": "jlpm run clean:lib && jlpm run clean:labextension",
28-
"clean:lib": "rimraf lib",
29+
"clean": "jlpm run clean:lib",
30+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
2931
"clean:labextension": "rimraf sidecar/labextension",
30-
"prepare": "jlpm run build",
32+
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
3133
"test": "jlpm run test:firefox",
3234
"test:chrome": "karma start --browsers=Chrome tests/karma.conf.js",
3335
"test:debug": "karma start --browsers=Chrome --singleRun=false --debug=true tests/karma.conf.js",
3436
"test:firefox": "karma start --browsers=Firefox tests/karma.conf.js",
3537
"test:ie": "karma start --browsers=IE tests/karma.conf.js",
36-
"watch": "npm-run-all -p watch:*",
37-
"watch:lib": "tsc"
38+
"install:extension": "jupyter labextension develop --overwrite .",
39+
"prepare": "jlpm run clean && jlpm run build:prod",
40+
"watch": "run-p watch:src watch:labextension",
41+
"watch:src": "tsc -w",
42+
"watch:labextension": "jupyter labextension watch ."
3843
},
3944
"dependencies": {
4045
"@jupyter-widgets/base": "^4.0.0",

0 commit comments

Comments
 (0)