Skip to content

Commit

Permalink
Update releaser config
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Mar 12, 2024
1 parent ec2fc86 commit 073ed80
Show file tree
Hide file tree
Showing 9 changed files with 780 additions and 587 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ jobs:
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('frontend/yarn.lock') }}
key: yarn-${{ hashFiles('./yarn.lock') }}
restore-keys: |
yarn-
- name: Lint the application
shell: bash -l {0}
working-directory: frontend
run: |
set -eux
yarn install
Expand Down Expand Up @@ -181,7 +180,7 @@ jobs:
- name: Install UI test dependencies
shell: bash -l {0}
working-directory: frontend/ui-tests
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: yarn install
Expand All @@ -191,16 +190,16 @@ jobs:
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('frontend/ui-tests/yarn.lock') }}
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}

- name: Install browser
shell: bash -l {0}
run: npx playwright install chromium
working-directory: frontend/ui-tests
working-directory: ui-tests

- name: Execute integration tests
shell: bash -l {0}
working-directory: frontend/ui-tests
working-directory: ui-tests
run: |
npx playwright test
Expand All @@ -210,5 +209,5 @@ jobs:
with:
name: tljh-playwright-tests
path: |
frontend/ui-tests/test-results
frontend/ui-tests/playwright-report
ui-tests/test-results
ui-tests/playwright-report
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ MANIFEST
# Local TLJH config file
config.yaml

# Frontend assets
.yarn
node_modules
frontend/dist
frontend/lib
frontend/ui-tests/playwright-report
frontend/ui-tests/test-results
**/js/react/
dist/
ui-tests/playwright-report
ui-tests/test-results
**/js
lib/

# Hatch version
_version.py
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "tljh_repo2docker frontend package",
"license": "BSD-3-Clause",
"scripts": {
"watch": "cross-env NODE_ENV=development webpack watch --config webpack.config.js",
"build": "cross-env NODE_ENV=development webpack --config webpack.config.js",
"build:prod": "cross-env NODE_ENV=production webpack --config webpack.config.js",
"eslint": "eslint --fix --ext .js,.jsx,.ts,.tsx src/",
Expand All @@ -12,7 +13,7 @@
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"lint": "yarn prettier && yarn eslint",
"lint:check": "yarn prettier:check && yarn eslint:check",
"clean": "rimraf ./lib ./tljh_repo2docker/static/js/react"
"clean": "rimraf ./lib ./tljh_repo2docker/static/js"
},
"devDependencies": {
"@types/react": "^18.2.0",
Expand Down
51 changes: 41 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,65 @@
[build-system]
requires = ["hatchling>=1.5.0,<2"]
build-backend = "hatchling.build"
requires = ["hatchling>=1.5.0,<2", "hatch-nodejs-version>=0.3.2"]

[project]
name = "tljh-repo2docker"
dynamic = ["version"]
readme = "README.md"
license = { file = "LICENSE" }
dependencies = [
"aiodocker~=0.19",
"dockerspawner~=12.1",
"jupyter_client>=6.1,<8"
"aiodocker~=0.19",
"dockerspawner~=12.1",
"jupyter_client>=6.1,<8",
]
dynamic = ["version"]
license = {file = "LICENSE"}
name = "tljh-repo2docker"
readme = "README.md"

[project.entry-points.tljh]
tljh_repo2docker = "tljh_repo2docker"

[tool.hatch.version]
path = "tljh_repo2docker/__version__.py"
source = "nodejs"

[tool.hatch.build.targets.sdist]
include = ["/tljh_repo2docker"]
artifacts = ["tljh_repo2docker/static"]
exclude = [".github"]
include = ["/tljh_repo2docker"]

[tool.hatch.build.hooks.version]
path = "tljh_repo2docker/_version.py"

[tool.hatch.build.hooks.jupyter-builder]
build-function = "hatch_jupyter_builder.npm_builder"
dependencies = ["hatch-jupyter-builder>=0.5"]
ensured-targets = [
"tljh_repo2docker/static/js/server.js",
"tljh_repo2docker/static/js/environments.js",
]
skip-if-exists = [
"tljh_repo2docker/static/js/server.js",
"tljh_repo2docker/static/js/environments.js",
]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
npm = ["yarn"]

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
build_cmd = "build"
npm = ["yarn"]
source_dir = "src"
build_dir = "tljh_repo2docker/static/js"

[tool.jupyter-releaser.options]
version_cmd = "hatch version"

[tool.jupyter-releaser.hooks]
before-bump-version = ["python -m pip install hatch"]
before-build-npm = [
"yarn install",
"yarn build:prod"
]
before-build-python = ["yarn clean"]


[tool.check-wheel-contents]
ignore = ["W002"]
1 change: 0 additions & 1 deletion tljh_repo2docker/__version__.py

This file was deleted.

2 changes: 1 addition & 1 deletion tljh_repo2docker/templates/images.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<script id="tljh-page-data" type="application/json">
{"images": {{ images | tojson }}, "default_mem_limit": "{{default_mem_limit}}", "default_cpu_limit":"{{default_cpu_limit}}", "machine_profiles": {{ machine_profiles | tojson }}}
</script>
<script src="{{ base_url }}environments-static/js/react/environments.js"></script>
<script src="{{ base_url }}environments-static/js/environments.js"></script>
</div>
{% endblock %}
2 changes: 1 addition & 1 deletion tljh_repo2docker/templates/servers.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"images": {{ images | tojson }}, "allow_named_servers": {{allow_named_servers | tojson}}, "named_server_limit_per_user": {{named_server_limit_per_user}}, "server_data": {{ server_data| tojson }}, "default_server_data": {{ default_server_data| tojson }}
}
</script>
<script src="{{ base_url }}environments-static/js/react/servers.js"></script>
<script src="{{ base_url }}environments-static/js/servers.js"></script>
</div>
{% endblock %}
5 changes: 2 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const path = require('path');

const config = {
mode: process.env.NODE_ENV ?? 'development',
watch: process.env.NODE_ENV === 'production' ? false : true,
module: {
rules: [
{
Expand Down Expand Up @@ -32,7 +31,7 @@ const environmentsPageConfig = {
name: 'environments',
entry: './src/environments/main.tsx',
output: {
path: path.resolve(distRoot, 'react'),
path: distRoot,
filename: 'environments.js'
},
...config
Expand All @@ -41,7 +40,7 @@ const serversPageConfig = {
name: 'servers',
entry: './src/servers/main.tsx',
output: {
path: path.resolve(distRoot, 'react'),
path: distRoot,
filename: 'servers.js'
},
...config
Expand Down
Loading

0 comments on commit 073ed80

Please sign in to comment.