Skip to content

Commit ee2a96a

Browse files
authored
Merge branch 'main' into feat/hosting-provider
2 parents d3fcc5c + 2fb9f27 commit ee2a96a

File tree

11 files changed

+38
-48
lines changed

11 files changed

+38
-48
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ repos:
2525
# sub-packages, which confuses pre-commit when it tries to find the latest
2626
# version
2727
- repo: https://github.com/adhtruong/mirrors-typos
28-
rev: v1.35.4
28+
rev: v1.35.5
2929
hooks:
3030
- id: typos

copier.yaml

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _tasks:
99
# Message to show after generating or regenerating the project successfully
1010
_message_after_copy: |
1111
12-
Your project "{{ package_name }}" has been created successfully!
12+
Your project "{{ github_repo }}" has been created successfully!
1313
1414
Next steps:
1515
@@ -40,38 +40,20 @@ _message_after_copy: |
4040
$ just list-todos
4141
4242
# Questions:
43-
package_github_repo:
44-
type: str
45-
help: "What is or will be the GitHub repository spec for the project?"
46-
placeholder: "user/repo"
47-
validator: |
48-
{% if package_github_repo and not (package_github_repo | regex_search('^[\w.-]+\/[\w.-]+$')) %}
49-
Must be in the format `user/repo` and contain only alphanumeric characters and `_`, `-`, or `.`.
50-
{% endif %}
43+
is_seedcase_project:
44+
type: bool
45+
help: "Is this package part of the Seedcase Project?"
46+
default: true
5147

52-
github_user:
48+
github_repo:
5349
type: str
54-
default: "{{ package_github_repo.split('/')[0] if package_github_repo else '' }}"
50+
default: "{{ _copier_conf.dst_path | realpath | basename }}"
5551
when: false
5652

57-
package_name:
53+
github_user:
5854
type: str
59-
help: "What is the name of the package?"
60-
default: "{{ _copier_conf.dst_path | basename }}"
61-
validator: |
62-
{% if package_name and not (package_name | regex_search('^[\w.-]+$')) %}
63-
Must contain only alphanumeric characters and `_`, `-`, or `.`.
64-
{% endif %}
65-
66-
package_name_snake_case:
67-
type: str
68-
default: "{{package_name | replace('-', '_') | replace('.', '_')}}"
69-
when: false
70-
71-
is_seedcase_project:
72-
type: bool
73-
help: "Is this package part of the Seedcase Project?"
74-
default: "{{ github_user == 'seedcase-project' }}"
55+
help: "What is the name of the GitHub user or organisation where the repository will be or is stored?"
56+
default: "{{ 'seedcase-project' if is_seedcase_project else '' }}"
7557

7658
hosting_provider:
7759
type: str
@@ -83,7 +65,7 @@ hosting_provider:
8365
homepage:
8466
type: str
8567
help: "What is the homepage of your project?"
86-
default: "{{ 'https://%s.seedcase-project.org' % package_name if is_seedcase_project else '' }}"
68+
default: "{{ 'https://%s.seedcase-project.org' % github_repo if is_seedcase_project else '' }}"
8769

8870
author_given_name:
8971
type: str
@@ -110,6 +92,16 @@ github_board_number:
11092
The board number must be an integer.
11193
{% endif %}
11294
95+
github_repo_snake_case:
96+
type: str
97+
default: "{{github_repo | replace('-', '_') | replace('.', '_')}}"
98+
when: false
99+
100+
github_repo_spec:
101+
type: str
102+
default: "{{ github_user }}/{{ github_repo }}"
103+
when: false
104+
113105
copyright_year:
114106
type: str
115107
default: "{{ copyright_year | default('%Y' | strftime) }}"

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ test is_seedcase_project="true" hosting_provider="netlify":
6060
--vcs-ref=$commit \
6161
--defaults \
6262
--trust \
63-
--data package_github_repo="first-last/repo" \
6463
--data is_seedcase_project={{ is_seedcase_project }} \
6564
--data hosting_provider={{ hosting_provider }} \
65+
--data github_user="first-last" \
6666
--data author_given_name="First" \
6767
--data author_family_name="Last" \
6868
--data author_email="[email protected]" \
@@ -95,9 +95,9 @@ test is_seedcase_project="true" hosting_provider="netlify":
9595
--defaults \
9696
--trust \
9797
--overwrite \
98-
--data package_github_repo="first-last/repo" \
9998
--data is_seedcase_project={{ is_seedcase_project }} \
10099
--data hosting_provider={{ hosting_provider }} \
100+
--data github_user="first-last" \
101101
--data author_given_name="First" \
102102
--data author_family_name="Last" \
103103
--data author_email="[email protected]" \

