Skip to content

Draft: Move the frontend into its own package #1956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
# chartpress requires the full history
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: actions/setup-python@v5
with:
python-version: "3.12"
Expand All @@ -64,6 +68,10 @@ jobs:
run: |
pip install --no-cache-dir chartpress>=2.1 pyyaml build

- run: npm ci

- run: npm run webpack

- name: Build binderhub wheel
run: python3 -m build --wheel .

Expand Down
39 changes: 39 additions & 0 deletions js/packages/binderhub-frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# `binderhub-frontend`

The default frontend for [BinderHub](https://binderhub.readthedocs.io/).

## Usage

```html
<html>
<head>
<link href="dist/styles.css" rel="stylesheet"></link>
<script>
window.pageConfig = {
"badgeBaseUrl": "https://mybinder.org/",
"baseUrl": "/",
"repoProviders": [
{
"detect": {
"regex": "^(https?://github.com/)?(?\u003crepo\u003e.*[^/])/?"
},
"displayName": "GitHub",
"id": "gh",
"ref": { "default": "HEAD", "enabled": true },
"repo": {
"label": "GitHub repository name or URL",
"placeholder": "example: yuvipanda/requirements or https://github.com/yuvipanda/requirements",
"urlEncode": false
},
"spec": { "validateRegex": "[^/]+/[^/]+/.+" }
}
]
};
</script>
</head>
<body>
<div id="root"></div>
</body>
<script src="dist/bundle.js"></script>
</html>
```
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ProgressIcon from "../../images/favicon/progress.ico";
import FailIcon from "../../images/favicon/fail.ico";
import SuccessIcon from "../../images/favicon/success.ico";
import ProgressIcon from "../images/favicon/progress.ico";
import FailIcon from "../images/favicon/fail.ico";
import SuccessIcon from "../images/favicon/success.ico";

import { PROGRESS_STATES } from "./Progress.jsx";

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
94 changes: 94 additions & 0 deletions js/packages/binderhub-frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"name": "binderhub-frontend",
"version": "1.0.0",
"description": "Default frontend for BinderHub",
"dependencies": {
"@fontsource/clear-sans": "^5.0.11",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"copy-to-clipboard": "^3.3.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"wouter": "^3.3.5",
"@xterm/xterm": "^5.5.0",
"@xterm/addon-fit": "^0.9.0"
},
"devDependencies": {
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.4",
"@babel/eslint-parser": "^7.22.15",
"@babel/preset-env": "^7.21.4",
"@babel/preset-react": "^7.26.3",
"@types/react": "^19.0.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"configurable-http-proxy": "^4.6.2",
"@types/jest": "^29.5.5",
"@whatwg-node/fetch": "^0.9.17",
"autoprefixer": "^10.4.19",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.2",
"css-loader": "^6.11.0",
"eslint": "^8.38.0",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-react": "^7.37.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.7.5",
"postcss-loader": "^8.1.1",
"sass": "^1.77.1",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.78.0",
"webpack-cli": "^5.0.1"
},
"main": "lib/index.jsx",
"directories": {
"lib": "lib"
},
"scripts": {
"webpack": "webpack",
"webpack:watch": "webpack --watch",
"lint": "eslint lib js",
"test": "jest"
},
"jest": {
"testEnvironment": "jsdom",
"collectCoverage": true,
"coverageReporters": [
"text",
"cobertura"
],
"testPathIgnorePatterns": [
"spec.js"
],
"moduleNameMapper": {
"\\.css$": "identity-obj-proxy",
"\\.scss$": "identity-obj-proxy",
"\\.ico$": "identity-obj-proxy"
},
"setupFilesAfterEnv": [
"<rootDir>/setupTests.js"
],
"transformIgnorePatterns": [
"/node_modules/(?!wouter)"
],
"transform": {
"\\.[jt]sx?$": "babel-jest"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/jupyterhub/binderhub.git"
},
"author": "Project Jupyter Contributors",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/jupyterhub/binderhub/issues"
},
"homepage": "https://github.com/jupyterhub/binderhub#readme"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"moduleResolution": "node",
"sourceMap": true
},
"include": ["binderhub/static/js/"]
"include": ["lib/"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
mode: "development",
context: path.resolve(__dirname, "binderhub/static"),
entry: "./js/index.jsx",
context: path.resolve(__dirname, "lib"),
entry: "./index.jsx",
output: {
path: path.resolve(__dirname, "binderhub/static/dist/"),
path: path.resolve(__dirname, "dist"),
filename: "bundle.js",
publicPath: "auto",
},
Expand Down
78 changes: 4 additions & 74 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,12 @@
"name": "binderhub",
"description": "Frontend Interface for BinderHub",
"private": true,
"dependencies": {
"@fontsource/clear-sans": "^5.0.11",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"copy-to-clipboard": "^3.3.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"wouter": "^3.3.5",
"@xterm/xterm": "^5.5.0",
"@xterm/addon-fit": "^0.9.0"
},
"devDependencies": {
"@babel/cli": "^7.21.0",
"@babel/core": "^7.21.4",
"@babel/eslint-parser": "^7.22.15",
"@babel/preset-env": "^7.21.4",
"@babel/preset-react": "^7.26.3",
"@types/react": "^19.0.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"configurable-http-proxy": "^4.6.2",
"@types/jest": "^29.5.5",
"@whatwg-node/fetch": "^0.9.17",
"autoprefixer": "^10.4.19",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.2",
"css-loader": "^6.11.0",
"eslint": "^8.38.0",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-react": "^7.37.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mini-css-extract-plugin": "^2.7.5",
"postcss-loader": "^8.1.1",
"sass": "^1.77.1",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.78.0",
"webpack-cli": "^5.0.1"
},
"workspaces": [
"js/packages/binderhub-client"
"js/packages/binderhub-client",
"js/packages/binderhub-frontend"
],
"scripts": {
"webpack": "webpack",
"webpack:watch": "webpack --watch",
"lint": "eslint binderhub/static/js js",
"test": "jest"
},
"jest": {
"testEnvironment": "jsdom",
"collectCoverage": true,
"coverageReporters": [
"text",
"cobertura"
],
"testPathIgnorePatterns": [
"spec.js"
],
"moduleNameMapper": {
"\\.css$": "identity-obj-proxy",
"\\.scss$": "identity-obj-proxy",
"\\.ico$": "identity-obj-proxy"
},
"setupFilesAfterEnv": [
"<rootDir>/setupTests.js"
],
"transformIgnorePatterns": [
"/node_modules/(?!wouter)"
],
"transform": {
"\\.[jt]sx?$": "babel-jest"
}
"webpack": "npm run webpack --workspace=js/packages/binderhub-frontend && cp -r js/packages/binderhub-frontend/dist binderhub/static ",
"webpack:watch": "npm run webpack --watch --workspace=js/packages/binderhub-frontend"
}
}
Loading