underpost 2.99.4 → 2.99.5

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.
@@ -1,406 +1,83 @@
1
- # Underpost Static Site Generator - Examples
1
+ # Static Page Example
2
2
 
3
- This directory contains comprehensive examples and documentation for the Underpost Static Site Generator.
4
-
5
- ## Contents
6
-
7
- ### Documentation
8
-
9
- - **[STATIC-GENERATOR-GUIDE.md](./STATIC-GENERATOR-GUIDE.md)** - Complete guide covering all features, best practices, and advanced usage patterns
10
-
11
- ### Configuration Examples
12
-
13
- - **[static-config-example.json](./static-page/static-config-example.json)** - Fully documented configuration file template with all available options
14
-
15
- ### SSR Component Examples
16
-
17
- - **[ssr-components/CustomPage.js](./ssr-components/CustomPage.js)** - Complete example of a custom landing page with:
18
- - Semantic HTML structure
19
- - Accessibility features
20
- - Responsive design
21
- - Progressive enhancement
22
- - Inline critical CSS
23
- - Interactive JavaScript
3
+ Generate static HTML pages using the `underpost static` CLI.
24
4
 
25
5
  ## Quick Start
26
6
 
27
- ### 1. Generate a Config Template
28
-
29
- ```bash
30
- underpost static --generate-config ./my-static-config.json
31
- ```
32
-
33
- This creates a template configuration file with all available options documented.
34
-
35
- ### 2. Customize Your Config
36
-
37
- Edit the generated config file with your specific requirements:
38
-
39
- ```json
40
- {
41
- "page": "./src/client/ssr/body/YourPage.js",
42
- "outputPath": "./dist/index.html",
43
- "metadata": {
44
- "title": "Your App Title",
45
- "description": "Your app description"
46
- }
47
- }
48
- ```
49
-
50
- ### 3. Build Your Static Page
51
-
52
- ```bash
53
- underpost static --config-file ./my-static-config.json
54
- ```
55
-
56
- ## Example Usage Scenarios
57
-
58
- ### Basic Static Page
59
-
60
- ```bash
61
- underpost static \
62
- --page ./src/client/ssr/body/DefaultSplashScreen.js \
63
- --output-path ./dist/index.html \
64
- --title "My App"
65
- ```
66
-
67
- ### Landing Page with SEO
68
-
69
- ```bash
70
- underpost static \
71
- --page ./examples/static-page/ssr-components/CustomPage.js \
72
- --output-path ./dist/landing.html \
73
- --title "Welcome to My App" \
74
- --description "The best app for your needs" \
75
- --keywords "app,solution,innovation" \
76
- --theme-color "#667eea" \
77
- --canonical-url "https://myapp.com"
78
- ```
79
-
80
- ### Complete Customization
81
-
82
- Use the provided `static-config-example.json`:
83
-
84
- ```bash
85
- # Copy the example
86
- cp ./examples/static-page/static-config-example.json ./my-config.json
87
-
88
- # Edit with your settings
89
- nano ./my-config.json
90
-
91
- # Build
92
- underpost static --config-file ./my-config.json
93
- ```
94
-
95
- ## Available Examples
96
-
97
- ### 1. Complete Configuration Example
98
-
99
- **File:** `static-config-example.json`
100
-
101
- **What it demonstrates:**
102
- - Complete metadata configuration
103
- - Script injection (head and body)
104
- - Stylesheet management
105
- - Icon configuration
106
- - SSR component inclusion
107
- - Microdata/structured data
108
- - Custom payload injection
109
-
110
- **Use case:** Production-ready web application with full SEO and PWA support
111
-
112
- ### 2. Custom Landing Page Component
113
-
114
- **File:** `ssr-components/CustomPage.js`
115
-
116
- **What it demonstrates:**
117
- - Hero section with call-to-action
118
- - Feature showcase grid
119
- - Content sections
120
- - Contact form
121
- - Footer with links
122
- - Responsive design
123
- - Accessibility features
124
- - Progressive enhancement
125
-
126
- **Use case:** Marketing landing page or product showcase
127
-
128
- ## Configuration Options Reference
129
-
130
- ### Metadata Options
131
-
132
- ```json
133
- {
134
- "metadata": {
135
- "title": "Page title",
136
- "description": "SEO description",
137
- "keywords": ["keyword1", "keyword2"],
138
- "author": "Author name",
139
- "themeColor": "#ffffff",
140
- "canonicalURL": "https://example.com",
141
- "thumbnail": "https://example.com/image.png",
142
- "locale": "en-US",
143
- "siteName": "Site Name"
144
- }
145
- }
146
- ```
147
-
148
- ### Script Options
149
-
150
- ```json
151
- {
152
- "scripts": {
153
- "head": [
154
- {
155
- "src": "https://cdn.example.com/script.js",
156
- "async": true,
157
- "integrity": "sha384-...",
158
- "crossorigin": "anonymous"
159
- },
160
- {
161
- "content": "window.config = {};",
162
- "type": "text/javascript"
163
- }
164
- ],
165
- "body": [
166
- {
167
- "src": "/app.js",
168
- "type": "module",
169
- "defer": true
170
- }
171
- ]
172
- }
173
- }
7
+ ```sh
8
+ # From the project root directory:
9
+ underpost static --page ./examples/static-page/ssr-components/CustomPage.js \
10
+ --output-path ./public/default.net/example.html
174
11
  ```
175
12
 
176
- ### Style Options
13
+ ## Using a Config File
177
14
 
178
- ```json
179
- {
180
- "styles": [
181
- { "href": "/main.css" },
182
- { "content": "body { margin: 0; }" },
183
- { "href": "/print.css", "media": "print" }
184
- ]
185
- }
186
- ```
15
+ A JSON config file lets you define all options in one place instead of passing CLI flags.
187
16
 
188
- ### Icon Options
17
+ **Generate a starter config:**
189
18
 
190
- ```json
191
- {
192
- "icons": {
193
- "favicon": "/favicon.ico",
194
- "appleTouchIcon": "/apple-touch-icon.png",
195
- "manifest": "/manifest.json",
196
- "additional": [
197
- {
198
- "rel": "icon",
199
- "type": "image/png",
200
- "sizes": "32x32",
201
- "href": "/favicon-32x32.png"
202
- }
203
- ]
204
- }
205
- }
19
+ ```sh
20
+ underpost static --generate-config ./static-config.json
206
21
  ```
