nibula 1.2.2 → 1.2.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.
Files changed (50) hide show
  1. package/.eleventy.js +0 -5
  2. package/CHANGELOG.md +21 -9
  3. package/README.md +1 -1
  4. package/bin/create.js +1 -2
  5. package/bin/nibula.js +2 -5
  6. package/nginx.conf +75 -75
  7. package/package.json +74 -74
  8. package/src/backend/_core/index.js +267 -267
  9. package/src/backend/_core/init.js +52 -52
  10. package/src/backend/_core/modules/RateLimiter.js +58 -58
  11. package/src/backend/_core/modules/Response.js +59 -59
  12. package/src/backend/api/protected/example-protected.js +23 -23
  13. package/src/backend/api/public/example-public.js +24 -24
  14. package/src/backend/backend-node.service.example +30 -30
  15. package/src/backend/database/Database.js +46 -46
  16. package/src/backend/example.config.js +37 -37
  17. package/src/backend/package.json +18 -18
  18. package/src/frontend/.htaccess +51 -51
  19. package/src/frontend/assets/brand/favicon.svg +54 -54
  20. package/src/frontend/assets/brand/logo.svg +54 -54
  21. package/src/frontend/data/site.json +48 -48
  22. package/src/frontend/web.config +55 -55
  23. package/tools/assistant.js +122 -151
  24. package/tools/buildJs.js +39 -37
  25. package/tools/cleanOutput.js +23 -25
  26. package/tools/cli/prompt.js +40 -0
  27. package/tools/cli/ui.js +74 -0
  28. package/tools/config/messages.json +76 -0
  29. package/tools/config/settings.json +135 -0
  30. package/tools/lib/colors.js +17 -0
  31. package/tools/lib/files.js +65 -0
  32. package/tools/lib/logger.js +22 -0
  33. package/tools/lib/outputPath.js +141 -0
  34. package/tools/lib/pageActions.js +138 -0
  35. package/tools/lib/pageArtifacts.js +46 -0
  36. package/tools/lib/pageComponents.js +88 -0
  37. package/tools/lib/paths.js +61 -0
  38. package/tools/lib/project.js +54 -0
  39. package/tools/lib/siteData.js +93 -0
  40. package/tools/lib/text.js +47 -0
  41. package/tools/lib/validation.js +39 -0
  42. package/tools/res/templates/template.js +3 -1
  43. package/tools/res/templates/template.ts +3 -1
  44. package/tools/modules/constants.js +0 -66
  45. package/tools/modules/pageComponents.js +0 -77
  46. package/tools/modules/updateData.js +0 -90
  47. package/tools/modules/updateOutputPath.js +0 -112
  48. package/tools/modules/updatePage.js +0 -162
  49. package/tools/modules/utils.js +0 -27
  50. package/tools/modules/validation.js +0 -30
package/.eleventy.js CHANGED
@@ -23,11 +23,6 @@ module.exports = function (eleventyConfig) {
23
23
  }
24
24
  }
25
25
 
26
- eleventyConfig.addShortcode('mdFile', function(filePath) {
27
- const content = fs.readFileSync(filePath, 'utf8');
28
- return md.render(content);
29
- });
30
-
31
26
  eleventyConfig.on("eleventy.before", () => {
32
27
  copyRecursiveSync("src/backend", `${OUTPUT_DIR}/backend`);
33
28
  });
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable changes to Nibula are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.4] - 2026-07-31
9
+
10
+ ### Changed
11
+ - Refactor interno di `tools/`: la logica è divisa in `lib/`, `cli/` e
12
+ `config/`, con valori e messaggi estratti in `settings.json` e
13
+ `messages.json`. Nessun cambiamento di comportamento.
14
+ - La CLI usa una palette uniforme: il colore resta solo sul riquadro del
15
+ titolo, i numeri delle voci sono attenuati.
16
+
17
+ ### Fixed
18
+ - L'ultima riga del menu non chiudeva il codice colore `dim`, che restava
19
+ attivo sulla riga successiva.
20
+
21
+ ## [1.2.3] - 2026-07-29
22
+
23
+ ### Fixed
24
+ - `updateOutputPath` no longer strips custom flags from `build:css` and `serve:css`: the output path is now replaced in place instead of regenerating the whole script
25
+ - Missing `--load-path=node_modules` in the regenerated Sass scripts, which broke Bootstrap SCSS imports
26
+ - Malformed `outDir` in `tsconfig.json` when the output path is absolute (`./c:/...`)
27
+
8
28
  ## [1.2.2] - 2026-07-23
