jekyll-theme-zer0 0.22.0 → 0.22.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +236 -0
- data/README.md +66 -19
- data/_data/navigation/admin.yml +53 -0
- data/_data/theme_backgrounds.yml +121 -0
- data/_includes/components/admin-tabs.html +59 -0
- data/_includes/components/analytics-dashboard.html +232 -0
- data/_includes/components/background-customizer.html +159 -0
- data/_includes/components/background-settings.html +137 -0
- data/_includes/components/collection-manager.html +151 -0
- data/_includes/components/component-showcase.html +452 -0
- data/_includes/components/config-editor.html +207 -0
- data/_includes/components/config-viewer.html +479 -0
- data/_includes/components/env-dashboard.html +154 -0
- data/_includes/components/feature-card.html +94 -0
- data/_includes/components/info-section.html +172 -149
- data/_includes/components/js-cdn.html +4 -1
- data/_includes/components/nav-editor.html +99 -0
- data/_includes/components/setup-banner.html +28 -0
- data/_includes/components/setup-check.html +53 -0
- data/_includes/components/svg-background.html +42 -0
- data/_includes/components/theme-customizer.html +46 -0
- data/_includes/content/seo.html +68 -135
- data/_includes/core/footer.html +1 -1
- data/_includes/core/head.html +3 -2
- data/_includes/core/header.html +14 -7
- data/_includes/landing/landing-install-cards.html +18 -7
- data/_includes/navigation/admin-nav.html +95 -0
- data/_includes/navigation/navbar.html +43 -5
- data/_includes/navigation/sidebar-left.html +1 -1
- data/_includes/setup/wizard.html +330 -0
- data/_layouts/admin.html +166 -0
- data/_layouts/landing.html +23 -9
- data/_layouts/root.html +12 -6
- data/_layouts/setup.html +73 -0
- data/_plugins/preview_image_generator.rb +26 -12
- data/_sass/core/_navbar.scss +2 -2
- data/_sass/custom.scss +28 -6
- data/_sass/theme/_background-mixins.scss +95 -0
- data/_sass/theme/_backgrounds.scss +156 -0
- data/_sass/theme/_color-modes.scss +2 -1
- data/assets/backgrounds/gradients/air.svg +15 -0
- data/assets/backgrounds/gradients/aqua.svg +15 -0
- data/assets/backgrounds/gradients/contrast.svg +15 -0
- data/assets/backgrounds/gradients/dark.svg +15 -0
- data/assets/backgrounds/gradients/dirt.svg +15 -0
- data/assets/backgrounds/gradients/mint.svg +15 -0
- data/assets/backgrounds/gradients/neon.svg +15 -0
- data/assets/backgrounds/gradients/plum.svg +15 -0
- data/assets/backgrounds/gradients/sunrise.svg +15 -0
- data/assets/backgrounds/noise/air.svg +8 -0
- data/assets/backgrounds/noise/aqua.svg +8 -0
- data/assets/backgrounds/noise/contrast.svg +8 -0
- data/assets/backgrounds/noise/dark.svg +8 -0
- data/assets/backgrounds/noise/dirt.svg +8 -0
- data/assets/backgrounds/noise/mint.svg +8 -0
- data/assets/backgrounds/noise/neon.svg +8 -0
- data/assets/backgrounds/noise/plum.svg +8 -0
- data/assets/backgrounds/noise/sunrise.svg +8 -0
- data/assets/backgrounds/patterns/air.svg +7 -0
- data/assets/backgrounds/patterns/aqua.svg +7 -0
- data/assets/backgrounds/patterns/contrast.svg +4 -0
- data/assets/backgrounds/patterns/dark.svg +5 -0
- data/assets/backgrounds/patterns/dirt.svg +5 -0
- data/assets/backgrounds/patterns/mint.svg +6 -0
- data/assets/backgrounds/patterns/neon.svg +6 -0
- data/assets/backgrounds/patterns/plum.svg +6 -0
- data/assets/backgrounds/patterns/sunrise.svg +5 -0
- data/assets/js/background-customizer.js +73 -0
- data/assets/js/code-copy.js +18 -47
- data/assets/js/config-utility.js +307 -0
- data/assets/js/nav-editor.js +39 -0
- data/assets/js/palette-generator.js +415 -0
- data/assets/js/search-modal.js +31 -11
- data/assets/js/setup-wizard.js +306 -0
- data/assets/js/skin-editor.js +645 -0
- data/assets/js/theme-customizer.js +102 -0
- data/assets/js/ui-enhancements.js +15 -24
- data/assets/vendor/bootstrap/css/bootstrap.min.css +1 -0
- data/assets/vendor/bootstrap/js/bootstrap.bundle.min.js +1 -0
- data/scripts/README.md +45 -0
- data/scripts/features/generate-preview-images +297 -7
- data/scripts/features/install-preview-generator +51 -33
- data/scripts/fork-cleanup.sh +92 -19
- data/scripts/github-setup.sh +284 -0
- data/scripts/init_setup.sh +0 -1
- data/scripts/lib/frontmatter.sh +543 -0
- data/scripts/lib/migrate.sh +265 -0
- data/scripts/lib/preview_generator.py +607 -32
- data/scripts/lint-pages +505 -0
- data/scripts/migrate.sh +201 -0
- data/scripts/platform/setup-linux.sh +244 -0
- data/scripts/platform/setup-macos.sh +187 -0
- data/scripts/platform/setup-wsl.sh +196 -0
- metadata +71 -6
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# =========================================================================
|
|
4
|
+
# Migration Library for Zer0-Mistakes Theme
|
|
5
|
+
# =========================================================================
|
|
6
|
+
# Provides functions for migrating / installing optional theme features
|
|
7
|
+
# (admin pages, settings UI, etc.) into consumer Jekyll sites.
|
|
8
|
+
#
|
|
9
|
+
# Source this file in other scripts:
|
|
10
|
+
# source "$(dirname "$0")/lib/migrate.sh"
|
|
11
|
+
#
|
|
12
|
+
# Dependencies:
|
|
13
|
+
# - common.sh (logging, dry_run_exec, confirm)
|
|
14
|
+
# - template.sh (render_template, load_config)
|
|
15
|
+
# =========================================================================
|
|
16
|
+
|
|
17
|
+
# Admin page template names (without .md.template suffix)
|
|
18
|
+
ADMIN_PAGES=(
|
|
19
|
+
theme
|
|
20
|
+
config
|
|
21
|
+
navigation
|
|
22
|
+
collections
|
|
23
|
+
analytics
|
|
24
|
+
environment
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Default admin pages output directory (relative to site root)
|
|
28
|
+
ADMIN_OUTPUT_DIR="pages/_about/settings"
|
|
29
|
+
|
|
30
|
+
# -------------------------------------------------------------------------
|
|
31
|
+
# Detection & Validation
|
|
32
|
+
# -------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
# Detect whether a directory looks like a Jekyll site
|
|
35
|
+
# Usage: detect_jekyll_site "/path/to/site"
|
|
36
|
+
# Returns 0 if it looks like a Jekyll site, 1 otherwise
|
|
37
|
+
detect_jekyll_site() {
|
|
38
|
+
local site_dir="${1:-.}"
|
|
39
|
+
|
|
40
|
+
if [[ ! -f "$site_dir/_config.yml" ]]; then
|
|
41
|
+
debug "No _config.yml found in $site_dir"
|
|
42
|
+
return 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Extra confidence checks (any one is enough)
|
|
46
|
+
if [[ -f "$site_dir/Gemfile" ]] || [[ -d "$site_dir/_layouts" ]] || [[ -d "$site_dir/_includes" ]] || [[ -d "$site_dir/pages" ]]; then
|
|
47
|
+
debug "Detected Jekyll site at $site_dir"
|
|
48
|
+
return 0
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
debug "Directory has _config.yml but doesn't look like a Jekyll site: $site_dir"
|
|
52
|
+
return 1
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Check whether the target site uses the zer0-mistakes theme
|
|
56
|
+
# Usage: validate_theme_connection "/path/to/site"
|
|
57
|
+
# Returns 0 if connected, 1 otherwise. Sets THEME_CONNECTION_TYPE.
|
|
58
|
+
validate_theme_connection() {
|
|
59
|
+
local site_dir="${1:-.}"
|
|
60
|
+
local config="$site_dir/_config.yml"
|
|
61
|
+
THEME_CONNECTION_TYPE=""
|
|
62
|
+
|
|
63
|
+
if [[ ! -f "$config" ]]; then
|
|
64
|
+
return 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# Check remote_theme
|
|
68
|
+
if grep -qE 'remote_theme:\s*"?bamr87/zer0-mistakes' "$config" 2>/dev/null; then
|
|
69
|
+
THEME_CONNECTION_TYPE="remote"
|
|
70
|
+
debug "Theme connection: remote_theme"
|
|
71
|
+
return 0
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Check gem theme
|
|
75
|
+
if grep -qE 'theme:\s*"?jekyll-theme-zer0' "$config" 2>/dev/null; then
|
|
76
|
+
THEME_CONNECTION_TYPE="gem"
|
|
77
|
+
debug "Theme connection: gem theme"
|
|
78
|
+
return 0
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Check Gemfile for local path
|
|
82
|
+
if [[ -f "$site_dir/Gemfile" ]]; then
|
|
83
|
+
if grep -qE 'jekyll-theme-zer0.*path:' "$site_dir/Gemfile" 2>/dev/null; then
|
|
84
|
+
THEME_CONNECTION_TYPE="local"
|
|
85
|
+
debug "Theme connection: local path gem"
|
|
86
|
+
return 0
|
|
87
|
+
fi
|
|
88
|
+
if grep -q 'jekyll-theme-zer0' "$site_dir/Gemfile" 2>/dev/null; then
|
|
89
|
+
THEME_CONNECTION_TYPE="gem"
|
|
90
|
+
debug "Theme connection: Gemfile gem"
|
|
91
|
+
return 0
|
|
92
|
+
fi
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
debug "No zer0-mistakes theme connection found"
|
|
96
|
+
return 1
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# -------------------------------------------------------------------------
|
|
100
|
+
# Admin Page Installation
|
|
101
|
+
# -------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
# Install admin pages from templates into a target site
|
|
104
|
+
# Usage: install_admin_pages "/path/to/site" [--force]
|
|
105
|
+
# Requires TEMPLATES_DIR to be set and config loaded
|
|
106
|
+
install_admin_pages() {
|
|
107
|
+
local site_dir="${1:-.}"
|
|
108
|
+
local force="${2:-false}"
|
|
109
|
+
local output_dir="$site_dir/$ADMIN_OUTPUT_DIR"
|
|
110
|
+
local installed=0
|
|
111
|
+
local skipped=0
|
|
112
|
+
|
|
113
|
+
step "Installing admin pages to $output_dir"
|
|
114
|
+
|
|
115
|
+
# Ensure templates directory is available
|
|
116
|
+
local admin_templates_dir=""
|
|
117
|
+
if [[ -n "${TEMPLATES_DIR:-}" ]] && [[ -d "$TEMPLATES_DIR/pages/admin" ]]; then
|
|
118
|
+
admin_templates_dir="$TEMPLATES_DIR/pages/admin"
|
|
119
|
+
else
|
|
120
|
+
# Try to find it
|
|
121
|
+
local found_dir
|
|
122
|
+
if found_dir=$(find_templates_dir "${BASH_SOURCE[0]}" 2>/dev/null); then
|
|
123
|
+
admin_templates_dir="$found_dir/pages/admin"
|
|
124
|
+
TEMPLATES_DIR="$found_dir"
|
|
125
|
+
fi
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
if [[ -z "$admin_templates_dir" ]] || [[ ! -d "$admin_templates_dir" ]]; then
|
|
129
|
+
error "Admin templates directory not found. Ensure TEMPLATES_DIR is set or run from the theme repo."
|
|
130
|
+
return 1
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# Ensure config is loaded for template rendering
|
|
134
|
+
if [[ -z "${CURRENT_DATE:-}" ]]; then
|
|
135
|
+
load_config 2>/dev/null || true
|
|
136
|
+
export CURRENT_DATE="${CURRENT_DATE:-$(date +%Y-%m-%d)}"
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Create output directory
|
|
140
|
+
dry_run_exec "Create $output_dir" mkdir -p "$output_dir"
|
|
141
|
+
|
|
142
|
+
local page template_file output_file
|
|
143
|
+
for page in "${ADMIN_PAGES[@]}"; do
|
|
144
|
+
template_file="$admin_templates_dir/${page}.md.template"
|
|
145
|
+
output_file="$output_dir/${page}.md"
|
|
146
|
+
|
|
147
|
+
if [[ ! -f "$template_file" ]]; then
|
|
148
|
+
warn "Template not found: $template_file — skipping"
|
|
149
|
+
((skipped++))
|
|
150
|
+
continue
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
if [[ -f "$output_file" ]] && [[ "$force" != "true" ]]; then
|
|
154
|
+
info "Already exists (use --force to overwrite): $output_file"
|
|
155
|
+
((skipped++))
|
|
156
|
+
continue
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
dry_run_exec "Render ${page}.md" render_template "$template_file" "$output_file"
|
|
160
|
+
((installed++))
|
|
161
|
+
debug "Installed: $output_file"
|
|
162
|
+
done
|
|
163
|
+
|
|
164
|
+
if [[ "$installed" -gt 0 ]]; then
|
|
165
|
+
success "Installed $installed admin page(s) ($skipped skipped)"
|
|
166
|
+
else
|
|
167
|
+
info "No new admin pages installed ($skipped skipped)"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
return 0
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# -------------------------------------------------------------------------
|
|
174
|
+
# Verification
|
|
175
|
+
# -------------------------------------------------------------------------
|
|
176
|
+
|
|
177
|
+
# Verify that admin pages are installed and have required front matter
|
|
178
|
+
# Usage: verify_admin_pages "/path/to/site"
|
|
179
|
+
# Returns 0 if all pages are valid, 1 otherwise
|
|
180
|
+
verify_admin_pages() {
|
|
181
|
+
local site_dir="${1:-.}"
|
|
182
|
+
local output_dir="$site_dir/$ADMIN_OUTPUT_DIR"
|
|
183
|
+
local errors=0
|
|
184
|
+
local total=0
|
|
185
|
+
|
|
186
|
+
step "Verifying admin pages in $output_dir"
|
|
187
|
+
|
|
188
|
+
if [[ ! -d "$output_dir" ]]; then
|
|
189
|
+
warn "Admin pages directory does not exist: $output_dir"
|
|
190
|
+
return 1
|
|
191
|
+
fi
|
|
192
|
+
|
|
193
|
+
local page page_file
|
|
194
|
+
for page in "${ADMIN_PAGES[@]}"; do
|
|
195
|
+
page_file="$output_dir/${page}.md"
|
|
196
|
+
((total++))
|
|
197
|
+
|
|
198
|
+
if [[ ! -f "$page_file" ]]; then
|
|
199
|
+
warn "Missing: $page_file"
|
|
200
|
+
((errors++))
|
|
201
|
+
continue
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
# Check required front matter fields
|
|
205
|
+
if ! grep -q 'layout: admin' "$page_file" 2>/dev/null; then
|
|
206
|
+
warn "Missing 'layout: admin' in $page_file"
|
|
207
|
+
((errors++))
|
|
208
|
+
continue
|
|
209
|
+
fi
|
|
210
|
+
|
|
211
|
+
if ! grep -q 'permalink:' "$page_file" 2>/dev/null; then
|
|
212
|
+
warn "Missing 'permalink' in $page_file"
|
|
213
|
+
((errors++))
|
|
214
|
+
continue
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
debug "Verified: $page_file"
|
|
218
|
+
done
|
|
219
|
+
|
|
220
|
+
if [[ "$errors" -eq 0 ]]; then
|
|
221
|
+
success "All $total admin pages verified"
|
|
222
|
+
return 0
|
|
223
|
+
else
|
|
224
|
+
warn "$errors of $total admin page(s) have issues"
|
|
225
|
+
return 1
|
|
226
|
+
fi
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
# -------------------------------------------------------------------------
|
|
230
|
+
# Version Detection
|
|
231
|
+
# -------------------------------------------------------------------------
|
|
232
|
+
|
|
233
|
+
# Detect the installed theme version and warn if admin features may be missing
|
|
234
|
+
# Usage: detect_version_gap "/path/to/site"
|
|
235
|
+
detect_version_gap() {
|
|
236
|
+
local site_dir="${1:-.}"
|
|
237
|
+
local gemfile_lock="$site_dir/Gemfile.lock"
|
|
238
|
+
local min_admin_version="0.22.10"
|
|
239
|
+
|
|
240
|
+
if [[ ! -f "$gemfile_lock" ]]; then
|
|
241
|
+
debug "No Gemfile.lock found — cannot check theme version"
|
|
242
|
+
return 0
|
|
243
|
+
fi
|
|
244
|
+
|
|
245
|
+
local installed_version
|
|
246
|
+
installed_version=$(grep -A1 'jekyll-theme-zer0' "$gemfile_lock" 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
|
|
247
|
+
|
|
248
|
+
if [[ -z "$installed_version" ]]; then
|
|
249
|
+
debug "Could not determine installed theme version"
|
|
250
|
+
return 0
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
info "Installed theme version: $installed_version"
|
|
254
|
+
|
|
255
|
+
# Simple version comparison (works for same-major versions)
|
|
256
|
+
if [[ "$(printf '%s\n' "$min_admin_version" "$installed_version" | sort -V | head -1)" != "$min_admin_version" ]]; then
|
|
257
|
+
warn "Theme version $installed_version may not include admin layout/includes."
|
|
258
|
+
warn "Admin pages require version >= $min_admin_version."
|
|
259
|
+
warn "Consider updating: bundle update jekyll-theme-zer0"
|
|
260
|
+
return 1
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
debug "Theme version $installed_version >= $min_admin_version — admin features supported"
|
|
264
|
+
return 0
|
|
265
|
+
}
|