207
22
 
208
- ### Component Options
23
+ **Build from the included example config:**
209
24
 
210
- ```json
211
- {
212
- "headComponents": [
213
- "./src/client/ssr/head/Seo.js",
214
- "./src/client/ssr/head/Pwa.js"
215
- ],
216
- "bodyComponents": [
217
- "./src/client/ssr/body/Header.js"
218
- ]
219
- }
25
+ ```sh
26
+ underpost static --config-file ./examples/static-page/static-config-example.json
220
27
  ```
221
28
 
222
- ### Structured Data (Microdata)
29
+ ## Config File Reference
223
30
 
224
- ```json
225
- {
226
- "microdata": [
227
- {
228
- "@context": "https://schema.org",
229
- "@type": "WebSite",
230
- "name": "My Site",
231
- "url": "https://example.com"
232
- }
233
- ]
234
- }
235
- ```
31
+ See [`static-config-example.json`](./static-config-example.json) for a complete working example.
236
32
 
237
- ## Common Use Cases
33
+ | Field | Type | Description |
34
+ |-------|------|-------------|
35
+ | `page` | `string` | Path to the SSR component to render |
36
+ | `outputPath` | `string` | Output HTML file path |
37
+ | `env` | `string` | `"production"` or `"development"` |
38
+ | `minify` | `boolean` | Minify HTML output |
39
+ | `lang` | `string` | HTML `lang` attribute |
40
+ | `dir` | `string` | HTML `dir` attribute (`ltr`/`rtl`) |
41
+ | `metadata` | `object` | SEO metadata (title, description, keywords, author, themeColor, canonicalURL, thumbnail, locale, siteName) |
42
+ | `scripts` | `object` | `{ head: [...], body: [...] }` — inline or external scripts |
43
+ | `styles` | `array` | Inline (`content`) or external (`href`) stylesheets |
44
+ | `icons` | `object` | `favicon`, `appleTouchIcon`, `manifest` paths |
45
+ | `headComponents` | `array` | SSR component paths injected into `<head>` |
46
+ | `bodyComponents` | `array` | SSR component paths injected into `<body>` |
47
+ | `microdata` | `array` | JSON-LD structured data objects |
48
+ | `customPayload` | `object` | Arbitrary data injected into the render payload |
238
49
 
239
- ### 1. Simple Blog Post
240
-
241
- ```json
242
- {
243
- "page": "./src/client/ssr/body/BlogPost.js",
244
- "outputPath": "./dist/blog/my-post.html",
245
- "metadata": {
246
- "title": "My Blog Post Title",
247
- "description": "Summary of the blog post",
248
- "author": "John Doe",
249
- "keywords": ["blogging", "tutorial"]
250
- },
251
- "microdata": [
252
- {
253
- "@context": "https://schema.org",
254
- "@type": "BlogPosting",
255
- "headline": "My Blog Post Title",
256
- "author": {
257
- "@type": "Person",
258
- "name": "John Doe"
259
- },
260
- "datePublished": "2024-01-01"
261
- }
262
- ]
263
- }
264
- ```
50
+ ## CLI Flags
265
51
 
266
- ### 2. E-commerce Product Page
52
+ Flags override config file values when both are provided.
267
53
 
268
- ```json
269
- {
270
- "page": "./src/client/ssr/body/ProductPage.js",
271
- "outputPath": "./dist/products/widget.html",
272
- "metadata": {
273
- "title": "Premium Widget - Buy Now",
274
- "description": "High-quality widget with free shipping",
275
- "thumbnail": "https://shop.com/widget.jpg"
276
- },
277
- "microdata": [
278
- {
279
- "@context": "https://schema.org",
280
- "@type": "Product",
281
- "name": "Premium Widget",
282
- "offers": {
283
- "@type": "Offer",
284
- "price": "29.99",
285
- "priceCurrency": "USD"
286
- }
287
- }
288
- ]
289
- }
54
+ ```sh
55
+ underpost static --page <path> # SSR component path
56
+ --output-path <path> # Output file
57
+ --config-file <path> # JSON config file
58
+ --env <env> # production | development
59
+ --minify / --no-minify # Toggle minification
60
+ --title <title> # Page title
61
+ --description <text> # Meta description
62
+ --keywords <a,b,c> # Comma-separated keywords
63
+ --author <name> # Meta author
64
+ --favicon <path> # Favicon path
65
+ --lang <lang> # HTML lang attribute
66
+ --dir <dir> # HTML dir attribute
67
+ --dev # Development mode
290
68
  ```