9
29
 
10
30
  ### Added
@@ -89,7 +109,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
89
109
  scripts. Compiling the stylesheets with a different tool (a VS Code Sass
90
110
  extension, for instance) will need the same load path configured.
91
111
 
92
-
93
112
  ## [1.1.0] - 2026-07-21
94
113
 
95
114
  ### Added
@@ -126,11 +145,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
126
145
  ### Notes
127
146
  - Both backends are always scaffolded, so you can switch later without
128
147
  re-creating the project. The PHP front controller only serves `.php` endpoint
129
- files and the Node one only `.js`, so they coexist without conflict.
130
-
131
- ## [1.0.2]
132
-
133
- - Previous release (PHP backend only).
134
-
135
- [1.1.0]: https://github.com/Rhaastrake/Nibula/releases/tag/v1.1.0
136
- [1.0.2]: https://github.com/Rhaastrake/Nibula/releases/tag/v1.0.2
148
+ files and the Node one only `.js`, so they coexist without conflict.
package/README.md CHANGED
@@ -21,7 +21,7 @@ Building a website from scratch involves a lot of moving parts: templating, buil
21
21
  - 🪶 **Lightweight by default** — SCSS frameworks can be filtered so you ship only what you actually use
22
22
  - 🌍 **Open source** — free to use, free to modify, free to share
23
23
 
