diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 478c0b0e..79303007 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 @@ -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: | @@ -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 diff --git a/{{cookiecutter.python_name}}/.github/workflows/build.yml b/{{cookiecutter.python_name}}/.github/workflows/build.yml index 04557a93..e92b4679 100644 --- a/{{cookiecutter.python_name}}/.github/workflows/build.yml +++ b/{{cookiecutter.python_name}}/.github/workflows/build.yml @@ -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" diff --git a/{{cookiecutter.python_name}}/README.md b/{{cookiecutter.python_name}}/README.md index 8947613c..e30874db 100644 --- a/{{cookiecutter.python_name}}/README.md +++ b/{{cookiecutter.python_name}}/README.md @@ -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 @@ -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 diff --git a/{{cookiecutter.python_name}}/package.json b/{{cookiecutter.python_name}}/package.json index 3fdc1ab9..7ec66667 100644 --- a/{{cookiecutter.python_name}}/package.json +++ b/{{cookiecutter.python_name}}/package.json @@ -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", @@ -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" ] } } diff --git a/{{cookiecutter.python_name}}/pyproject.toml b/{{cookiecutter.python_name}}/pyproject.toml index ad1a4ba2..11f8f418 100644 --- a/{{cookiecutter.python_name}}/pyproject.toml +++ b/{{cookiecutter.python_name}}/pyproject.toml @@ -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"]