291
69
 
292
- ### 3. Documentation Page
70
+ ## SSR Component
293
71
 
294
- ```json
295
- {
296
- "page": "./src/client/ssr/body/DocsPage.js",
297
- "outputPath": "./dist/docs/index.html",
298
- "headComponents": [
299
- "./src/client/ssr/head/Seo.js"
300
- ],
301
- "styles": [
302
- { "href": "/docs/prism.css" },
303
- { "href": "/docs/docs.css" }
304
- ],
305
- "scripts": {
306
- "body": [
307
- { "src": "/docs/prism.js", "defer": true },
308
- { "src": "/docs/search.js", "defer": true }
309
- ]
310
- }
311
- }
312
- ```
313
-
314
- ### 4. Multi-language Pages
72
+ The page content is defined in an SSR component file. See [`ssr-components/CustomPage.js`](./ssr-components/CustomPage.js) for an example.
315
73
 
316
- ```bash
317
- # English version
318
- underpost static --config-file ./config-en.json --lang en --dir ltr
74
+ A component exports an `SrrComponent` function that returns an HTML template literal:
319
75
 
320
- # Spanish version
321
- underpost static --config-file ./config-es.json --lang es --dir ltr
322
-
323
- # Arabic version
324
- underpost static --config-file ./config-ar.json --lang ar --dir rtl
325
- ```
326
-
327
- ## Best Practices
328
-
329
- ### 1. SEO Optimization
330
-
331
- ✅ Always include title, description, and keywords
332
- ✅ Use canonical URLs
333
- ✅ Add Open Graph metadata
334
- ✅ Include structured data (JSON-LD)
335
- ✅ Optimize images in metadata
336
-
337
- ### 2. Performance
338
-
339
- ✅ Minify HTML in production
340
- ✅ Use async/defer for scripts
341
- ✅ Inline critical CSS
342
- ✅ Optimize asset loading order
343
-
344
- ### 3. Accessibility
345
-
346
- ✅ Use semantic HTML
347
- ✅ Include ARIA labels
348
- ✅ Ensure keyboard navigation
349
- ✅ Test with screen readers
350
-
351
- ### 4. Progressive Enhancement
352
-
353
- ✅ Ensure content works without JavaScript
354
- ✅ Add interactive features progressively
355
- ✅ Test on various devices
356
- ✅ Provide fallbacks
357
-
358
- ## Advanced Techniques
359
-
360
- ### Custom SSR Component Template
361
-
362
- ```javascript
363
- /**
364
- * Custom Component Template
365
- * @description Brief description of the component
366
- */
76
+ ```js
367
77
  SrrComponent = () => html`
368
- <div class="custom-component">
369
- <!-- Your HTML here -->
78
+ <div>
79
+ <h1>Hello World</h1>
80
+ <p>Your page content here.</p>
370
81
  </div>
371
-
372
- <style>
373
- /* Component-specific styles */
374
- </style>
375
-
376
- <script>
377
- // Component-specific JavaScript
378
- document.addEventListener('DOMContentLoaded', function() {
379
- // Your code here
380
- });
381
- </script>
382
82
  `;
