Skip to content

Commit 773b428

Browse files
committed
Convert js to ts
Signed-off-by: Jay Wang <[email protected]>
0 parents  commit 773b428

24 files changed

+2098
-0
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

.eslintrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: 'tsconfig.json',
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/naming-convention': [
16+
'error',
17+
{
18+
'selector': 'interface',
19+
'format': ['PascalCase'],
20+
'custom': {
21+
'regex': '^I[A-Z]',
22+
'match': true
23+
}
24+
}
25+
],
26+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/no-namespace': 'off',
29+
'@typescript-eslint/no-use-before-define': 'off',
30+
'@typescript-eslint/quotes': [
31+
'error',
32+
'single',
33+
{ avoidEscape: true, allowTemplateLiterals: false }
34+
],
35+
curly: ['error', 'all'],
36+
eqeqeq: 'error',
37+
'prefer-arrow-callback': 'error'
38+
}
39+
};

.github/workflows/build.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '14.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.8'
23+
architecture: 'x64'
24+
25+
26+
- name: Setup pip cache
27+
uses: actions/cache@v2
28+
with:
29+
path: ~/.cache/pip
30+
key: pip-3.8-${{ hashFiles('package.json') }}
31+
restore-keys: |
32+
pip-3.8-
33+
pip-
34+
35+
- name: Get yarn cache directory path
36+
id: yarn-cache-dir-path
37+
run: echo "::set-output name=dir::$(yarn cache dir)"
38+
- name: Setup yarn cache
39+
uses: actions/cache@v2
40+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
41+
with:
42+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
43+
key: yarn-${{ hashFiles('**/yarn.lock') }}
44+
restore-keys: |
45+
yarn-
46+
47+
- name: Install dependencies
48+
run: python -m pip install -U jupyterlab~=3.1 check-manifest
49+
- name: Build the extension
50+
run: |
51+
set -eux
52+
jlpm
53+
jlpm run eslint:check
54+
python -m pip install .
55+
56+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-stickyland.*OK"
57+
python -m jupyterlab.browser_check
58+
59+
check-manifest -v
60+
61+
pip install build
62+
python -m build --sdist
63+
cp dist/*.tar.gz myextension.tar.gz
64+
pip uninstall -y myextension jupyterlab
65+
rm -rf myextension
66+
67+
- uses: actions/upload-artifact@v2
68+
with:
69+
name: myextension-sdist
70+
path: myextension.tar.gz
71+
72+
test_isolated:
73+
needs: build
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v2
79+
- name: Install Python
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: '3.8'
83+
architecture: 'x64'
84+
- uses: actions/download-artifact@v2
85+
with:
86+
name: myextension-sdist
87+
- name: Install and Test
88+
run: |
89+
set -eux
90+
# Remove NodeJS, twice to take care of system and locally installed node versions.
91+
sudo rm -rf $(which node)
92+
sudo rm -rf $(which node)
93+
pip install myextension.tar.gz
94+
pip install jupyterlab
95+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-stickyland.*OK"
96+
python -m jupyterlab.browser_check --no-chrome-test

.github/workflows/check-release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
check_release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.9
23+
architecture: 'x64'
24+
- name: Install node
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: '14.x'
28+
- name: Get pip cache dir
29+
id: pip-cache
30+
run: |
31+
echo "::set-output name=dir::$(pip cache dir)"
32+
- name: Cache pip
33+
uses: actions/cache@v1
34+
with:
35+
path: ${{ steps.pip-cache.outputs.dir }}
36+
key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-pip-
39+
- name: Cache checked links
40+
uses: actions/cache@v2
41+
with:
42+
path: ~/.cache/pytest-link-check
43+
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links
44+
restore-keys: |
45+
${{ runner.os }}-linkcheck-
46+
- name: Upgrade packaging dependencies
47+
run: |
48+
pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user
49+
- name: Install Dependencies
50+
run: |
51+
pip install .
52+
- name: Check Release
53+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Upload Distributions
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: {{ cookiecutter.python_name }}-releaser-dist-${{ github.run_number }}
60+
path: .jupyter_releaser_checkout/dist

.gitignore

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
*.bundle.*
2+
lib/
3+
node_modules/
4+
*.egg-info/
5+
.ipynb_checkpoints
6+
*.tsbuildinfo
7+
jupyterlab_stickyland/labextension
8+
yarn.lock
9+
package-lock.json
10+
11+
# Created by https://www.gitignore.io/api/python
12+
# Edit at https://www.gitignore.io/?templates=python
13+
14+
### Python ###
15+
# Byte-compiled / optimized / DLL files
16+
__pycache__/
17+
*.py[cod]
18+
*$py.class
19+
20+
# C extensions
21+
*.so
22+
23+
# Distribution / packaging
24+
.Python
25+
build/
26+
develop-eggs/
27+
dist/
28+
downloads/
29+
eggs/
30+
.eggs/
31+
lib/
32+
lib64/
33+
parts/
34+
sdist/
35+
var/
36+
wheels/
37+
pip-wheel-metadata/
38+
share/python-wheels/
39+
.installed.cfg
40+
*.egg
41+
MANIFEST
42+
43+
# PyInstaller
44+
# Usually these files are written by a python script from a template
45+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
46+
*.manifest
47+
*.spec
48+
49+
# Installer logs
50+
pip-log.txt
51+
pip-delete-this-directory.txt
52+
53+
# Unit test / coverage reports
54+
htmlcov/
55+
.tox/
56+
.nox/
57+
.coverage
58+
.coverage.*
59+
.cache
60+
nosetests.xml
61+
coverage.xml
62+
*.cover
63+
.hypothesis/
64+
.pytest_cache/
65+
66+
# Translations
67+
*.mo
68+
*.pot
69+
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
target/
78+
79+
# pyenv
80+
.python-version
81+
82+
# celery beat schedule file
83+
celerybeat-schedule
84+
85+
# SageMath parsed files
86+
*.sage.py
87+
88+
# Spyder project settings
89+
.spyderproject
90+
.spyproject
91+
92+
# Rope project settings
93+
.ropeproject
94+
95+
# Mr Developer
96+
.mr.developer.cfg
97+
.project
98+
.pydevproject
99+
100+
# mkdocs documentation
101+
/site
102+
103+
# mypy
104+
.mypy_cache/
105+
.dmypy.json
106+
dmypy.json
107+
108+
# Pyre type checker
109+
.pyre/
110+
111+
# End of https://www.gitignore.io/api/python
112+
113+
# OSX files
114+
.DS_Store

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
jupyterlab_stickyland

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"arrowParens": "avoid"
5+
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2021, Jay Wang & Katie Dai
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include LICENSE
2+
include *.md
3+
include pyproject.toml
4+
5+
include package.json
6+
include install.json
7+
include ts*.json
8+
include yarn.lock
9+
10+
graft jupyterlab_stickyland/labextension
11+
12+
# Javascript files
13+
graft src
14+
graft style
15+
prune **/node_modules
16+
prune lib
17+
prune binder
18+
19+
# Patterns to exclude from any directory
20+
global-exclude *~
21+
global-exclude *.pyc
22+
global-exclude *.pyo
23+
global-exclude .git
24+
global-exclude .ipynb_checkpoints

0 commit comments

Comments
 (0)