Skip to content

Commit

Permalink
Merge pull request #21 from jupyterlab-contrib/maintenance/switch-to-…
Browse files Browse the repository at this point in the history
…copier

Built on top of copier template
  • Loading branch information
fcollonval authored Jul 30, 2023
2 parents fe5e3f3 + c8895bb commit 52d2b40
Show file tree
Hide file tree
Showing 9 changed files with 585 additions and 238 deletions.
19 changes: 19 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.0.10
_src_path: https://github.com/jupyterlab/extension-template
author_email: haudin.florence@gmail.com
author_name: Florence Haudin
data_format: string
file_extension: ''
has_binder: true
has_settings: true
kind: server
labextension_name: jupyter-theme-editor
mimetype: ''
mimetype_name: ''
project_short_description: Extension to create a theme.
python_name: jupyter_theme_editor
repository: https://github.com/jupyterlab-contrib/jupyterlab-theme-editor.git
test: true
viewer_name: ''

1 change: 0 additions & 1 deletion .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
target: ${{ github.event.inputs.target }}
branch: ${{ github.event.inputs.branch }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
jobs:
publish_release:
runs-on: ubuntu-latest
permissions:
# This is useful if you want to use PyPI trusted publisher
# and NPM provenance
id-token: write
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

Expand All @@ -23,22 +27,17 @@ jobs:
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
target: ${{ github.event.inputs.target }}
branch: ${{ github.event.inputs.branch }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}

- name: Finalize Release
id: finalize-release
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }}
TWINE_USERNAME: __token__
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: jupyter-server/jupyter-releaser/.github/actions/finalize-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
target: ${{ github.event.inputs.target }}
release_url: ${{ steps.populate-release.outputs.release_url }}

- name: "** Next Step **"
Expand Down
36 changes: 35 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,41 @@ Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/e

Here is a summary of the steps to cut a new release:

- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository
- Add tokens to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository:
- `ADMIN_GITHUB_TOKEN` (with "public_repo" and "repo:status" permissions); see the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
- `NPM_TOKEN` (with "automation" permission); see the [documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens)
- Set up PyPI

<details><summary>Using PyPI trusted publisher (modern way)</summary>

