Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
python -c "from cookiecutter.main import cookiecutter; import json, os; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['labextension_name']=os.getenv('NAME'); cookiecutter('.', extra_context=d, no_input=True)"
pushd ${PYNAME}
pip install jupyterlab
jlpm
jlpm stylelint-config-prettier-check
jlpm lint:check
npm install
npx stylelint-config-prettier-check
npm run lint:check
pip install -e .
jupyter labextension develop . --overwrite
jupyter labextension list
Expand Down Expand Up @@ -85,10 +85,10 @@ jobs:
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['has_settings']='y'; cookiecutter('.', extra_context=d, no_input=True)"
pushd myextension
pip install jupyterlab
jlpm
npm install
# It is not easily possible to get this version compatible with linter rules
jlpm lint
jlpm lint:check
npm run lint
npm run lint:check
pip install -e .
jupyter labextension develop . --overwrite
jupyter labextension list
Expand Down Expand Up @@ -131,8 +131,8 @@ jobs:
cd myextension
pip install .
pip install jupyterlab
jlpm
jlpm lint:check
npm install
npm run lint:check

- name: Check pip install method
run: |
Expand Down Expand Up @@ -280,8 +280,8 @@ jobs:
python -c "from cookiecutter.main import cookiecutter; import json; f=open('cookiecutter.json'); d=json.load(f); f.close(); d['kind']='theme'; cookiecutter('.', extra_context=d, no_input=True)"
pushd mytheme
pip install jupyterlab
jlpm
jlpm lint:check
npm install
npm run lint:check
pip install -e .
jupyter labextension develop . --overwrite
jupyter labextension list
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.python_name}}/.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- name: Build the extension
run: |
set -eux
jlpm
jlpm lint:check
npm install
npm run lint:check
python -m pip install .
{% if cookiecutter.kind.lower() == 'server' %}
jupyter server extension list 2>&1 | grep -ie "{{ cookiecutter.python_name }}.*OK"
Expand Down
10 changes: 3 additions & 7 deletions {{cookiecutter.python_name}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ jupyter labextension list

Note: You will need NodeJS to build the extension package.

The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.

```bash
# Clone the repo to your local environment
# Change directory to the {{ cookiecutter.python_name }} directory
Expand All @@ -66,21 +62,21 @@ jupyter labextension develop . --overwrite{% if cookiecutter.kind.lower() == 'se
# Server extension must be manually installed in develop mode
jupyter server extension enable {{ cookiecutter.python_name }}{% endif %}
# Rebuild extension Typescript source after making changes
jlpm build
npm run build
```

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.

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
npm run watch
# Run JupyterLab in another terminal
jupyter lab
```

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).

By default, the `jlpm 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:
By default, the `npm 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:

```bash
jupyter lab build --minimize=False
Expand Down
26 changes: 13 additions & 13 deletions {{cookiecutter.python_name}}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
"url": "{{ cookiecutter.repository }}.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib && jlpm build:labextension",
"build": "npm run build:lib && npm run build:labextension:dev",
"build:prod": "npm run clean && npm run build:lib && npm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"clean": "jlpm clean:lib",
"clean": "npm run clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf {{ cookiecutter.python_name }}/labextension",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"eslint": "jlpm eslint:check --fix",
"clean:all": "npm run clean:lib && npm run clean:labextension && npm run clean:lintcache",
"eslint": "npm run eslint:check -- --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"install:extension": "npm run build",
"lint": "npm run stylelint && npm run prettier && npm run eslint",
"lint:check": "npm run stylelint:check && npm run prettier:check && npm run eslint:check",
"prettier": "npm run prettier:base -- --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"prettier:check": "npm run prettier:base -- --check",
"stylelint": "npm run stylelint:check -- --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
Expand Down Expand Up @@ -107,10 +107,10 @@
"hooks": {
"before-build-npm": [
"python -m pip install jupyterlab~=3.1",
"jlpm"
"npm install"
],
"before-build-python": [
"jlpm clean:all"
"npm run clean:all"
]
}
}
Expand Down
1 change: 0 additions & 1 deletion {{cookiecutter.python_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]

[tool.check-manifest]
ignore = ["{{ cookiecutter.python_name }}/labextension/**", "yarn.lock", ".*", "package-lock.json"]