Skip to content

Draft: Use copier for project bootstrapping #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .gitmodules
Empty file.
10 changes: 5 additions & 5 deletions Dockerfile → Dockerfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ RUN wkhtmltopdf --enable-internal-links --enable-local-file-access \

FROM docker.io/nginxinc/nginx-unprivileged:1.27-alpine

LABEL maintainer="acend.ch"
LABEL org.opencontainers.image.title="acend.ch's CHANGEME Basics Training"
LABEL org.opencontainers.image.description="Container with acend.ch's CHANGEME Training content"
LABEL org.opencontainers.image.authors="acend.ch"
LABEL org.opencontainers.image.source="https://github.com/acend/changeme-training/"
LABEL maintainer="{{ organization }}.ch"
LABEL org.opencontainers.image.title="{{ organization }}.ch's {{ project_name }}"
LABEL org.opencontainers.image.description="Container with {{ organization }}.ch's {{ project_name }} content"
LABEL org.opencontainers.image.authors="{{ organization }}.ch"
LABEL org.opencontainers.image.source="https://github.com/{{ repository }}"
LABEL org.opencontainers.image.licenses="CC-BY-SA-4.0"

EXPOSE 8080
Expand Down
4 changes: 3 additions & 1 deletion README.md → README.md.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CHANGEME Training
# {{ project_name }}

CHANGEME Training Description

Expand Down Expand Up @@ -50,6 +50,7 @@ hugo mod get -u

#### `onlyWhen` and `onlyWhenNot`

{% raw %}
The `onlyWhen` and `onlyWhenNot` shortcodes allow text to be rendered if certain conditions apply.

* `{{% onlyWhen variant1 %}}`: This is only rendered when `enabledModule` in `config.toml` contains `variant1`
Expand All @@ -67,6 +68,7 @@ This is only rendered when `enabledModule` in `config.toml` **does not** contain
{{% /onlyWhen %}}
```

{% endraw %}

## Build production image locally

Expand Down
22 changes: 22 additions & 0 deletions copier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
project_name:
type: str
help: What is your project name?
placeholder: Helm Training

project_slug:
type: str
help: What is the slug of your project?
default: "{{ project_name | lower | replace(' ', '-') }}"

organization:
type: str
help: Which GitHub organization?
choices:
Acend: acend
Puzzle: puzzle
default: acend

repository:
type: str
help: What is your Git repository?
default: "{{ organization }}/{{ project_slug }}"
12 changes: 6 additions & 6 deletions package.json → package.json.jinja
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "changeme-training",
"name": "{{ project_slug }}",
"version": "0.0.9",
"description": "changeme Training",
"description": "{{ project_name }}",
"repository": {
"type": "git",
"url": "git+https://github.com/changeme/changeme-training.git"
"url": "git+https://github.com/{{ repository }}.git"
},
"author": "changeme",
"author": "{{ organization }}",
"scripts": {
"start": "bash -c \"docker run --rm --publish 8080:8080 -v $(pwd):/src:Z docker.io/klakegg/hugo:$(grep \"FROM docker.io/klakegg/hugo\" Dockerfile | sed 's/FROM docker.io\/klakegg\\/hugo://g' | sed 's/ AS builder//g') server -p 8080 --bind 0.0.0.0\"",
"mdlint": "markdownlint --config .markdownlint.json content *.md",
"mdlint-fix": "npm run mdlint -- --fix",
"prepare": "husky install"
},
"bugs": {
"url": "https://github.com/changeme/changeme-training/issues"
"url": "https://github.com/{{ repository }}/issues"
},
"homepage": "https://github.com/changeme/changeme-training#readme",
"homepage": "https://github.com/{{ repository }}#readme",
"devDependencies": {
"husky": "9.1.7",
"lint-staged": "15.2.10",
Expand Down
2 changes: 2 additions & 0 deletions {{_copier_conf.answers_file}}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changes here will be overwritten by Copier
{{ _copier_answers|to_nice_yaml -}}
Loading