383
83
  ```
384
-
385
- ### Programmatic Usage
386
-
387
- ```javascript
388
- import UnderpostStatic from './src/cli/static.js';
389
-
390
- // Generate multiple pages
391
- const pages = [
392
- { slug: 'home', title: 'Home' },
393
- { slug: 'about', title: 'About' },
394
- { slug: 'contact', title: 'Contact' }
395
- ];
396
-
397
- for (const page of pages) {
398
- await UnderpostStatic.API.callback({
399
- page: `./src/client/ssr/body/${page.slug}.js`,
400
- outputPath: `./dist/${page.slug}.html`,
401
- metadata: {
402
- title: page.title
403
- }
404
- });
405
- }
406
- ```
@@ -1,22 +1,10 @@
1
1
  /**
2
2
  * Custom Page SSR Component Example
3
3
  * @module examples/ssr-components/CustomPage
4
- *
5
- * @description
6
- * This is an example SSR component demonstrating best practices for creating
7
- * custom static pages with the Underpost Static Site Generator.
8
4
  */
9
5
 
10
6
  /**
11
- * Main SSR Component for rendering a custom landing page
12
- *
13
- * This component demonstrates:
14
- * - Semantic HTML structure
15
- * - Accessibility best practices
16
- * - Responsive design patterns
17
- * - Progressive enhancement
18
- * - Clean, maintainable code
19
- *
7
+ * SSR Component Example for rendering a custom landing page
20
8
  * @function SrrComponent
21
9
  * @returns {string} HTML string for the page body
22
10
  */
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.99.4
20
+ image: localhost/rockylinux9-underpost:v2.99.5
21
21
  # resources:
22
22
  # requests:
23
23
  # memory: "124Ki"
@@ -100,7 +100,7 @@ spec:
100
100
  spec:
101
101
  containers:
102
102
  - name: dd-default-development-green
103
- image: localhost/rockylinux9-underpost:v2.99.4
103
+ image: localhost/rockylinux9-underpost:v2.99.5
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -18,7 +18,7 @@ spec:
18
18
  spec:
19
19
  containers:
20
20
  - name: dd-test-development-blue
21
- image: localhost/rockylinux9-underpost:v2.99.4
21
+ image: localhost/rockylinux9-underpost:v2.99.5
22
22
 
23
23
  command:
24
24
  - /bin/sh
@@ -103,7 +103,7 @@ spec:
103
103
  spec:
104
104
  containers:
105
105
  - name: dd-test-development-green
106
- image: localhost/rockylinux9-underpost:v2.99.4
106
+ image: localhost/rockylinux9-underpost:v2.99.5
107
107
 
108
108
  command:
109
109
  - /bin/sh
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.99.4",
5
+ "version": "2.99.5",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -22,7 +22,7 @@
22
22
  "install": "npm run install-global && npm run install-test",
23
23
  "prettier": "prettier --write .",
24
24
  "fix": "npm audit fix --force && npm audit",
25
- "baremetal": "node bin baremetal --dev --commission --clear-discovered --remove-machines all --ls --create-machine"
25
+ "baremetal": "node bin baremetal --dev --commission --ls --create-machine"
26
26
  },
27
27
  "bin": {
28
28
  "underpost": "bin/index.js"
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # disk-devices.sh
3
+ # List block devices with detailed info, including by-id names
4
+ # Usage: sudo ./disk-devices.sh
5
+ set -euo pipefail
6
+
7
+ sudo bash -c 'printf "NODE\tTYPE\tSIZE\tFSTYPE\tLABEL\tUUID\tMOUNTPOINT\tBY-ID\n"; \
8
+ lsblk -pnl -o NAME,TYPE,SIZE,FSTYPE,LABEL,UUID,MOUNTPOINT | while read -r DEV TYPE SIZE FS LBL UUID MNT; do \
9
+ node=$(readlink -f "$DEV"); \
10
+ byid=$(find /dev/disk/by-id/ -maxdepth 1 -lname "*${node##*/}" ! -name "nvme-eui*" ! -name "dm-uuid*" 2>/dev/null | head -n 1); \
11
+ [ -z "$byid" ] && byid=$(find /dev/disk/by-id/ -maxdepth 1 -lname "*${node##*/}" 2>/dev/null | head -n 1); \
12
+ printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "$node" "$TYPE" "$SIZE" "$FS" "$LBL" "$UUID" "$MNT" "$(basename "$byid" 2>/dev/null)"; \
13
+ done' | column -s $'\t' -t