Skip to content

Commit 3377dcd

Browse files
committed
Organize templates by language
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
1 parent 3be0a2e commit 3377dcd

322 files changed

Lines changed: 1212 additions & 16 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ jobs:
3131
- rust
3232
- rustjswasm
3333
- cppjswasm
34+
- uitk-svelte
35+
- uitk-webawesome
3436
os:
3537
- ubuntu-latest
3638
- macos-latest
39+
exclude:
40+
- template: uitk-svelte
41+
os: macos-latest
42+
- template: uitk-webawesome
43+
os: macos-latest
3744
runs-on: ${{ matrix.os }}
3845
steps:
3946
- name: Checkout
@@ -79,7 +86,7 @@ jobs:
7986
version: 22.x
8087
pnpm_version: 11.11.0
8188
js_folder: "."
82-
if: matrix.template == 'js' || matrix.template == 'jupyter' || matrix.template == 'cppjswasm' || matrix.template == 'rustjswasm'
89+
if: matrix.template == 'js' || matrix.template == 'jupyter' || matrix.template == 'cppjswasm' || matrix.template == 'rustjswasm' || matrix.template == 'uitk-svelte' || matrix.template == 'uitk-webawesome'
8390

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

96-
- name: Generate and test template
103+
- name: Generate template
104+
run: make gen-${{ matrix.template }}
105+
106+
- name: Install UI toolkit dependencies and browser
97107
run: |
98-
make gen-${{ matrix.template }}
99-
make test-${{ matrix.template }}
108+
cd ../javascript-template-${{ matrix.template }}
109+
pnpm install
110+
pnpm exec playwright install --with-deps chromium
111+
if: matrix.template == 'uitk-svelte' || matrix.template == 'uitk-webawesome'
112+
113+
- name: Test template
114+
run: make test-${{ matrix.template }}

Makefile

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fix: ## fix formatting in this repo
2424
format: fix
2525
test: ## run tests for this repo
2626

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