- Set up your PyPI project by [adding a trusted publisher](https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
- The _workflow name_ is `publish-release.yml` and the _environment_ should be left blank.
- Ensure the publish release job as `permissions`: `id-token : write` (see the [documentation](https://docs.pypi.org/trusted-publishers/using-a-publisher/))

</details>

<details><summary>Using PyPI token (legacy way)</summary>

- If the repo generates PyPI release(s), create a scoped PyPI [token](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github). We recommend using a scoped token for security reasons.

- You can store the token as `PYPI_TOKEN` in your fork's `Secrets`.

- Advanced usage: if you are releasing multiple repos, you can create a secret named `PYPI_TOKEN_MAP` instead of `PYPI_TOKEN` that is formatted as follows:

```text
owner1/repo1,token1
owner2/repo2,token2
```

If you have multiple Python packages in the same repository, you can point to them as follows:

```text
owner1/repo1/path/to/package1,token1
owner1/repo1/path/to/package2,token2
```

</details>

- Go to the Actions panel
- Run the "Step 1: Prep Release" workflow
- Check the draft changelog
Expand Down
13 changes: 9 additions & 4 deletions jupyter_theme_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
from ._version import __version__
try:
from ._version import __version__
except ImportError:
# Fallback when using the package in dev mode without installing
# in editable mode with pip. It is highly recommended to install
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
import warnings
warnings.warn("Importing 'jupyter_theme_editor' outside a proper installation.")
__version__ = "dev"
from .handlers import setup_handlers



def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyter-theme-editor"
}]



def _jupyter_server_extension_points():
return [{
"module": "jupyter_theme_editor"
Expand All @@ -32,4 +38,3 @@ def _load_jupyter_server_extension(server_app):

# For backward compatibility with notebook server - useful for Binder/JupyterHub
load_jupyter_server_extension = _load_jupyter_server_extension

29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"schema/*.json"
"schema/*.json",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -30,16 +31,16 @@
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"clean": "jlpm clean:lib",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"clean:labextension": "rimraf jupyter_theme_editor/labextension jupyter_theme_editor/_version.py",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf jupyter_theme_editor/labextension jupyter_theme_editor/_version.py",
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
"eslint": "jlpm eslint:check --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"install:extension": "jlpm build",
Expand All @@ -52,8 +53,8 @@
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"test": "jest --coverage",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w --sourceMap",
"watch:labextension": "jupyter labextension watch ."
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w --sourceMap"
},
"dependencies": {
"@hello-pangea/color-picker": "^3.2.2",
Expand All @@ -75,22 +76,22 @@
"@typescript-eslint/parser": "^5.55.0",
"css-loader": "^6.7.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.2.0",
"mkdirp": "^1.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.7",
"prettier": "^3.0.0",
"rimraf": "^4.4.1",
"source-map-loader": "^1.0.2",
"style-loader": "^3.3.1",
"stylelint": "^14.9.1",
"stylelint": "^15.10.1",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended": "^8.0.0",
"stylelint-config-standard": "^26.0.0",
"stylelint-prettier": "^2.0.0",
"stylelint-config-recommended": "^13.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-prettier": "^4.0.0",
"typescript": "~5.0.2",
"yjs": "^13.5.0"
"yjs": "^13.5.40"
},
"sideEffects": [
"style/*.css",
Expand Down
34 changes: 17 additions & 17 deletions style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
https://jupyterlab.readthedocs.io/en/stable/developer/css.html
*/
@import 'https://fonts.googleapis.com/css2?family=Courier';
@import 'https://fonts.googleapis.com/css2?family=Dancing+Script';
@import 'https://fonts.googleapis.com/css2?family=Dosis';
@import 'https://fonts.googleapis.com/css2?family=Helvetica';
@import 'https://fonts.googleapis.com/css2?family=JetBrains+Mono';
@import 'https://fonts.googleapis.com/css2?family=Lobster';
@import 'https://fonts.googleapis.com/css2?family=Oxygen';
@import 'https://fonts.googleapis.com/css2?family=Pacifico';
@import 'https://fonts.googleapis.com/css2?family=Prompt';
@import 'https://fonts.googleapis.com/css2?family=Righteous';
@import 'https://fonts.googleapis.com/css2?family=Satisfy';
@import 'https://fonts.googleapis.com/css2?family=Single+Day';
@import 'https://fonts.googleapis.com/css2?family=Space+Mono';
@import 'https://fonts.googleapis.com/css2?family=Times+New+Roman';
@import 'https://fonts.googleapis.com/css2?family=Ultra';
@import 'https://fonts.googleapis.com/css2?family=Urbanist';
@import 'https://fonts.googleapis.com/css2?family=Verdana';
@import url('https://fonts.googleapis.com/css2?family=Courier');
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script');
@import url('https://fonts.googleapis.com/css2?family=Dosis');
@import url('https://fonts.googleapis.com/css2?family=Helvetica');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono');
@import url('https://fonts.googleapis.com/css2?family=Lobster');
@import url('https://fonts.googleapis.com/css2?family=Oxygen');
@import url('https://fonts.googleapis.com/css2?family=Pacifico');
@import url('https://fonts.googleapis.com/css2?family=Prompt');
@import url('https://fonts.googleapis.com/css2?family=Righteous');
@import url('https://fonts.googleapis.com/css2?family=Satisfy');
@import url('https://fonts.googleapis.com/css2?family=Single+Day');
@import url('https://fonts.googleapis.com/css2?family=Space+Mono');
@import url('https://fonts.googleapis.com/css2?family=Times+New+Roman');
@import url('https://fonts.googleapis.com/css2?family=Ultra');
@import url('https://fonts.googleapis.com/css2?family=Urbanist');
@import url('https://fonts.googleapis.com/css2?family=Verdana');

.jp-theme-editor-panel {
overflow-y: auto;
Expand Down
2 changes: 1 addition & 1 deletion style/index.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import './base.css';
@import url('./base.css');
Loading

0 comments on commit 52d2b40

Please sign in to comment.