Skip to content

Commit 5bbec2d

Browse files
committed
chore: update template to include settings
1 parent 95c5f66 commit 5bbec2d

File tree

7 files changed

+88
-7
lines changed

7 files changed

+88
-7
lines changed

.copier-answers.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v4.2.4
2+
_commit: v4.2.5
33
_src_path: https://github.com/jupyterlab/extension-template
44
author_email: [email protected]
55
author_name: Allan Chain
66
has_binder: false
7-
has_settings: false
7+
has_settings: true
88
kind: server
99
labextension_name: jupyterlab-wakatime
1010
project_short_description: A JupyterLab WakaTime extension.
1111
python_name: jupyterlab_wakatime
12-
repository: https://github.com/AllanChain/jupyterlab-wakatime
12+
repository: https://github.com/wakatime/jupyterlab-wakatime
1313
test: false
1414

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
pull_request:
77
branches: '*'
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
build:
1115
runs-on: ubuntu-latest

.github/workflows/check-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
branches: ["*"]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
check_release:
1014
runs-on: ubuntu-latest

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
},
1919
"files": [
2020
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
21-
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
21+
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
22+
"src/**/*.{ts,tsx}",
23+
"schema/*.json"
2224
],
2325
"main": "lib/index.js",
2426
"types": "lib/index.d.ts",
@@ -58,7 +60,8 @@
5860
"@jupyterlab/coreutils": "^6.0.0",
5961
"@jupyterlab/fileeditor": "^4.0.10",
6062
"@jupyterlab/notebook": "^4.0.10",
61-
"@jupyterlab/services": "^7.0.0"
63+
"@jupyterlab/services": "^7.0.0",
64+
"@jupyterlab/settingregistry": "^4.0.0"
6265
},
6366
"devDependencies": {
6467
"@jupyterlab/builder": "^4.0.0",
@@ -105,7 +108,8 @@
105108
}
106109
},
107110
"extension": true,
108-
"outputDir": "jupyterlab_wakatime/labextension"
111+
"outputDir": "jupyterlab_wakatime/labextension",
112+
"schemaDir": "schema"
109113
},
110114
"eslintIgnore": [
111115
"node_modules",

schema/plugin.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"jupyter.lab.shortcuts": [],
3+
"title": "jupyterlab-wakatime",
4+
"description": "jupyterlab-wakatime settings.",
5+
"type": "object",
6+
"properties": {},
7+
"additionalProperties": false
8+
}

src/index.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'
22
import { INotebookTracker } from '@jupyterlab/notebook'
33
import { IEditorTracker } from '@jupyterlab/fileeditor'
4+
import { ISettingRegistry } from '@jupyterlab/settingregistry'
45

56
import { beatHeart } from './watch'
67

@@ -12,10 +13,12 @@ const plugin: JupyterFrontEndPlugin<void> = {
1213
description: 'A JupyterLab WakaTime extension.',
1314
autoStart: true,
1415
requires: [INotebookTracker, IEditorTracker],
16+
optional: [ISettingRegistry],
1517
activate: (
1618
app: JupyterFrontEnd,
1719
notebooks: INotebookTracker,
18-
editors: IEditorTracker
20+
editors: IEditorTracker,
21+
settingRegistry: ISettingRegistry | null
1922
) => {
2023
console.log('JupyterLab extension jupyterlab-wakatime is activated!')
2124
notebooks.widgetAdded.connect((_, notebook) => {
@@ -50,6 +53,22 @@ const plugin: JupyterFrontEndPlugin<void> = {
5053
beatHeart(editor.context.path, 'switch')
5154
}
5255
})
56+
if (settingRegistry) {
57+
settingRegistry
58+
.load(plugin.id)
59+
.then(settings => {
60+
console.log(
61+
'jupyterlab-wakatime settings loaded:',
62+
settings.composite
63+
)
64+
})
65+
.catch(reason => {
66+
console.error(
67+
'Failed to load settings for jupyterlab-wakatime.',
68+
reason
69+
)
70+
})
71+
}
5372
}
5473
}
5574

