Skip to content

Commit c57adfe

Browse files
committed
This commit is result of running the cookiecutter for jlab3 extensions with a few minor tweaks in the package.json.
1 parent 01f10e3 commit c57adfe

24 files changed

+5502
-821
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

.eslintrc.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: 'tsconfig.json',
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/interface-name-prefix': [
16+
'error',
17+
{ prefixWithI: 'always' }
18+
],
19+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/no-namespace': 'off',
22+
'@typescript-eslint/no-use-before-define': 'off',
23+
'@typescript-eslint/quotes': [
24+
'error',
25+
'single',
26+
{ avoidEscape: true, allowTemplateLiterals: false }
27+
],
28+
curly: ['error', 'all'],
29+
eqeqeq: 'error',
30+
'prefer-arrow-callback': 'error'
31+
}
32+
};

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: master
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '10.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.7'
23+
architecture: 'x64'
24+
- name: Install dependencies
25+
run: python -m pip install jupyterlab
26+
- name: Build the extension
27+
run: |
28+
jlpm
29+
jlpm run eslint:check
30+
python -m pip install .
31+
32+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-drawio.*OK"
33+
python -m jupyterlab.browser_check

.gitignore

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,110 @@ lib/
33
node_modules/
44
*.egg-info/
55
.ipynb_checkpoints
6-
tsconfig.tsbuildinfo
7-
*.tgz
6+
*.tsbuildinfo
7+
jupyterlab-drawio/labextension
8+
9+
# Created by https://www.gitignore.io/api/python
10+
# Edit at https://www.gitignore.io/?templates=python
11+
12+
### Python ###
13+
# Byte-compiled / optimized / DLL files
14+
__pycache__/
15+
*.py[cod]
16+
*$py.class
17+
18+
# C extensions
19+
*.so
20+
21+
# Distribution / packaging
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
pip-wheel-metadata/
36+
share/python-wheels/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# PyInstaller
42+
# Usually these files are written by a python script from a template
43+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
44+
*.manifest
45+
*.spec
46+
47+
# Installer logs
48+
pip-log.txt
49+
pip-delete-this-directory.txt
50+
51+
# Unit test / coverage reports
52+
htmlcov/
53+
.tox/
54+
.nox/
55+
.coverage
56+
.coverage.*
57+
.cache
58+
nosetests.xml
59+
coverage.xml
60+
*.cover
61+
.hypothesis/
62+
.pytest_cache/
63+
64+
# Translations
65+
*.mo
66+
*.pot
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# pyenv
78+
.python-version
79+
80+
# celery beat schedule file
81+
celerybeat-schedule
82+
83+
# SageMath parsed files
84+
*.sage.py
85+
86+
# Spyder project settings
87+
.spyderproject
88+
.spyproject
89+
90+
# Rope project settings
91+
.ropeproject
92+
93+
# Mr Developer
94+
.mr.developer.cfg
95+
.project
96+
.pydevproject
97+
98+
# mkdocs documentation
99+
/site
100+
101+
# mypy
102+
.mypy_cache/
103+
.dmypy.json
104+
dmypy.json
105+
106+
# Pyre type checker
107+
.pyre/
108+
109+
# End of https://www.gitignore.io/api/python
110+
111+
# OSX files
112+
.DS_Store

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2020, Wolf Vollprecht All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
* Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
include jupyter-config/jupyterlab-drawio.json
5+
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
10+
graft jupyterlab-drawio/labextension
11+
12+
# Javascript files
13+
graft src
14+
graft style
15+
prune **/node_modules
16+
prune lib
17+
18+
# Patterns to exclude from any directory
19+
global-exclude *~
20+
global-exclude *.pyc
21+
global-exclude *.pyo
22+
global-exclude .git
23+
global-exclude .ipynb_checkpoints

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,62 @@
11
# jupyterlab-drawio
22

3-
[![Binder with JupyterLab](https://mybinder.org/badge_logo.svg)](http://mybinder.org/v2/gh/QuantStack/jupyterlab-drawio/master?urlpath=lab)
3+
![Github Actions Status](https://github.com/QuantStack/jupyterlab-drawio/workflows/Build/badge.svg)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/QuantStack/jupyterlab-drawio/master?urlpath=lab)
44

5+
A JupyterLab extension for embedding drawio / mxgraph.
56

6-
A JupyterLab extension for standalone integration of drawio / mxgraph into jupyterlab.
77

8-
## Prerequisites
98

10-
* JupyterLab
9+
## Requirements
1110

12-
## Installation
11+
* JupyterLab >= 3.0
12+
13+
## Install
1314

1415
```bash
15-
jupyter labextension install jupyterlab-drawio
16+
pip install jupyterlab-drawio
1617
```
1718

18-
## Usage
1919

20-
![drawio-screencast](drawio.gif)
20+
## Contributing
21+
22+
### Development install
2123

22-
## Development
24+
Note: You will need NodeJS to build the extension package.
2325

24-
For a development install (requires npm version 4 or later), do the following in the repository directory:
26+
The `jlpm` command is JupyterLab's pinned version of
27+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
28+
`yarn` or `npm` in lieu of `jlpm` below.
2529

2630
```bash
27-
npm install
28-
npm run build
29-
jupyter labextension link .
31+
# Clone the repo to your local environment
32+
# Change directory to the jupyterlab-drawio directory
33+
# Install package in development mode
34+
pip install -e .
35+
# Link your development version of the extension with JupyterLab
36+
jupyter labextension develop . --overwrite
37+
# Rebuild extension Typescript source after making changes
38+
jlpm run build
3039
```
3140

32-
To rebuild the package and the JupyterLab app:
41+
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.
3342

3443
```bash
35-
npm run build
36-
jupyter lab build
44+
# Watch the source directory in one terminal, automatically rebuilding when needed
45+
jlpm run watch
46+
# Run JupyterLab in another terminal
47+
jupyter lab
3748
```
3849

39-
## License
50+
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).
51+
52+
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:
4053

41-
The files herein, and especially the source code of mxgraph, is licensed under the Apache 2.0 License.
42-
The copyright holders of draw.io / mxgraph is jgraph (http://www.jgraph.com). The original source code
43-
vendored in this package is taken from: https://github.com/jgraph/mxgraph
54+
```bash
55+
jupyter lab build --minimize=False
56+
```
57+
58+
### Uninstall
59+
60+
```bash
61+
pip uninstall jupyterlab-drawio
62+
```

binder/environment.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
name: jupyterlab-drawio
1+
# a mybinder.org-ready environment for demoing jupyterlab-drawio
2+
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
3+
#
4+
# conda env update --file binder/environment.yml
5+
# conda activate jupyterlab-drawio-demo
6+
#
7+
name: jupyterlab-drawio-demo
28

39
channels:
410
- conda-forge
511

612
dependencies:
7-
- jupyterlab >=2,<3.0.0a0
8-
- nodejs >=10
13+
# runtime dependencies
14+
- python >=3.8,<3.9.0a0
15+
- jupyterlab >=3,<4.0.0a0
16+
# labextension build dependencies
17+
- nodejs >=14,<15
18+
- pip
19+
- wheel
20+
# additional packages for demos
21+
# - ipywidgets

0 commit comments

Comments
 (0)