Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 19 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ jobs:
- rust
- rustjswasm
- cppjswasm
- uitk-svelte
- uitk-webawesome
os:
- ubuntu-latest
- macos-latest
exclude:
- template: uitk-svelte
os: macos-latest
- template: uitk-webawesome
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down Expand Up @@ -79,7 +86,7 @@ jobs:
version: 22.x
pnpm_version: 11.11.0
js_folder: "."
if: matrix.template == 'js' || matrix.template == 'jupyter' || matrix.template == 'cppjswasm' || matrix.template == 'rustjswasm'
if: matrix.template == 'js' || matrix.template == 'jupyter' || matrix.template == 'cppjswasm' || matrix.template == 'rustjswasm' || matrix.template == 'uitk-svelte' || matrix.template == 'uitk-webawesome'

- name: Setup Rust
uses: actions-ext/rust/setup@2db8e3e4c56beb7320c7d730bd2c2d6a6447bf6b
Expand All @@ -93,7 +100,15 @@ jobs:
run: cargo build
if: matrix.template == 'rust' || matrix.template == 'rustjswasm'

- name: Generate and test template
- name: Generate template
run: make gen-${{ matrix.template }}

- name: Install UI toolkit dependencies and browser
run: |
make gen-${{ matrix.template }}
make test-${{ matrix.template }}
cd ../javascript-template-${{ matrix.template }}
pnpm install
pnpm exec playwright install --with-deps chromium
if: matrix.template == 'uitk-svelte' || matrix.template == 'uitk-webawesome'

- name: Test template
run: make test-${{ matrix.template }}
30 changes: 28 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fix: ## fix formatting in this repo
format: fix
test: ## run tests for this repo