template/CITATION.cff.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ keywords:
2020
- ""
2121
license: MIT
2222
message: "If you use this Python package, please cite it using these metadata."
23-
repository-code: "https://github.com/{{ package_github_repo }}"
23+
repository-code: "https://github.com/{{ github_repo_spec }}"
2424
url: "{{ homepage }}"

template/LICENSE.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) {{ copyright_year }} {{ package_name }} authors
3+
Copyright (c) {{ copyright_year }} {{ github_repo }} authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

template/_quarto.yml.jinja

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ website:
1717
# TODO: Set the Netlify custom domain URL
1818
site-url: "{{ homepage }}"
1919
{%- endif %}
20-
repo-url: "https://github.com/{{ package_github_repo }}"
20+
repo-url: "https://github.com/{{ github_repo_spec }}"
2121
page-navigation: true
2222
navbar:
2323
pinned: true
2424
title: false
2525
{%- if is_seedcase_project %}
26-
logo: "_extensions/seedcase-project/seedcase-theme/logos/navbar-logo-{{ package_name }}.svg"
27-
logo-alt: "{{ package_name }} logo: Main page"
26+
logo: "_extensions/seedcase-project/seedcase-theme/logos/navbar-logo-{{ github_repo }}.svg"
27+
logo-alt: "{{ github_repo }} logo: Main page"
2828
{%- else %}
2929
# TODO: add logo
3030
logo: ""
31-
logo-alt: "{{ package_name }} logo: Main page"
31+
logo-alt: "{{ github_repo }} logo: Main page"
3232
{%- endif %}
3333
left:
3434
- text: "Guide"
@@ -37,7 +37,7 @@ website:
3737
href: docs/design/index.qmd
3838
tools:
3939
- icon: github
40-
href: "https://github.com/{{ package_github_repo }}"
40+
href: "https://github.com/{{ github_repo_spec }}"
4141
aria-label: "GitHub icon: Source code"
4242
{%- if is_seedcase_project %}
4343
- icon: house
@@ -60,7 +60,7 @@ quartodoc:
6060
sidebar: "docs/reference/_sidebar.yml"
6161
style: "pkgdown"
6262
dir: "docs/reference"
63-
package: "{{ package_name_snake_case }}"
63+
package: "{{ github_repo_snake_case }}"
6464
parser: google
6565
dynamic: true
6666
renderer:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<!-- TODO: Set up GoatCounter -->
2-
<script data-goatcounter="https://{{ github_user }}-{{ package_name }}.goatcounter.com/count" async
2+
<script data-goatcounter="https://{{ github_user }}-{{ github_repo }}.goatcounter.com/count" async
33
src="//gc.zgo.at/count.js"></script>

template/justfile.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ build-readme:
112112

113113
# Generate a Quarto include file with the contributors
114114
build-contributors:
115-
sh ./tools/get-contributors.sh {{ package_github_repo }}
115+
sh ./tools/get-contributors.sh {{ github_repo_spec }}
116116

117117
# Check for and apply updates from the template
118118
update-from-template:

template/pyproject.toml.jinja

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "{{ package_name }}"
2+
name = "{{ github_repo }}"
33
version = "0.1.0"
44
# TODO: Add a description of the package.
55
description = ""
@@ -19,11 +19,9 @@ dependencies = []
1919

2020
[project.urls]
2121
homepage = "{{ homepage }}"
22-
{%- if package_github_repo %}
23-
repository = "https://github.com/{{ package_github_repo }}"
24-
changelog = "https://github.com/{{ package_github_repo }}/blob/main/CHANGELOG.md"
25-
issues = "https://github.com/{{ package_github_repo }}/issues"
26-
{% endif %}
22+
repository = "https://github.com/{{ github_repo_spec }}"
23+
changelog = "https://github.com/{{ github_repo_spec }}/blob/main/CHANGELOG.md"
24+
issues = "https://github.com/{{ github_repo_spec }}/issues"
2725

2826
[build-system]
2927
requires = ["hatchling"]
File renamed without changes.

0 commit comments

Comments
 (0)