63-
.PHONY: test-python test-cpp test-js test-jupyter test-rust test-rustjswasm
63+
gen-uitk-svelte: ## regenerate the Svelte UI toolkit template from scratch
64+
mkdir -p ../javascript-template-uitk-svelte && cd ../javascript-template-uitk-svelte && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc
65+
copier copy -w . ../javascript-template-uitk-svelte --data-file examples/uitk-svelte.yaml
66+
67+
gen-uitk-webawesome: ## regenerate the Lit and Web Awesome UI toolkit template from scratch
68+
mkdir -p ../javascript-template-uitk-webawesome && cd ../javascript-template-uitk-webawesome && rm -rf ./* && rm -rf .copier-answers.yaml .github .gitignore .prettierignore .prettierrc
69+
copier copy -w . ../javascript-template-uitk-webawesome --data-file examples/uitk-webawesome.yaml
70+
71+
.PHONY: test-python test-cpp test-js test-jupyter test-rust test-rustjswasm test-cppjswasm test-uitk-svelte test-uitk-webawesome
6472
test-python:
6573
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"
6674
cd ../python-template && make develop
@@ -115,3 +123,21 @@ test-cppjswasm:
115123
cd ../python-template-cppjswasm && make lint
116124
cd ../python-template-cppjswasm && make checks
117125
cd ../python-template-cppjswasm && make test
126+
127+
test-uitk-svelte:
128+
cd ../javascript-template-uitk-svelte && pnpm install
129+
cd ../javascript-template-uitk-svelte && pnpm exec playwright install chromium
130+
cd ../javascript-template-uitk-svelte && pnpm lint
131+
cd ../javascript-template-uitk-svelte && pnpm check
132+
cd ../javascript-template-uitk-svelte && pnpm build
133+
cd ../javascript-template-uitk-svelte && pnpm test:unit
134+
cd ../javascript-template-uitk-svelte && CI=1 pnpm test:e2e
135+
136+
test-uitk-webawesome:
137+
cd ../javascript-template-uitk-webawesome && pnpm install
138+
cd ../javascript-template-uitk-webawesome && pnpm exec playwright install chromium
139+
cd ../javascript-template-uitk-webawesome && pnpm lint
140+
cd ../javascript-template-uitk-webawesome && pnpm check
141+
cd ../javascript-template-uitk-webawesome && pnpm build
142+
cd ../javascript-template-uitk-webawesome && pnpm test:unit
143+
cd ../javascript-template-uitk-webawesome && CI=1 pnpm test:e2e

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Python Project Template Base
1+
# Project Template Base
22

3-
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!
3+
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.
44

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

1414
> [!NOTE]
1515
> 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.
16+
17+
One selector chooses a template:
18+
19+
- `Python / …` options generate pure Python, C++, JavaScript, Jupyter, Rust, and WebAssembly-backed Python packages from `python/`.
20+
- `JavaScript / UI Toolkit / Svelte` generates a Svelte package and showcase from `javascript/uitk-svelte/`.
21+
- `JavaScript / UI Toolkit / Lit + Web Awesome` generates custom elements and a showcase from `javascript/uitk-webawesome/`.

copier.yaml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,37 @@ github:
2929
team:
3030
type: str
3131
help: What is your name or your team's name?
32+
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"
3233

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

3739
add_extension:
3840
type: str
41+
help: Which project template should Copier use?
3942
choices:
40-
none:
43+
Python / Pure:
4144
value: python
42-
"C++":
45+
Python / C++:
4346
value: cpp
44-
JavaScript:
47+
Python / JavaScript:
4548
value: js
46-
Rust:
49+
Python / Rust:
4750
value: rust
48-
Jupyter Widget:
51+
Python / Jupyter Widget:
4952
value: jupyter
50-
Rust JavaScript WebAssembly:
53+
Python / Rust + JavaScript + WebAssembly:
5154
value: rustjswasm
52-
"C++ JavaScript WebAssembly":
55+
Python / C++ + JavaScript + WebAssembly:
5356
value: cppjswasm
57+
JavaScript / UI Toolkit / Svelte:
58+
value: uitk-svelte
59+
JavaScript / UI Toolkit / Lit + Web Awesome:
60+
value: uitk-webawesome
5461

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

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

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

8291
add_wiki:
8392
type: bool
8493
default: false
8594
help: Add documentation using GitHub wiki
95+
when: "{{ add_extension not in ['uitk-svelte', 'uitk-webawesome'] }}"
96+
97+
package_name:
98+
type: str
99+
help: What is the npm package name?
100+
default: "@example/branding"
101+
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"
102+
103+
brand_name:
104+
type: str
105+
help: What is the human-readable brand name?
106+
default: "{{ project_name }}"
107+
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"
108+
109+
css_prefix:
110+
type: str
111+
help: What prefix should global CSS custom properties use?
112+
default: brand
113+
when: "{{ add_extension in ['uitk-svelte', 'uitk-webawesome'] }}"
114+
115+
element_prefix:
116+
type: str
117+
help: What prefix should custom elements use?
118+
default: brand
119+
when: "{{ add_extension == 'uitk-webawesome' }}"

examples/uitk-svelte.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
add_extension: uitk-svelte
3+
brand_name: Example
4+
css_prefix: example
5+
github: example
6+
package_name: '@example/branding'
7+
project_description: Shared brand identity, design tokens, and reusable Svelte components.
8+
project_name: example-branding

examples/uitk-webawesome.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
add_extension: uitk-webawesome
3+
brand_name: Example
4+
css_prefix: example
5+
element_prefix: example
6+
github: example
7+
package_name: '@example/branding'
8+
project_description: Shared brand identity, design tokens, and reusable Lit and Web Awesome components.
9+
project_name: example-branding
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: [v*]
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v7
18+
- uses: pnpm/action-setup@v6
19+
with:
20+
version: 11
21+
- uses: actions/setup-node@v7
22+
with:
23+
node-version: 22.x
24+
cache: pnpm
25+
- run: pnpm install
26+
- run: pnpm build
27+
- run: pnpm check
28+
- run: pnpm lint
29+
- run: pnpm test:unit
30+
- run: pnpm exec playwright install --with-deps chromium
31+
- run: pnpm test:e2e
32+
env:
33+
CI: '1'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
/dist
3+
/.svelte-kit
4+
/build
5+
/coverage
6+
/playwright-report
7+
/test-results
8+
.DS_Store
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.copier-answers.yaml
2+
node_modules
3+
dist
4+
pnpm-lock.yaml
5+
.svelte-kit
6+
build
7+
coverage
8+
playwright-report
9+
test-results
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 120,
3+
"semi": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "none",
7+
"plugins": ["prettier-plugin-svelte"],
8+
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
9+
}

0 commit comments

Comments
 (0)