From 5bc16b65fe56e0b5c329c61eadbd2517be4f9429 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 13:50:47 +0200 Subject: [PATCH 1/6] Put source javascript into a new folder --- .github/workflows/release.yaml | 4 ++-- RELEASE.md | 4 ++-- .yarnrc.yml => labextension/.yarnrc.yml | 0 install.json => labextension/install.json | 0 package.json => labextension/package.json | 2 +- {src => labextension/src}/index.ts | 0 {style => labextension/style}/index.css | 0 tsconfig.json => labextension/tsconfig.json | 0 yarn.lock => labextension/yarn.lock | 0 pyproject.toml | 9 ++++++--- 10 files changed, 11 insertions(+), 8 deletions(-) rename .yarnrc.yml => labextension/.yarnrc.yml (100%) rename install.json => labextension/install.json (100%) rename package.json => labextension/package.json (98%) rename {src => labextension/src}/index.ts (100%) rename {style => labextension/style}/index.css (100%) rename tsconfig.json => labextension/tsconfig.json (100%) rename yarn.lock => labextension/yarn.lock (100%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 500f0b5..c392276 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -39,7 +39,7 @@ jobs: cache: yarn node-version: "lts/*" registry-url: https://registry.npmjs.org - cache-dependency-path: yarn.lock + cache-dependency-path: labextension/yarn.lock - name: Update root build packages run: | @@ -60,7 +60,7 @@ jobs: run: | mkdir jsdist cd jsdist - npm pack ../jupyter_launcher_shortcuts/labextension + npm pack ../labextension sha256sum * | tee SHA256SUMS - name: Upload Python artifact diff --git a/RELEASE.md b/RELEASE.md index 59c9aa5..3d2cc04 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -9,7 +9,7 @@ instructions on how to make a release. ## Steps to make a release -1. Create a PR updating `yarn.lock` and continue only when its merged. +1. Create a PR updating `labextension/yarn.lock` and continue only when its merged. This helps us avoid leaving known vulnerabilities are unfixed. To do this, delete the file and manually perform the the `build dist` step in the @@ -18,7 +18,7 @@ instructions on how to make a release. ```shell # git clean -xfd can be needed to ensure yarn.lock # gets re-created during pyproject-build - rm yarn.lock + rm labextension/yarn.lock pip install --upgrade pip build pyproject-build diff --git a/.yarnrc.yml b/labextension/.yarnrc.yml similarity index 100% rename from .yarnrc.yml rename to labextension/.yarnrc.yml diff --git a/install.json b/labextension/install.json similarity index 100% rename from install.json rename to labextension/install.json diff --git a/package.json b/labextension/package.json similarity index 98% rename from package.json rename to labextension/package.json index a651043..7641583 100644 --- a/package.json +++ b/labextension/package.json @@ -87,7 +87,7 @@ }, "jupyterlab": { "extension": true, - "outputDir": "jupyter_launcher_shortcuts/labextension" + "outputDir": "../jupyter_launcher_shortcuts/labextension" }, "eslintIgnore": [ "node_modules", diff --git a/src/index.ts b/labextension/src/index.ts similarity index 100% rename from src/index.ts rename to labextension/src/index.ts diff --git a/style/index.css b/labextension/style/index.css similarity index 100% rename from style/index.css rename to labextension/style/index.css diff --git a/tsconfig.json b/labextension/tsconfig.json similarity index 100% rename from tsconfig.json rename to labextension/tsconfig.json diff --git a/yarn.lock b/labextension/yarn.lock similarity index 100% rename from yarn.lock rename to labextension/yarn.lock diff --git a/pyproject.toml b/pyproject.toml index 7953e8f..bcdbb63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ exclude = [".github"] [tool.hatch.build.targets.wheel.shared-data] "jupyter_launcher_shortcuts/labextension" = "share/jupyter/labextensions/jupyter_launcher_shortcuts" -"install.json" = "share/jupyter/labextensions/jupyter_launcher_shortcuts/install.json" +"labextension/install.json" = "share/jupyter/labextensions/jupyter_launcher_shortcuts/install.json" "jupyter_launcher_shortcuts/etc/serverextension.json" = "etc/jupyter/jupyter_server_config.d/jupyter_launcher_shortcuts.json" @@ -48,6 +48,7 @@ exclude = [".github"] # [tool.hatch.metadata.hooks.nodejs] fields = ["description", "authors", "urls"] +path = "labextension/package.json" # jupyter-builder is used to ensure we build the jupyterlab extension when the @@ -62,16 +63,18 @@ ensured-targets = [ "jupyter_launcher_shortcuts/labextension/static/style.js", "jupyter_launcher_shortcuts/labextension/package.json", ] -skip-if-exists = ["jupyter_launcher_shortcuts/labextension/static/style.js"] +skip-if-exists = ["jupyter_launcher_shortcuts/labextension/package.json"] [tool.hatch.build.hooks.jupyter-builder.build-kwargs] +path = "labextension" build_cmd = "build:prod" npm = ["jlpm"] [tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs] +path = "labextension" build_cmd = "install:extension" npm = ["jlpm"] -source_dir = "src" +source_dir = "labextension/src" build_dir = "jupyter_launcher_shortcuts/labextension" From 5a92b2cfdc474fe3172ddb2539dfaaed7e8219eb Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 14:15:02 +0200 Subject: [PATCH 2/6] Remnant extension naming fixes --- pyproject.toml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bcdbb63..af30a79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,13 +31,16 @@ dependencies = [ ] dynamic = ["description", "authors", "urls", "keywords"] + +# hatch ref: https://hatch.pypa.io/latest/ +# [tool.hatch.build.targets.sdist] artifacts = ["jupyter_launcher_shortcuts/labextension"] exclude = [".github"] [tool.hatch.build.targets.wheel.shared-data] -"jupyter_launcher_shortcuts/labextension" = "share/jupyter/labextensions/jupyter_launcher_shortcuts" -"labextension/install.json" = "share/jupyter/labextensions/jupyter_launcher_shortcuts/install.json" +"jupyter_launcher_shortcuts/labextension" = "share/jupyter/labextensions/jupyterlab-launcher-shortcuts" +"labextension/install.json" = "share/jupyter/labextensions/jupyterlab-launcher-shortcuts/install.json" "jupyter_launcher_shortcuts/etc/serverextension.json" = "etc/jupyter/jupyter_server_config.d/jupyter_launcher_shortcuts.json" From 90a47f0a48f2f0213bdea5255aa6aa2b5fb583ff Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 14:18:45 +0200 Subject: [PATCH 3/6] Ensure third-party-licenses.json gets included --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index af30a79..ff0d3f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,7 @@ build-function = "hatch_jupyter_builder.npm_builder" ensured-targets = [ "jupyter_launcher_shortcuts/labextension/static/style.js", "jupyter_launcher_shortcuts/labextension/package.json", + "jupyter_launcher_shortcuts/labextension/static/third-party-licenses.json", ] skip-if-exists = ["jupyter_launcher_shortcuts/labextension/package.json"] From f5ef8d675dc4bc3752a65afd295ae285e07e8508 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 14:37:37 +0200 Subject: [PATCH 4/6] Bundle LICENCE in NPM package --- labextension/LICENSE | 29 +++++++++++++++++++++++++++++ labextension/package.json | 1 + 2 files changed, 30 insertions(+) create mode 100644 labextension/LICENSE diff --git a/labextension/LICENSE b/labextension/LICENSE new file mode 100644 index 0000000..71b31c7 --- /dev/null +++ b/labextension/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2019, Yuvi Panda +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/labextension/package.json b/labextension/package.json index 7641583..7c883b5 100644 --- a/labextension/package.json +++ b/labextension/package.json @@ -14,6 +14,7 @@ "license": "BSD-3-Clause", "author": "Yuvi Panda", "files": [ + "LICENSE", "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}", "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}", "src/**/*.{ts,tsx}" From 26f95bf005fffdad91616449c5046e4e20dfdfee Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 14:38:37 +0200 Subject: [PATCH 5/6] keywords in pyproject.toml to be declared via package.json --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ff0d3f4..755cfd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ exclude = [".github"] # ref: https://github.com/agoose77/hatch-nodejs-version#readme # [tool.hatch.metadata.hooks.nodejs] -fields = ["description", "authors", "urls"] +fields = ["description", "authors", "urls", "keywords"] path = "labextension/package.json" From 42f36135a3018a0728f3595217ff80dc42cfadf7 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Tue, 9 Jul 2024 14:39:51 +0200 Subject: [PATCH 6/6] Don't cleanup _version.py any more --- labextension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labextension/package.json b/labextension/package.json index 7c883b5..44560bb 100644 --- a/labextension/package.json +++ b/labextension/package.json @@ -36,7 +36,7 @@ "clean": "jlpm clean:lib", "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "clean:lintcache": "rimraf .eslintcache .stylelintcache", - "clean:labextension": "rimraf jupyter_launcher_shortcuts/labextension jupyter_launcher_shortcuts/_version.py", + "clean:labextension": "rimraf jupyter_launcher_shortcuts/labextension", "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", "eslint": "jlpm eslint:check --fix", "eslint:check": "eslint . --cache --ext .ts,.tsx",