24
- ![Version](https://img.shields.io/badge/version-1.2.2-blue)
24
+ ![Version](https://img.shields.io/badge/version-1.2.4-blue)
25
25
  ![License](https://img.shields.io/badge/license-Apache--2.0-blue)
26
26
  ![Eleventy](https://img.shields.io/badge/11ty-v3.1.2-black)
27
27
 
package/bin/create.js CHANGED
@@ -5,7 +5,7 @@ const path = require('path');
5
5
  const readline = require('readline');
6
6
  const { writeSync } = require('fs');
7
7
  const { spawnSync } = require('child_process');
8
- const { color } = require('../tools/modules/constants');
8
+ const { color } = require('../tools/lib/colors');
9
9
 
10
10
  // ── PATHS ────────────────────────────────────────────────────────────────────
11
11
 
@@ -170,7 +170,6 @@ const PROJECT_PACKAGE = {
170
170
  'bootstrap-icons': '^1.13.1',
171
171
  'bulma': '^1.0.4',
172
172
  'foundation-sites': '^6.9.0',
173
- 'github-markdown-css': '^5.9.0',
174
173
  'glob': '^13.0.6',
175
174
  'uikit': '^3.25.13',
176
175
  },
package/bin/nibula.js CHANGED
@@ -5,7 +5,8 @@ const path = require('path');
5
5
  const https = require('https');
6
6
  const readline = require('readline');
7
7
  const { spawnSync } = require('child_process');
8
- const { findProjectRoot, color, NOT_INSIDE_PROJECT_MESSAGE } = require('../tools/modules/constants');
8
+ const { findProjectRoot, NOT_INSIDE_PROJECT_MESSAGE } = require('../tools/lib/paths');
9
+ const { color } = require('../tools/lib/colors');
9
10
 
10
11
  const pkg = require('../package.json');
11
12
 
@@ -41,8 +42,6 @@ function maybeDelegateToLocal(root) {
41
42
  const local = path.join(root, 'node_modules', 'nibula', 'bin', 'nibula.js');
42
43
  if (!fs.existsSync(local)) return;
43
44
 
44
- // Compare REAL paths so symlinks (e.g. from `npm link`) resolve to the same
45
- // physical file; otherwise the guard would loop forever under npm link.
46
45
  let localReal;
47
46
  let selfReal;
48
47
  try { localReal = fs.realpathSync(local); } catch { return; }
@@ -150,8 +149,6 @@ function globalNibulaPath() {
150
149
  return fs.existsSync(candidate) ? candidate : null;
151
150
  }
152
151
 
153
- // Riesegue il comando con la versione appena installata: questo processo ha
154
- // ancora in memoria il codice vecchio, quindi non può scaffoldare da solo.
155
152
  function reexecAfterUpdate(args) {
156
153
  const target = globalNibulaPath();
157
154
  if (!target) {
package/nginx.conf CHANGED
@@ -1,75 +1,75 @@
1
- # Example nginx directives for a Nibula site — covers BOTH backends.
2
- #
3
- # /api is served by Node (index.js) if it is running on 127.0.0.1:3000; if Node
4
- # is unreachable, nginx falls back to the PHP front controller automatically.
5
- # So the same config works whether you deployed the Node backend or the PHP one:
6
- # - Node backend running -> Node answers /api
7
- # - only PHP deployed -> Node is down -> falls back to PHP-FPM
8
- #
9
- # This is NOT a ready-to-use file: paste these directives inside your own
10
- # server { } block (the one with server_name, listen and SSL) and set `root`
11
- # to your `out` folder.
12
-
13
- # Hide the nginx version from response headers
14
- server_tokens off;
15
-
16
- # Force HTTPS on future requests (applies site-wide, including /api)
17
- add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
18
-
19
- root /var/www/your-site/out;
20
- index index.html;
21
-
22
- # Disable directory listing
23
- autoindex off;
24
-
25
- error_page 403 404 /404.html;
26
- location = /404.html {
27
- internal;
28
- }
29
-
30
- # Never expose the backend source directory over HTTP.
31
- location ^~ /backend/ {
32
- return 404;
33
- }
34
-
35
- # Block server config files anywhere in the tree (.htaccess, web.config).
36
- location ~* (^|/)(\.htaccess|web\.config)$ {
37
- return 404;
38
- }
39
-
40
- # --- /api: Node primary, PHP fallback ---------------------------------------
41
- # Try the Node backend first. If it is down (502/504), retry through the PHP
42
- # front controller. Security headers for API responses are set by the backend.
43
- location ^~ /api/ {
44
- proxy_pass http://127.0.0.1:3000;
45
- proxy_http_version 1.1;
46
- proxy_set_header Host $host;
47
- proxy_set_header X-Real-IP $remote_addr;
48
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
- proxy_set_header X-Forwarded-Proto $scheme;
50
-
51
- proxy_intercept_errors on;
52
- error_page 502 504 = @php_backend;
53
- }
54
-
55
- location @php_backend {
56
- include fastcgi_params;
57
- fastcgi_param SCRIPT_FILENAME $document_root/backend/_core/index.php;
58
-
59
- # Adjust the PHP-FPM socket to your distro:
60
- # Debian / Ubuntu : unix:/run/php/php8.3-fpm.sock
61
- # RHEL / Fedora : unix:/run/php-fpm/php-fpm.sock
62
- # TCP fallback : 127.0.0.1:9000
63
- fastcgi_pass unix:/run/php/php8.3-fpm.sock;
64
- }
65
-
66
- # Serve static files, fall back to the 404 page.
67
- # A location with add_header does not inherit server-level headers,
68
- # so Strict-Transport-Security is repeated here.
69
- location / {
70
- add_header X-Content-Type-Options "nosniff" always;
71
- add_header X-Frame-Options "SAMEORIGIN" always;
72
- add_header Referrer-Policy "strict-origin-when-cross-origin" always;
73
- add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
74
- try_files $uri $uri/ /404.html;
75
- }
1
+ # Example nginx directives for a Nibula site — covers BOTH backends.
2
+ #
3
+ # /api is served by Node (index.js) if it is running on 127.0.0.1:3000; if Node
4
+ # is unreachable, nginx falls back to the PHP front controller automatically.
5
+ # So the same config works whether you deployed the Node backend or the PHP one:
6
+ # - Node backend running -> Node answers /api
7
+ # - only PHP deployed -> Node is down -> falls back to PHP-FPM
8
+ #
9
+ # This is NOT a ready-to-use file: paste these directives inside your own
10
+ # server { } block (the one with server_name, listen and SSL) and set `root`
11
+ # to your `out` folder.
12
+
13
+ # Hide the nginx version from response headers
14
+ server_tokens off;
15
+
16
+ # Force HTTPS on future requests (applies site-wide, including /api)
17
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
18
+
19
+ root /var/www/your-site/out;
20
+ index index.html;
21
+
22
+ # Disable directory listing
23
+ autoindex off;
24
+
25
+ error_page 403 404 /404.html;
26
+ location = /404.html {
27
+ internal;
28
+ }
29
+
30
+ # Never expose the backend source directory over HTTP.
31
+ location ^~ /backend/ {
32
+ return 404;
33
+ }
34
+
35
+ # Block server config files anywhere in the tree (.htaccess, web.config).
36
+ location ~* (^|/)(\.htaccess|web\.config)$ {
37
+ return 404;
38
+ }
39
+
40
+ # --- /api: Node primary, PHP fallback ---------------------------------------
41
+ # Try the Node backend first. If it is down (502/504), retry through the PHP
42
+ # front controller. Security headers for API responses are set by the backend.
43
+ location ^~ /api/ {
44
+ proxy_pass http://127.0.0.1:3000;
45
+ proxy_http_version 1.1;
46
+ proxy_set_header Host $host;
47
+ proxy_set_header X-Real-IP $remote_addr;
48
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
+ proxy_set_header X-Forwarded-Proto $scheme;
50
+
51
+ proxy_intercept_errors on;
52
+ error_page 502 504 = @php_backend;
53
+ }
54
+
55
+ location @php_backend {
56
+ include fastcgi_params;
57
+ fastcgi_param SCRIPT_FILENAME $document_root/backend/_core/index.php;
58
+
59
+ # Adjust the PHP-FPM socket to your distro:
60
+ # Debian / Ubuntu : unix:/run/php/php8.3-fpm.sock
61
+ # RHEL / Fedora : unix:/run/php-fpm/php-fpm.sock
62
+ # TCP fallback : 127.0.0.1:9000
63
+ fastcgi_pass unix:/run/php/php8.3-fpm.sock;
64
+ }
65
+
66
+ # Serve static files, fall back to the 404 page.
67
+ # A location with add_header does not inherit server-level headers,
68
+ # so Strict-Transport-Security is repeated here.
69
+ location / {
70
+ add_header X-Content-Type-Options "nosniff" always;
71
+ add_header X-Frame-Options "SAMEORIGIN" always;
72
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
73
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
74
+ try_files $uri $uri/ /404.html;
75
+ }
package/package.json CHANGED
@@ -1,74 +1,74 @@
1
- {
2
- "name": "nibula",
3
- "version": "1.2.2",
4
- "description": "A beginner-friendly static site generator built on Eleventy that stays close to vanilla HTML, CSS and JS — with a page-management CLI, an optional PHP backend, and SEO files generated for you.",
5
- "keywords": [
6
- "static-site-generator",
7
- "ssg",
8
- "eleventy",
9
- "11ty",
10
- "boilerplate",
11
- "starter",
12
- "scaffolding",
13
- "cli",
14
- "vanilla",
15
- "vanilla-js",
16
- "html",
17
- "css",
18
- "scss",
19
- "sass",
20
- "njk",
21
- "nunjucks",
22
- "components",
23
- "backend",
24
- "php",
25
- "node",
26
- "python",
27
- "beginner-friendly",
28
- "seo",
29
- "sitemap",
30
- "website-template",
31
- "frontend"
32
- ],
33
- "author": "Michele Garofalo",
34
- "license": "Apache-2.0",
35
- "homepage": "https://github.com/Rhaastrake/Nibula#readme",
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/Rhaastrake/Nibula.git"
39
- },
40
- "bugs": {
41
- "url": "https://github.com/Rhaastrake/Nibula/issues"
42
- },
43
- "outputDir": "out",
44
- "bin": {
45
- "nib": "bin/nibula.js",
46
- "nbl": "bin/nibula.js",
47
- "nibula": "bin/nibula.js"
48
- },
49
- "scripts": {
50
- "build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet --load-path=node_modules",
51
- "build:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --minify",
52
- "build:11ty": "eleventy",
53
- "build": "npm run clean && npm run build:css && npm run build:js && npm run build:11ty",
54
- "serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet --load-path=node_modules",
55
- "serve:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --watch",
56
- "serve:11ty": "eleventy --serve --quiet",
57
- "clean": "node tools/cleanOutput.js",
58
- "serve": "npm run clean && concurrently \"npm run serve:11ty\" \"npm run serve:css\" \"npm run serve:js\"",
59
- "assistant": "node tools/assistant.js"
60
- },
61
- "devDependencies": {
62
- "@11ty/eleventy": "^3.1.2",
63
- "@11ty/eleventy-img": "^6.0.4",
64
- "bootstrap": "^5.3.8",
65
- "bootstrap-icons": "^1.13.1",
66
- "bulma": "^1.0.4",
67
- "concurrently": "^9.2.1",
68
- "esbuild": "^0.27.3",
69
- "foundation-sites": "^6.9.0",
70
- "glob": "^13.0.6",
71
- "sass": "^1.77.0",
72
- "uikit": "^3.25.13"
73
- }
74
- }
1
+ {
2
+ "name": "nibula",
3
+ "version": "1.2.4",
4
+ "description": "A beginner-friendly static site generator built on Eleventy that stays close to vanilla HTML, CSS and JS — with a page-management CLI, an optional PHP backend, and SEO files generated for you.",
5
+ "keywords": [
6
+ "static-site-generator",
7
+ "ssg",
8
+ "eleventy",
9
+ "11ty",
10
+ "boilerplate",
11
+ "starter",
12
+ "scaffolding",
13
+ "cli",
14
+ "vanilla",
15
+ "vanilla-js",
16
+ "html",
17
+ "css",
18
+ "scss",
19
+ "sass",
20
+ "njk",
21
+ "nunjucks",
22
+ "components",
23
+ "backend",
24
+ "php",
25
+ "node",
26
+ "python",
27
+ "beginner-friendly",
28
+ "seo",
29
+ "sitemap",
30
+ "website-template",
31
+ "frontend"
32
+ ],
33
+ "author": "Michele Garofalo",
34
+ "license": "Apache-2.0",
35
+ "homepage": "https://github.com/Rhaastrake/Nibula#readme",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/Rhaastrake/Nibula.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/Rhaastrake/Nibula/issues"
42
+ },
43
+ "outputDir": "out",
44
+ "bin": {
45
+ "nib": "bin/nibula.js",
46
+ "nbl": "bin/nibula.js",
47
+ "nibula": "bin/nibula.js"
48
+ },
49
+ "scripts": {
50
+ "build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet --load-path=node_modules",
51
+ "build:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --minify",
52
+ "build:11ty": "eleventy",
53
+ "build": "npm run clean && npm run build:css && npm run build:js && npm run build:11ty",
54
+ "serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet --load-path=node_modules",
55
+ "serve:js": "esbuild \"src/frontend/ts/pages/*.ts\" --bundle --outdir=out/js/pages --watch",
56
+ "serve:11ty": "eleventy --serve --quiet",
57
+ "clean": "node tools/cleanOutput.js",
58
+ "serve": "npm run clean && concurrently \"npm run serve:11ty\" \"npm run serve:css\" \"npm run serve:js\"",
59
+ "assistant": "node tools/assistant.js"
60
+ },
61
+ "devDependencies": {
62
+ "@11ty/eleventy": "^3.1.2",
63
+ "@11ty/eleventy-img": "^6.0.4",
64
+ "bootstrap": "^5.3.8",
65
+ "bootstrap-icons": "^1.13.1",
66
+ "bulma": "^1.0.4",
67
+ "concurrently": "^9.2.1",
68
+ "esbuild": "^0.27.3",
69
+ "foundation-sites": "^6.9.0",
70
+ "glob": "^13.0.6",
71
+ "sass": "^1.77.0",
72
+ "uikit": "^3.25.13"
73
+ }
74
+ }