Commit 91368a24 authored by Jeremy Tuloup's avatar Jeremy Tuloup
Browse files

First Commit

parents
lint-staged.config.js
.eslintrc.js
node_modules
**/build
**/lib
**/node_modules
**/mock_packages
**/static
**/typings
**/schemas
**/themes
coverage
*.map.js
*.bundle.js
# jetbrains IDE stuff
.idea/
# ms IDE stuff
.history/
.vscode/
module.exports = {
env: {
browser: true,
es6: true,
commonjs: true,
node: true,
'jest/globals': true
},
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:jest/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'jest'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
},
settings: {
react: {
version: 'detect'
}
}
};
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Lint
run: |
yarn
yarn run eslint:check
yarn run prettier:check
- name: Test
run: |
yarn run build:test
yarn run test
*.bundle.*
lib/
node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# OS X stuff
*.DS_Store
# End of https://www.gitignore.io/api/python
_temp_extension
junit.xml
[uU]ntitled*
jupyterlab_classic/static
jupyterlab_classic/labextension
# playwright
app/artifacts/videos
app/test/data
node_modules
**/node_modules
**/lib
**/package.json
**/static
build
{
"singleQuote": true
}
# Contributing to JupyterLite
Thanks for contributing to JupyterLite.
Make sure to follow [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md)
for a friendly and welcoming collaborative environment.
## Setting up a development environment
BSD 3-Clause License
Copyright (c) 2021, JupyterLite Contributors
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.
# jupyterlite
![Github Actions Status](https://github.com/jtpio/jupyterlite/workflows/Build/badge.svg)
JupyterLite is a JupyterLab distribution that runs entirely in the browser without a Jupyter Server.
## Dev install
Make sure [Node.js](https://nodejs.org) is installed.
Then run the following commands:
```bash
# install the dependencies
yarn
# build the app
yarn run build
# start a local http server
npx http-server
```
Then go to http://localhost:5000 in a web browser to start JupyterLite.
# Releasing JupyterLite
module.exports = require('@jupyterlab/testutils/lib/babel.config');
<!DOCTYPE html>
<html>
<head>
<title>JupyterLite</title>
</head>
<body>
<script id="jupyter-config-data" type="application/json">
{
"baseUrl": "/",
"fullStaticUrl": "/build",
"fullMathjaxUrl": "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js",
"mathjaxConfig": "TeX-AMS_CHTML-full,Safe",
"settingsUrl": "/build/schemas",
"themesUrl": "/build/themes"
}
</script>
<script src="./build/bundle.js" main="index"></script>
</body>
</html>
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { JupyterLab } from '@jupyterlab/application';
import {
BrowserServiceManager,
JupyterLiteServer,
JupyterServer
} from '@jupyterlite/server';
// The webpack public path needs to be set before loading the CSS assets.
import { PageConfig } from '@jupyterlab/coreutils';
// eslint-disable-next-line
__webpack_public_path__ = PageConfig.getOption('fullStaticUrl') + '/';
const styles = import('./build/style.js');
const extensions = [
import('@jupyterlite/application-extension'),
import('@jupyterlite/theme-extension'),
import('@jupyterlab/application-extension'),
import('@jupyterlab/apputils-extension'),
import('@jupyterlab/codemirror-extension'),
import('@jupyterlab/completer-extension'),
import('@jupyterlab/console-extension'),
import('@jupyterlab/csvviewer-extension'),
import('@jupyterlab/docmanager-extension'),
import('@jupyterlab/filebrowser-extension'),
import('@jupyterlab/fileeditor-extension'),
import('@jupyterlab/help-extension'),
import('@jupyterlab/imageviewer-extension'),
import('@jupyterlab/inspector-extension'),
import('@jupyterlab/launcher-extension'),
import('@jupyterlab/mainmenu-extension'),
import('@jupyterlab/markdownviewer-extension'),
import('@jupyterlab/mathjax2-extension'),
import('@jupyterlab/notebook-extension'),
import('@jupyterlab/rendermime-extension'),
import('@jupyterlab/running-extension'),
import('@jupyterlab/settingeditor-extension'),
import('@jupyterlab/shortcuts-extension'),
import('@jupyterlab/statusbar-extension'),
import('@jupyterlab/theme-dark-extension'),
import('@jupyterlab/theme-light-extension'),
import('@jupyterlab/tooltip-extension'),
import('@jupyterlab/ui-components-extension')
];
const mimeExtensions = [import('@jupyterlab/json-extension')];
const mods = [import('@jupyterlite/server-extension')];
window.addEventListener('load', async () => {
// Make sure the styles have loaded
await styles;
// create the in-browser JupyterLite Server
const jupyterLiteServer = new JupyterLiteServer({});
jupyterLiteServer.registerPluginModules(await Promise.all(mods));
const server = new JupyterServer();
const serviceManager = new BrowserServiceManager({ server });
// create a full-blown JupyterLab frontend
const lab = new JupyterLab({
mimeExtensions: await Promise.all(mimeExtensions),
serviceManager
});
const disabled = [
'@jupyterlab/apputils-extension:themes',
'@jupyterlab/apputils-extension:workspaces',
'@jupyterlab/application-extension:tree-resolver'
];
const plugins = (await Promise.all(extensions)).map(mod => {
let data = mod.default;
if (!Array.isArray(data)) {
data = [data];
}
return data.filter(mod => !disabled.includes(mod.id));
});
lab.registerPluginModules(plugins);
/* eslint-disable no-console */
console.log('Starting app');
await lab.start();
console.log('JupyterLite started, waiting for restore');
await lab.restored;
console.log('JupyterLite restored');
lab.commands.execute('apputils:change-theme', {
theme: 'JupyterLab Light'
});
});
const fs = require('fs');
const path = require('path');
const rimraf = require('rimraf');
module.exports = async () => {
const data = path.join(__dirname, './test/data');
const example = path.join(__dirname, '../binder/example.ipynb');
const dest = path.join(data, 'example.ipynb');
rimraf.sync(data);
fs.mkdirSync(data);
fs.copyFileSync(example, dest);
};
const path = require('path');
const func = require('@jupyterlab/testutils/lib/jest-config');
const upstream = func(__dirname);
let local = {
globalSetup: path.resolve(__dirname, './jest-setup.js'),
preset: 'ts-jest/presets/js-with-babel',
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
globals: {
'ts-jest': {
tsconfig: './tsconfig.test.json'
}
},
transform: {
'\\.(ts|tsx)?$': 'ts-jest',
'\\.svg$': 'jest-raw-loader'
}
};
Object.keys(local).forEach(option => {
upstream[option] = local[option];
});
module.exports = upstream;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 64 64"
version="1.1"
id="svg6"
sodipodi:docname="javascript.svg"
width="64"
height="64"
inkscape:version="1.0.2 (1.0.2+r75+1)">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1416"
id="namedview8"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="1.6"
inkscape:cx="315"
inkscape:cy="315"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg6" />
<rect
width="64"
height="64"
fill="#f7df1e"
id="rect2"
x="0"
y="0"
style="stroke-width:0.101587" />
<path
d="m 42.991746,50.000254 c 1.289143,2.104889 2.966349,3.652063 5.932698,3.652063 2.491937,0 4.08381,-1.24546 4.08381,-2.966349 0,-2.062222 -1.635556,-2.792635 -4.378413,-3.992381 l -1.503492,-0.645079 c -4.339809,-1.848889 -7.222857,-4.165079 -7.222857,-9.061587 0,-4.510477 3.436698,-7.944127 8.807619,-7.944127 3.823746,0 6.572699,1.330793 8.553651,4.815238 l -4.683175,3.006984 c -1.031111,-1.848889 -2.143492,-2.57727 -3.870476,-2.57727 -1.761524,0 -2.877968,1.11746 -2.877968,2.57727 0,1.80419 1.11746,2.534603 3.697778,3.652063 l 1.503492,0.644064 c 5.109841,2.191238 7.99492,4.425143 7.99492,9.447619 0,5.414603 -4.25346,8.380952 -9.965714,8.380952 -5.58527,0 -9.193651,-2.661587 -10.959238,-6.150095 z m -21.244952,0.521143 c 0.944762,1.67619 1.80419,3.093333 3.870476,3.093333 1.975873,0 3.222349,-0.773079 3.222349,-3.779047 V 29.386159 h 6.013968 v 20.530793 c 0,6.227302 -3.651047,9.061588 -8.980317,9.061588 -4.815238,0 -7.60381,-2.491937 -9.021968,-5.493334 z"
id="path4"
style="stroke-width:0.101587" />
</svg>
{
"name": "@jupyterlite/app",
"version": "0.1.6",
"private": true,
"scripts": {
"build": "webpack",
"build:prod": "webpack --mode=production",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf build",
"clean:artifacts": "rimraf artifacts",
"prepublishOnly": "yarn run build",
"test:cov": "jest --collect-coverage",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
"watch": "webpack --watch"
},
"dependencies": {
"@jupyterlite/server": "^0.1.0",
"@jupyterlite/application-extension": "^0.1.0",
"@jupyterlite/server-extension": "^0.1.0",
"@jupyterlite/theme-extension": "^0.1.0",
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/application-extension": "^3.0.0",
"@jupyterlab/apputils-extension": "^3.0.0",
"@jupyterlab/codemirror-extension": "^3.0.0",
"@jupyterlab/completer-extension": "^3.0.0",
"@jupyterlab/console-extension": "^3.0.0",
"@jupyterlab/csvviewer-extension": "^3.0.0",
"@jupyterlab/docmanager-extension": "^3.0.0",
"@jupyterlab/filebrowser-extension": "^3.0.0",
"@jupyterlab/fileeditor-extension": "^3.0.0",
"@jupyterlab/help-extension": "^3.0.0",
"@jupyterlab/imageviewer-extension": "^3.0.0",
"@jupyterlab/inspector-extension": "^3.0.0",
"@jupyterlab/json-extension": "^3.0.0",
"@jupyterlab/launcher-extension": "^3.0.0",
"@jupyterlab/mainmenu-extension": "^3.0.0",
"@jupyterlab/markdownviewer-extension": "^3.0.0",
"@jupyterlab/mathjax2-extension": "^3.0.0",
"@jupyterlab/notebook-extension": "^3.0.0",
"@jupyterlab/rendermime-extension": "^3.0.0",
"@jupyterlab/running-extension": "^3.0.0",
"@jupyterlab/settingeditor-extension": "^3.0.0",
"@jupyterlab/shortcuts-extension": "^3.0.0",
"@jupyterlab/statusbar-extension": "^3.0.0",
"@jupyterlab/theme-dark-extension": "^3.0.0",
"@jupyterlab/theme-light-extension": "^3.0.0",
"@jupyterlab/tooltip-extension": "^3.0.0",
"@jupyterlab/ui-components-extension": "^3.0.0",
"es6-promise": "~4.2.8",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.12.1",
"@jupyterlab/builder": "^3.0.0",
"@jupyterlab/buildutils": "^3.0.0",
"@jupyterlab/testutils": "^3.0.0",
"@types/jest": "^26.0.10",
"css-loader": "~5.0.1",
"file-loader": "~5.0.2",
"fs-extra": "^8.1.0",
"glob": "~7.1.6",
"jest": "^26.4.2",
"mini-css-extract-plugin": "~0.9.0",
"npm-run-all": "^4.1.5",
"playwright": "^1.8.0",
"raw-loader": "~4.0.0",
"rimraf": "~3.0.2",
"style-loader": "~1.0.1",
"svg-url-loader": "~6.0.0",
"url-loader": "~4.1.1",
"watch": "~1.0.2",
"webpack": "^5.7.0",
"webpack-bundle-analyzer": "^4.1.0",
"webpack-cli": "^4.2.0",
"webpack-merge": "^5.1.2",
"whatwg-fetch": "^3.0.0"
},
"jupyterlab": {
"extensions": [
"@jupyterlite/application-extension",
"@jupyterlab/application-extension",
"@jupyterlab/apputils-extension",
"@jupyterlab/codemirror-extension",
"@jupyterlab/completer-extension",
"@jupyterlab/console-extension",
"@jupyterlab/csvviewer-extension",
"@jupyterlab/docmanager-extension",
"@jupyterlab/filebrowser-extension",
"@jupyterlab/fileeditor-extension",