yarn.lock

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,15 @@ __metadata:
868868
languageName: node
869869
linkType: hard
870870

871+
"@jupyterlab/nbformat@npm:^4.0.12":
872+
version: 4.0.12
873+
resolution: "@jupyterlab/nbformat@npm:4.0.12"
874+
dependencies:
875+
"@lumino/coreutils": ^2.1.2
876+
checksum: e9bd3385e9b7020f27577dc790462cebab3fada9571b64e57c19d9246b944726a1b3d866fec79b4be67153e2b19a1caa08d15d066274b975bfd07cd8211de605
877+
languageName: node
878+
linkType: hard
879+
871880
"@jupyterlab/notebook@npm:^4.0.10":
872881
version: 4.0.10
873882
resolution: "@jupyterlab/notebook@npm:4.0.10"
@@ -988,6 +997,25 @@ __metadata:
988997
languageName: node
989998
linkType: hard
990999

1000+
"@jupyterlab/settingregistry@npm:^4.0.0":
1001+
version: 4.0.12
1002+
resolution: "@jupyterlab/settingregistry@npm:4.0.12"
1003+
dependencies:
1004+
"@jupyterlab/nbformat": ^4.0.12
1005+
"@jupyterlab/statedb": ^4.0.12
1006+
"@lumino/commands": ^2.1.3
1007+
"@lumino/coreutils": ^2.1.2
1008+
"@lumino/disposable": ^2.1.2
1009+
"@lumino/signaling": ^2.1.2
1010+
"@rjsf/utils": ^5.1.0
1011+
ajv: ^8.12.0
1012+
json5: ^2.2.3
1013+
peerDependencies:
1014+
react: ">=16"
1015+
checksum: 1d3b425effb33333b3c89b0f4bac08ffba5fd97602ce92fb3c3037c15573c853609ec04b0e7e2d4c74f67a75360063e1fd00ba19862abc992f867a3d31e8b440
1016+
languageName: node
1017+
linkType: hard
1018+
9911019
"@jupyterlab/settingregistry@npm:^4.0.10":
9921020
version: 4.0.10
9931021
resolution: "@jupyterlab/settingregistry@npm:4.0.10"
@@ -1020,6 +1048,19 @@ __metadata:
10201048
languageName: node
10211049
linkType: hard
10221050

1051+
"@jupyterlab/statedb@npm:^4.0.12":
1052+
version: 4.0.12
1053+
resolution: "@jupyterlab/statedb@npm:4.0.12"
1054+
dependencies:
1055+
"@lumino/commands": ^2.1.3
1056+
"@lumino/coreutils": ^2.1.2
1057+
"@lumino/disposable": ^2.1.2
1058+
"@lumino/properties": ^2.0.1
1059+
"@lumino/signaling": ^2.1.2
1060+
checksum: a0bc781a2c16067890ad1a7f7a774ea9b47a9db052cde756416f953aef6cb9451e057a18230b0bb91dad0c3000dbeb6d349121561050e8dc4a91478aa0d40e61
1061+
languageName: node
1062+
linkType: hard
1063+
10231064
"@jupyterlab/statusbar@npm:^4.0.10":
10241065
version: 4.0.10
10251066
resolution: "@jupyterlab/statusbar@npm:4.0.10"
@@ -3905,6 +3946,7 @@ __metadata:
39053946
"@jupyterlab/fileeditor": ^4.0.10
39063947
"@jupyterlab/notebook": ^4.0.10
39073948
"@jupyterlab/services": ^7.0.0
3949+
"@jupyterlab/settingregistry": ^4.0.0
39083950
"@types/json-schema": ^7.0.11
39093951
"@types/react": ^18.0.26
39103952
"@types/react-addons-linked-state-mixin": ^0.14.22

0 commit comments

Comments
 (0)