.PHONY: gen-python gen-cpp gen-js gen-jupyter gen-rust gen-rustjswasm
.PHONY: gen-python gen-cpp gen-js gen-jupyter gen-rust gen-rustjswasm gen-cppjswasm gen-uitk-svelte gen-uitk-webawesome
gen-python: ## regenerate the python template from scratch
mkdir -p ../python-template && cd ../python-template && rm -rf ./* && rm -rf .copier-answers.yaml .gitignore .github .gitattributes
copier copy -w . ../python-template --data-file examples/python.yaml
Expand Down Expand Up @@ -60,7 +60,15 @@ gen-cppjswasm: ## regenerate the cppjswasm template from scratch
copier copy -w . ../python-template-cppjswasm --data-file examples/cppjswasm.yaml
cd ../python-template-cppjswasm && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yaml

.PHONY: test-python test-cpp test-js test-jupyter test-rust test-rustjswasm
gen-uitk-svelte: ## regenerate the Svelte UI toolkit template from scratch
mkdir -p ../javascript-template-uitk-svelte && cd ../javascript-template-uitk-svelte && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc
copier copy -w . ../javascript-template-uitk-svelte --data-file examples/uitk-svelte.yaml

gen-uitk-webawesome: ## regenerate the Lit and Web Awesome UI toolkit template from scratch
mkdir -p ../javascript-template-uitk-webawesome && cd ../javascript-template-uitk-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc
copier copy -w . ../javascript-template-uitk-webawesome --data-file examples/uitk-webawesome.yaml

.PHONY: test-python test-cpp test-js test-jupyter test-rust test-rustjswasm test-cppjswasm test-uitk-svelte test-uitk-webawesome
test-python:
cd ../python-template && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@users.noreply.github.c@example.com" && git init && git add . && git commit -m "initial commit"
cd ../python-template && make develop
Expand Down Expand Up @@ -115,3 +123,21 @@ test-cppjswasm:
cd ../python-template-cppjswasm && make lint
cd ../python-template-cppjswasm && make checks
cd ../python-template-cppjswasm && make test

test-uitk-svelte:
cd ../javascript-template-uitk-svelte && pnpm install
cd ../javascript-template-uitk-svelte && pnpm exec playwright install chromium
cd ../javascript-template-uitk-svelte && pnpm lint
cd ../javascript-template-uitk-svelte && pnpm check
cd ../javascript-template-uitk-svelte && pnpm build
cd ../javascript-template-uitk-svelte && pnpm test:unit
cd ../javascript-template-uitk-svelte && CI=1 pnpm test:e2e

test-uitk-webawesome:
cd ../javascript-template-uitk-webawesome && pnpm install
cd ../javascript-template-uitk-webawesome && pnpm exec playwright install chromium
cd ../javascript-template-uitk-webawesome && pnpm lint
cd ../javascript-template-uitk-webawesome && pnpm check
cd ../javascript-template-uitk-webawesome && pnpm build
cd ../javascript-template-uitk-webawesome && pnpm test:unit
cd ../javascript-template-uitk-webawesome && CI=1 pnpm test:e2e
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python Project Template Base
# Project Template Base

This project uses [copier](https://copier.readthedocs.io/en/stable/) to provide several python project templates. See our [homepage](https://github.com/python-project-templates) for more information!
This project uses [copier](https://copier.readthedocs.io/en/stable/) to provide Python and JavaScript project templates. See our [homepage](https://github.com/python-project-templates) for more information.

[![Homepage](https://img.shields.io/badge/homepage-Go-blue?style=for-the-badge)](https://github.com/python-project-templates)
[![Copier](https://img.shields.io/badge/Copier-Template-f8c200.svg?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iNzgiIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNEREQiIHN0cm9rZT0iI0RERCIgc3Ryb2tlLXdpZHRoPSI2IiBkPSJtNzUuMjQgOC41OTMgMTcuODE4IDEzLjg0NWE5LjIgOS4yIDAgMCAxIDEuNjIyIDEyLjkzOEw2Ny4yMjQgNzAuNzA5YTkuMiA5LjIgMCAwIDEtMTIuOTM4IDEuNjIzTDM2LjQ2OSA1OC40ODZhOS4yIDkuMiAwIDAgMS0xLjYyMy0xMi45MzhsMjcuNDU3LTM1LjMzM0E5LjIgOS4yIDAgMCAxIDc1LjI0IDguNTkzWm0tMTkuODg0LTQuNTIgMjAuNTMgOS4zNjJhOS4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gOS4yIDAgMCAxIDEyLjIxNC00LjU2NFoiLz48cGF0aCBmaWxsPSIjRjNGNEY2IiBzdHJva2U9IiMwMDAiIHN0cm9rZS13aWR0aD0iMi40MjIiIGQ9Im03NS4yNCA4LjU5MyAxNy44MTggMTMuODQ1YTkuMiA5LjIgMCAwIDEgMS42MjIgMTIuOTM4TDY3LjIyNCA3MC43MDlhOS4yIDkuMiAwIDAgMS0xMi45MzggMS42MjNMMzYuNDY5IDU4LjQ4NmE5LjIgOS4yIDAgMCAxLTEuNjIzLTEyLjkzOGwyNy40NTctMzUuMzMzQTkuMiA5LjIgMCAwIDEgNzUuMjQgOC41OTNaIi8+PC9zdmc+)](https://copier.readthedocs.io/en/stable/)
Expand All @@ -13,3 +13,9 @@ copier copy https://github.com/python-project-templates/base.git path/to/new/pro

> [!NOTE]
> Install the [Python Templates Copier Update GitHub App](https://github.com/apps/python-templates-copier-update) on repositories generated from this template to receive weekly template update pull requests.

One selector chooses a template:

- `Python / …` options generate pure Python, C++, JavaScript, Jupyter, Rust, and WebAssembly-backed Python packages from `python/`.
- `JavaScript / UI Toolkit / Svelte` generates a Svelte package and showcase from `javascript/uitk-svelte/`.
- `JavaScript / UI Toolkit / Lit + Web Awesome` generates custom elements and a showcase from `javascript/uitk-webawesome/`.
50 changes: 42 additions & 8 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,37 @@ github:
team:
type: str
help: What is your name or your team's name?
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"

email:
type: str
help: What is your email?
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"

add_extension:
type: str
help: Which project template should Copier use?
choices:
none:
Python / Pure:
value: python
"C++":
Python / C++:
value: cpp
JavaScript:
Python / JavaScript:
value: js
Rust:
Python / Rust:
value: rust
Jupyter Widget:
Python / Jupyter Widget:
value: jupyter
Rust JavaScript WebAssembly:
Python / Rust + JavaScript + WebAssembly:
value: rustjswasm
"C++ JavaScript WebAssembly":
Python / C++ + JavaScript + WebAssembly:
value: cppjswasm
JavaScript / UI Toolkit / Svelte:
value: uitk-svelte
JavaScript / UI Toolkit / Lit + Web Awesome:
value: uitk-webawesome

_subdirectory: "{{ add_extension }}"
_subdirectory: "{% if add_extension == 'python' %}python/pure{% elif add_extension in ['uitk-svelte', 'uitk-webawesome'] %}javascript/{{ add_extension }}{% else %}python/{{ add_extension }}{% endif %}"

add_vcpkg:
type: bool
Expand All @@ -73,13 +80,40 @@ python_version_primary:
"3.13":
value: "3.13"
help: Primary version of Python to use in CI/CD
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"

add_docs:
type: bool
default: false
help: Add documentation using Yardang/Sphinx
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"

add_wiki:
type: bool
default: false
help: Add documentation using GitHub wiki
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"

package_name:
type: str
help: What is the npm package name?
default: "@example/branding"
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"

brand_name:
type: str
help: What is the human-readable brand name?
default: "{{ project_name }}"
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"

css_prefix:
type: str
help: What prefix should global CSS custom properties use?
default: brand
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"

element_prefix:
type: str
help: What prefix should custom elements use?
default: brand
when: "{{ add_extension == 'uitk-webawesome' }}"
8 changes: 8 additions & 0 deletions examples/uitk-svelte.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
add_extension: uitk-svelte
brand_name: Example
css_prefix: example
github: example
package_name: '@example/branding'
project_description: Shared brand identity, design tokens, and reusable Svelte components.
project_name: example-branding
9 changes: 9 additions & 0 deletions examples/uitk-webawesome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
add_extension: uitk-webawesome
brand_name: Example
css_prefix: example
element_prefix: example
github: example
package_name: '@example/branding'
project_description: Shared brand identity, design tokens, and reusable Lit and Web Awesome components.
project_name: example-branding
33 changes: 33 additions & 0 deletions javascript/uitk-svelte/.github/workflows/build.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Status

on:
push:
branches: [main]
tags: [v*]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v7
with:
node-version: 22.x
cache: pnpm
- run: pnpm install
- run: pnpm build
- run: pnpm check
- run: pnpm lint
- run: pnpm test:unit
- run: pnpm exec playwright install --with-deps chromium
- run: pnpm test:e2e
env:
CI: '1'
8 changes: 8 additions & 0 deletions javascript/uitk-svelte/.gitignore.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
/dist
/.svelte-kit
/build
/coverage
/playwright-report
/test-results
.DS_Store
9 changes: 9 additions & 0 deletions javascript/uitk-svelte/.prettierignore.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.copier-answers.yaml
node_modules
dist
pnpm-lock.yaml
.svelte-kit
build
coverage
playwright-report
test-results
9 changes: 9 additions & 0 deletions javascript/uitk-svelte/.prettierrc.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 120,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
37 changes: 37 additions & 0 deletions javascript/uitk-svelte/BRAND.md.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# {{ brand_name }} Brand Guide

Canonical source for the {{ brand_name }} identity. Replace each placeholder before publishing the first consumer.

## Identity

Describe what {{ brand_name }} is, who it serves, and what it must not be confused with.

## Mark

Document primary mark, clear space, minimum size, and approved variants.

## Color

| Role | Light | Dark | Usage |
| ------ | --------- | --------- | ------------------ |
| Paper | `#f5f5f0` | `#151515` | Page surfaces |
| Ink | `#151515` | `#f5f5f0` | Primary content |
| Muted | `#666660` | `#aaa9a0` | Supporting content |
| Line | `#d0d0c8` | `#3a3a36` | Borders and rules |
| Accent | `#6cff8f` | `#6cff8f` | Focus and emphasis |

## Typography

Document font families, weights, scale, tracking, and fallback behavior.

## Composition

Document spacing, layout, shape, imagery, and data-visualization rules.

## Motion

Document purposeful transitions and reduced-motion behavior.

## Voice

Document preferred vocabulary, sentence style, capitalization, and examples.
40 changes: 40 additions & 0 deletions javascript/uitk-svelte/README.md.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# {{ package_name }}

{{ project_description }}

See [`BRAND.md`](./BRAND.md) for the canonical brand guide.

## Install

```bash
pnpm add {{ package_name }}
```

Import design tokens once at the application root:

```css
@import '{{ package_name }}/tokens.css';
```

```svelte
<script lang="ts">
import { BrandMark, ThemeToggle } from '{{ package_name }}';
</script>

<BrandMark />
<ThemeToggle />
```

## Develop

```bash
pnpm install
pnpm dev
pnpm check
pnpm lint
pnpm fix
pnpm test
pnpm build
```

After customizing the showcase, run `pnpm test:e2e:update` once to establish its visual baseline.
Loading
Loading