Skip to content

Commit

Permalink
feat: First frontend implements with environment
Browse files Browse the repository at this point in the history
- Use TypeScript for codebase.
- Use esbuild for bundle sources to ESModule.
- Use biome for formatting and linting (with pre-commit).
- Bundle generated file into Python package.

Refs: #2
  • Loading branch information
attakei committed May 16, 2024
1 parent 0fc71ba commit d6b86af
Show file tree
Hide file tree
Showing 11 changed files with 659 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: volta-cli/action@v4
- name: Build static files
run: |
npm i
npm run build
- name: Configure venv
run: |
pip install uv
Expand Down Expand Up @@ -69,8 +74,11 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- uses: volta-cli/action@v4
- name: Build package
run: |
npm i
npm run build
pip install hatch
hatch build
ls -l dist
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ repos:
- id: doc8
args:
- --max-line-length=119
- repo: https://github.com/biomejs/pre-commit
rev: ""
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/[email protected]"]
6 changes: 6 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"formatter": {
"indentStyle": "space"
}
}
14 changes: 14 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node
/**
* Configuration to bundle scripts for esbuild.
*/
import * as esbuild from "esbuild";

await esbuild.build({
entryPoints: ["src/frontend/main.ts"],
bundle: true,
minify: process.env.NODE_ENV === "production",
sourcemap: process.env.NODE_ENV !== "production",
outfile: "src/atsphinx/mini18n/_static/atsphinx-mini18n.js",
target: ["chrome58", "firefox57", "safari11", "edge16"],
});
Loading

0 comments on commit d6b86af

Please sign in to comment.