underpost 2.90.1 → 2.90.4

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.
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- badges -->
20
20
 
21
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.90.1)](https://socket.dev/npm/package/underpost/overview/2.90.1) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
21
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.90.4)](https://socket.dev/npm/package/underpost/overview/2.90.4) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
22
22
 
23
23
  <!-- end-badges -->
24
24
 
@@ -66,7 +66,7 @@ Run dev client server
66
66
  npm run dev
67
67
  ```
68
68
  <!-- -->
69
- ## underpost ci/cd cli v2.90.1
69
+ ## underpost ci/cd cli v2.90.4
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
@@ -82,7 +82,7 @@ Commands:
82
82
  cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
83
83
  push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
84
84
  env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
85
- static [options] Manages static build of page, bundles, and documentation.
85
+ static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
86
86
  config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
87
87
  root Displays the root path of the npm installation.
88
88
  ip [options] Displays the current public machine IP addresses.
package/bin/deploy.js CHANGED
@@ -1237,6 +1237,22 @@ nvidia/gpu-operator \
1237
1237
  break;
1238
1238
  }
1239
1239
 
1240
+ case 'update-static-guide': {
1241
+ fs.writeFileSync(
1242
+ `src/client/public/nexodev/docs/references/Static Site Generator Quick Reference.md`,
1243
+ fs.readFileSync(`examples/QUICK-REFERENCE.md`, 'utf8'),
1244
+ );
1245
+ fs.writeFileSync(
1246
+ `src/client/public/nexodev/docs/references/Static Site Generator Examples.md`,
1247
+ fs.readFileSync(`examples/README.md`, 'utf8'),
1248
+ );
1249
+ fs.writeFileSync(
1250
+ `src/client/public/nexodev/docs/references/Static Generator Guide.md`,
1251
+ fs.readFileSync(`examples/STATIC-GENERATOR-GUIDE.md`, 'utf8'),
1252
+ );
1253
+ break;
1254
+ }
1255
+
1240
1256
  case 'udpate-version-files': {
1241
1257
  const oldNpmVersion = process.argv[3];
1242
1258
  const oldNodeVersion = process.argv[4];
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.90.1
1
+ ## underpost ci/cd cli v2.90.4
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -14,7 +14,7 @@ Commands:
14
14
  cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
15
15
  push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
16
16
  env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
17
- static [options] Manages static build of page, bundles, and documentation.
17
+ static [options] Manages static build of page, bundles, and documentation with comprehensive customization options.
18
18
  config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
19
19
  root Displays the root path of the npm installation.
20
20
  ip [options] Displays the current public machine IP addresses.
@@ -199,13 +199,33 @@ Options:
199
199
  ```
200
200
  Usage: underpost static [options]
201
201
 
202
- Manages static build of page, bundles, and documentation.
202
+ Manages static build of page, bundles, and documentation with comprehensive
203
+ customization options.
203
204
 
204
205
  Options:
205
206
  --page <ssr-component-path> Build custom static pages.
206
- --title <title> Sets a custom title for the static page.
207
+ --title <title> Sets a custom title for the static page
208
+ (deprecated: use --config-file).
207
209
  --output-path <output-path> Sets the output path for the generated static
208
210
  page.
211
+ --description <description> Page description for SEO.
212
+ --keywords <keywords> Comma-separated keywords for SEO.
213
+ --author <author> Page author.
214
+ --theme-color <color> Theme color for mobile browsers.
215
+ --canonical-url <url> Canonical URL for SEO.
216
+ --thumbnail <url> Open Graph thumbnail image URL.
217
+ --locale <locale> Page locale (default: en-US).
218
+ --site-name <name> Site name for Open Graph.
219
+ --head-scripts <paths> Comma-separated paths to scripts for head
220
+ section.
221
+ --body-scripts <paths> Comma-separated paths to scripts for body
222
+ section.
223
+ --styles <paths> Comma-separated paths to stylesheets.
224
+ --favicon <path> Favicon path.
225
+ --apple-touch-icon <path> Apple touch icon path.
226
+ --manifest <path> Web manifest path.
227
+ --head-components <paths> Comma-separated SSR head component paths.
228
+ --body-components <paths> Comma-separated SSR body component paths.
209
229
  --deploy-id <deploy-id> Build static assets for a specific deployment
210
230
  ID.
211
231
  --build Triggers the static build process for the
@@ -216,6 +236,13 @@ Options:
216
236
  assets.
217
237
  --env <env> Sets the environment for the static build (e.g.,
218
238
  "development", "production").
239
+ --minify Minify HTML output (default: true for
240
+ production).
241
+ --no-minify Disable HTML minification.
242
+ --config-file <path> Path to JSON configuration file.
243
+ --generate-config [path] Generate a template configuration file.
244
+ --lang <lang> HTML lang attribute (default: en).
245
+ --dir <dir> HTML dir attribute (default: ltr).
219
246
  --dev Sets the development cli context
220
247
  -h, --help display help for command
221
248
 
@@ -733,7 +760,6 @@ Options:
733
760
  --limits-memory <limits-memory> Sets memory limit for the runner execution.
734
761
  --limits-cpu <limits-cpu> Sets CPU limit for the runner execution.
735
762
  --resource-template-id <resource-template-id > Specifies a resource template ID for the runner execution.
736
- --etcHosts Enables /etc/hosts management for the runner execution.
737
763
  --expose Enables service exposure for the runner execution.
738
764
  --conf-server-path <conf-server-path> Sets a custom configuration server path.
739
765
  --underpost-root <underpost-root> Sets a custom Underpost root path.
@@ -0,0 +1,499 @@
1
+ # Underpost Static Site Generator - Quick Reference
2
+
3
+ ## Basic Commands
4
+
5
+ ### Generate Config Template
6
+ ```bash
7
+ underpost static --generate-config ./static-config.json
8
+ ```
9
+
10
+ ### Build from Config File
11
+ ```bash
12
+ underpost static --config-file ./static-config.json
13
+ ```
14
+
15
+ ### Simple Page Generation
16
+ ```bash
17
+ underpost static \
18
+ --page ./src/client/ssr/body/Page.js \
19
+ --output-path ./dist/index.html \
20
+ --title "My Page"
21
+ ```
22
+
23
+ ## Common CLI Patterns
24
+
25
+ ### Landing Page with SEO
26
+ ```bash
27
+ underpost static \
28
+ --page ./src/client/ssr/body/Landing.js \
29
+ --output-path ./dist/landing.html \
30
+ --title "Welcome" \
31
+ --description "My awesome landing page" \
32
+ --keywords "landing,web,app" \
33
+ --theme-color "#007bff" \
34
+ --canonical-url "https://example.com"
35
+ ```
36
+
37
+ ### Page with External Scripts
38
+ ```bash
39
+ underpost static \
40
+ --page ./src/client/ssr/body/App.js \
41
+ --output-path ./dist/app.html \
42
+ --head-scripts "https://cdn.example.com/analytics.js" \
43
+ --body-scripts "/app.js,/vendor.js"
44
+ ```
45
+
46
+ ### Page with Custom Icons
47
+ ```bash
48
+ underpost static \
49
+ --page ./src/client/ssr/body/Home.js \
50
+ --output-path ./dist/index.html \
51
+ --favicon "/favicon.ico" \
52
+ --apple-touch-icon "/apple-touch-icon.png" \
53
+ --manifest "/manifest.json"
54
+ ```
55
+
56
+ ### Production Build with Deployment
57
+ ```bash
58
+ underpost static \
59
+ --page ./src/client/ssr/body/App.js \
60
+ --output-path ./public/index.html \
61
+ --deploy-id "production-v1" \
62
+ --build-host "example.com" \
63
+ --build-path "/" \
64
+ --build \
65
+ --env production
66
+ ```
67
+
68
+ ## Configuration File Patterns
69
+
70
+ ### Minimal Config
71
+ ```json
72
+ {
73
+ "page": "./src/client/ssr/body/Page.js",
74
+ "outputPath": "./dist/index.html",
75
+ "metadata": {
76
+ "title": "My Page",
77
+ "description": "Page description"
78
+ }
79
+ }
80
+ ```
81
+
82
+ ### SEO-Optimized Config
83
+ ```json
84
+ {
85
+ "page": "./src/client/ssr/body/Page.js",
86
+ "outputPath": "./dist/index.html",
87
+ "metadata": {
88
+ "title": "My SEO Page",
89
+ "description": "Comprehensive description for SEO",
90
+ "keywords": ["seo", "optimization", "web"],
91
+ "author": "Your Name",
92
+ "canonicalURL": "https://example.com",
93
+ "thumbnail": "https://example.com/og-image.png",
94
+ "themeColor": "#4CAF50"
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### With Scripts and Styles
100
+ ```json
101
+ {
102
+ "page": "./src/client/ssr/body/Page.js",
103
+ "outputPath": "./dist/index.html",
104
+ "scripts": {
105
+ "head": [
106
+ { "src": "https://cdn.example.com/lib.js", "async": true }
107
+ ],
108
+ "body": [
109
+ { "src": "/app.js", "type": "module", "defer": true }
110
+ ]
111
+ },
112
+ "styles": [
113
+ { "href": "/main.css" },
114
+ { "content": "body { margin: 0; }" }
115
+ ]
116
+ }
117
+ ```
118
+
119
+ ### PWA Configuration
120
+ ```json
121
+ {
122
+ "page": "./src/client/ssr/body/App.js",
123
+ "outputPath": "./dist/index.html",
124
+ "metadata": {
125
+ "title": "My PWA",
126
+ "themeColor": "#007bff"
127
+ },
128
+ "icons": {
129
+ "favicon": "/favicon.ico",
130
+ "appleTouchIcon": "/apple-touch-icon.png",
131
+ "manifest": "/manifest.json"
132
+ },
133
+ "scripts": {
134
+ "body": [
135
+ {
136
+ "content": "if('serviceWorker' in navigator){navigator.serviceWorker.register('/sw.js');}"
137
+ }
138
+ ]
139
+ }
140
+ }
141
+ ```
142
+
143
+ ### With Structured Data
144
+ ```json
145
+ {
146
+ "page": "./src/client/ssr/body/Page.js",
147
+ "outputPath": "./dist/index.html",
148
+ "metadata": {
149
+ "title": "My Product"
150
+ },
151
+ "microdata": [
152
+ {
153
+ "@context": "https://schema.org",
154
+ "@type": "Product",
155
+ "name": "My Product",
156
+ "offers": {
157
+ "@type": "Offer",
158
+ "price": "29.99",
159
+ "priceCurrency": "USD"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ ```
165
+
166
+ ## SSR Component Patterns
167
+
168
+ ### Basic Component
169
+ ```javascript
170
+ SrrComponent = () => html`
171
+ <div class="page">
172
+ <h1>Hello World</h1>
173
+ </div>
174
+ `;
175
+ ```
176
+
177
+ ### Component with Styles
178
+ ```javascript
179
+ SrrComponent = () => html`
180
+ <div class="custom-page">
181
+ <h1>Styled Page</h1>
182
+ </div>
183
+ <style>
184
+ .custom-page {
185
+ padding: 20px;
186
+ }
187
+ </style>
188
+ `;
189
+ ```
190
+
191
+ ### Component with JavaScript
192
+ ```javascript
193
+ SrrComponent = () => html`
194
+ <div class="interactive-page">
195
+ <button id="myButton">Click Me</button>
196
+ </div>
197
+ <script>
198
+ document.addEventListener('DOMContentLoaded', function() {
199
+ document.getElementById('myButton').addEventListener('click', function() {
200
+ alert('Button clicked!');
201
+ });
202
+ });
203
+ </script>
204
+ `;
205
+ ```
206
+
207
+ ### Component with Dynamic Content
208
+ ```javascript
209
+ SrrComponent = () => html`
210
+ <div class="dynamic-page">
211
+ <h1>Current Year: ${new Date().getFullYear()}</h1>
212
+ <p>Generated at: ${new Date().toISOString()}</p>
213
+ </div>
214
+ `;
215
+ ```
216
+
217
+ ## Environment-Specific Builds
218
+
219
+ ### Development
220
+ ```bash
221
+ underpost static \
222
+ --config-file ./config.json \
223
+ --env development \
224
+ --no-minify \
225
+ --dev
226
+ ```
227
+
228
+ ### Production
229
+ ```bash
230
+ underpost static \
231
+ --config-file ./config.json \
232
+ --env production \
233
+ --minify
234
+ ```
235
+
236
+ ## Multi-Page Generation
237
+
238
+ ### Using Script (Bash)
239
+ ```bash
240
+ #!/bin/bash
241
+ PAGES=("home" "about" "contact")
242
+
243
+ for page in "${PAGES[@]}"; do
244
+ underpost static \
245
+ --page "./src/client/ssr/body/${page}.js" \
246
+ --output-path "./dist/${page}.html" \
247
+ --title "$(echo $page | sed 's/.*/\u&/')"
248
+ done
249
+ ```
250
+
251
+ ### Using JavaScript
252
+ ```javascript
253
+ import UnderpostStatic from './src/cli/static.js';
254
+
255
+ const pages = ['home', 'about', 'contact'];
256
+
257
+ for (const page of pages) {
258
+ await UnderpostStatic.API.callback({
259
+ page: `./src/client/ssr/body/${page}.js`,
260
+ outputPath: `./dist/${page}.html`,
261
+ metadata: {
262
+ title: page.charAt(0).toUpperCase() + page.slice(1)
263
+ }
264
+ });
265
+ }
266
+ ```
267
+
268
+ ## Metadata Patterns
269
+
270
+ ### Blog Post
271
+ ```json
272
+ {
273
+ "metadata": {
274
+ "title": "How to Build Static Sites",
275
+ "description": "A comprehensive guide to building static sites",
276
+ "keywords": ["static", "guide", "tutorial"],
277
+ "author": "Jane Doe"
278
+ },
279
+ "microdata": [
280
+ {
281
+ "@context": "https://schema.org",
282
+ "@type": "BlogPosting",
283
+ "headline": "How to Build Static Sites",
284
+ "author": { "@type": "Person", "name": "Jane Doe" },
285
+ "datePublished": "2024-01-01"
286
+ }
287
+ ]
288
+ }
289
+ ```
290
+
291
+ ### E-commerce Product
292
+ ```json
293
+ {
294
+ "metadata": {
295
+ "title": "Premium Widget - $29.99",
296
+ "description": "High-quality widget with free shipping",
297
+ "thumbnail": "https://shop.com/widget.jpg"
298
+ },
299
+ "microdata": [
300
+ {
301
+ "@context": "https://schema.org",
302
+ "@type": "Product",
303
+ "name": "Premium Widget",
304
+ "image": "https://shop.com/widget.jpg",
305
+ "offers": {
306
+ "@type": "Offer",
307
+ "price": "29.99",
308
+ "priceCurrency": "USD",
309
+ "availability": "https://schema.org/InStock"
310
+ }
311
+ }
312
+ ]
313
+ }
314
+ ```
315
+
316
+ ### Organization
317
+ ```json
318
+ {
319
+ "microdata": [
320
+ {
321
+ "@context": "https://schema.org",
322
+ "@type": "Organization",
323
+ "name": "My Company",
324
+ "url": "https://example.com",
325
+ "logo": "https://example.com/logo.png",
326
+ "sameAs": [
327
+ "https://twitter.com/mycompany",
328
+ "https://linkedin.com/company/mycompany"
329
+ ]
330
+ }
331
+ ]
332
+ }
333
+ ```
334
+
335
+ ## JavaScript API Usage
336
+
337
+ ### Basic Generation
338
+ ```javascript
339
+ import UnderpostStatic from './src/cli/static.js';
340
+
341
+ await UnderpostStatic.API.callback({
342
+ page: './src/client/ssr/body/Page.js',
343
+ outputPath: './dist/index.html',
344
+ metadata: { title: 'My Page' }
345
+ });
346
+ ```
347
+
348
+ ### Using Template Helpers
349
+ ```javascript
350
+ import { TemplateHelpers } from './src/cli/static.js';
351
+
352
+ const scriptTag = TemplateHelpers.createScriptTag({
353
+ src: '/app.js',
354
+ defer: true,
355
+ type: 'module'
356
+ });
357
+
358
+ const metaTags = TemplateHelpers.createMetaTags({
359
+ title: 'My Page',
360
+ description: 'Description',
361
+ keywords: ['key1', 'key2']
362
+ });
363
+ ```
364
+
365
+ ### Validation
366
+ ```javascript
367
+ import { ConfigValidator } from './src/cli/static.js';
368
+
369
+ const result = ConfigValidator.validate(options);
370
+ if (!result.isValid) {
371
+ console.error('Errors:', result.errors);
372
+ }
373
+ ```
374
+
375
+ ## Common Script Snippets
376
+
377
+ ### Google Analytics
378
+ ```json
379
+ {
380
+ "scripts": {
381
+ "head": [
382
+ {
383
+ "src": "https://www.googletagmanager.com/gtag/js?id=GA_ID",
384
+ "async": true
385
+ },
386
+ {
387
+ "content": "window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','GA_ID');"
388
+ }
389
+ ]
390
+ }
391
+ }
392
+ ```
393
+
394
+ ### Service Worker Registration
395
+ ```json
396
+ {
397
+ "scripts": {
398
+ "body": [
399
+ {
400
+ "content": "if('serviceWorker' in navigator){navigator.serviceWorker.register('/sw.js').then(reg=>console.log('SW registered',reg)).catch(err=>console.log('SW error',err));}"
401
+ }
402
+ ]
403
+ }
404
+ }
405
+ ```
406
+
407
+ ### App Configuration
408
+ ```json
409
+ {
410
+ "scripts": {
411
+ "head": [
412
+ {
413
+ "content": "window.appConfig={apiUrl:'https://api.example.com',version:'1.0.0',features:{analytics:true,debugging:false}};"
414
+ }
415
+ ]
416
+ }
417
+ }
418
+ ```
419
+
420
+ ## Troubleshooting Quick Fixes
421
+
422
+ ### Component Not Found
423
+ ```bash
424
+ # Check if file exists
425
+ ls -la ./src/client/ssr/body/Page.js
426
+
427
+ # Use absolute path from project root
428
+ underpost static --page ./src/client/ssr/body/Page.js --output-path ./dist/index.html
429
+ ```
430
+
431
+ ### Invalid JSON Config
432
+ ```bash
433
+ # Validate JSON
434
+ cat config.json | python -m json.tool
435
+
436
+ # Or use jq
437
+ jq . config.json
438
+ ```
439
+
440
+ ### Output Directory Missing
441
+ ```bash
442
+ # Create directory first
443
+ mkdir -p ./dist/pages
444
+
445
+ # Then run command
446
+ underpost static --config-file ./config.json
447
+ ```
448
+
449
+ ## Performance Optimization
450
+
451
+ ### Minification
452
+ ```json
453
+ {
454
+ "env": "production",
455
+ "minify": true
456
+ }
457
+ ```
458
+
459
+ ### Async Loading
460
+ ```json
461
+ {
462
+ "scripts": {
463
+ "head": [
464
+ { "src": "/analytics.js", "async": true }
465
+ ],
466
+ "body": [
467
+ { "src": "/app.js", "defer": true }
468
+ ]
469
+ }
470
+ }
471
+ ```
472
+
473
+ ### Critical CSS
474
+ ```json
475
+ {
476
+ "styles": [
477
+ { "content": "body{margin:0;font-family:sans-serif}" },
478
+ { "href": "/main.css" }
479
+ ]
480
+ }
481
+ ```
482
+
483
+ ## Documentation Links
484
+
485
+ - [Complete Guide](./STATIC-GENERATOR-GUIDE.md)
486
+ - [Example Config](./static-config-example.json)
487
+ - [Custom Component Example](./ssr-components/CustomPage.js)
488
+ - [Examples README](./README.md)
489
+
490
+ ## Tips
491
+
492
+ ✅ Use config files for complex setups
493
+ ✅ Minify in production
494
+ ✅ Use async/defer for scripts
495
+ ✅ Include structured data for SEO
496
+ ✅ Test on multiple devices
497
+ ✅ Validate your JSON configs
498
+ ✅ Use semantic HTML in components
499
+ ✅ Include accessibility attributes