nibula 1.2.3 → 1.2.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.
Files changed (106) hide show
  1. package/.eleventy.js +81 -81
  2. package/.eleventyignore +3 -3
  3. package/.github/workflows/publish.yml +37 -0
  4. package/CHANGELOG.md +166 -135
  5. package/LICENSE +169 -169
  6. package/NOTICE +4 -4
  7. package/README.md +120 -123
  8. package/bin/create.js +507 -507
  9. package/bin/nibula.js +316 -307
  10. package/docs/Assistant CLI.md +65 -65
  11. package/docs/Backend.md +295 -295
  12. package/docs/Components.md +84 -84
  13. package/docs/Creating pages.md +64 -64
  14. package/docs/Deploy.md +189 -189
  15. package/docs/Head and SEO.md +138 -138
  16. package/docs/Javascript.md +50 -50
  17. package/docs/Styling with SCSS.md +141 -141
  18. package/nginx.conf +75 -75
  19. package/package.json +1 -1
  20. package/src/backend/.htaccess +6 -6
  21. package/src/backend/_core/composer.json +5 -5
  22. package/src/backend/_core/composer.lock +492 -492
  23. package/src/backend/_core/index.js +267 -267
  24. package/src/backend/_core/index.php +147 -147
  25. package/src/backend/_core/init.js +52 -52
  26. package/src/backend/_core/init.php +33 -33
  27. package/src/backend/_core/modules/RateLimiter.js +58 -58
  28. package/src/backend/_core/modules/RateLimiter.php +30 -30
  29. package/src/backend/_core/modules/Response.js +59 -59
  30. package/src/backend/_core/modules/Response.php +48 -48
  31. package/src/backend/api/protected/example-protected.js +23 -23
  32. package/src/backend/api/protected/example-protected.php +16 -16
  33. package/src/backend/api/public/example-public.js +24 -24
  34. package/src/backend/api/public/example-public.php +16 -16
  35. package/src/backend/backend-node.service.example +30 -30
  36. package/src/backend/database/Database.js +46 -46
  37. package/src/backend/database/Database.php +23 -23
  38. package/src/backend/example.config.js +37 -37
  39. package/src/backend/example.config.php +27 -27
  40. package/src/backend/package.json +18 -18
  41. package/src/backend/web.config +16 -16
  42. package/src/frontend/.htaccess +51 -51
  43. package/src/frontend/404.njk +17 -17
  44. package/src/frontend/assets/brand/favicon.svg +54 -54
  45. package/src/frontend/assets/brand/logo.svg +54 -54
  46. package/src/frontend/components/global/footer.njk +25 -25
  47. package/src/frontend/components/global/header.njk +6 -6
  48. package/src/frontend/components/welcome.njk +114 -114
  49. package/src/frontend/data/site.json +48 -48
  50. package/src/frontend/index.njk +8 -8
  51. package/src/frontend/js/modules/exampleModule.js +2 -2
  52. package/src/frontend/js/pages/404.js +6 -6
  53. package/src/frontend/js/pages/homepage.js +6 -6
  54. package/src/frontend/layouts/base.njk +132 -132
  55. package/src/frontend/layouts/page-components.njk +13 -13
  56. package/src/frontend/llms.njk +17 -17
  57. package/src/frontend/robots.njk +7 -7
  58. package/src/frontend/scss/modules/_animations.scss +24 -24
  59. package/src/frontend/scss/modules/_footer.scss +27 -27
  60. package/src/frontend/scss/modules/_global.scss +47 -47
  61. package/src/frontend/scss/modules/_header.scss +27 -27
  62. package/src/frontend/scss/modules/_mobile.scss +29 -29
  63. package/src/frontend/scss/modules/_root.scss +34 -34
  64. package/src/frontend/scss/modules/_typography.scss +14 -14
  65. package/src/frontend/scss/modules/frameworks/_bootstrap.scss +109 -109
  66. package/src/frontend/scss/modules/frameworks/_bulma.scss +108 -108
  67. package/src/frontend/scss/modules/frameworks/_foundation.scss +138 -139
  68. package/src/frontend/scss/modules/frameworks/_uikit.scss +109 -109
  69. package/src/frontend/scss/pages/404.scss +27 -27
  70. package/src/frontend/scss/pages/homepage.scss +22 -22
  71. package/src/frontend/sitemap.njk +17 -17
  72. package/src/frontend/ts/modules/exampleModule.ts +2 -2
  73. package/src/frontend/ts/pages/404.ts +6 -6
  74. package/src/frontend/ts/pages/homepage.ts +6 -6
  75. package/src/frontend/web.config +55 -55
  76. package/tools/assistant.js +122 -151
  77. package/tools/buildJs.js +39 -37
  78. package/tools/cleanOutput.js +23 -25
  79. package/tools/cli/prompt.js +40 -0
  80. package/tools/cli/ui.js +74 -0
  81. package/tools/config/messages.json +78 -0
  82. package/tools/config/settings.json +135 -0
  83. package/tools/lib/colors.js +17 -0
  84. package/tools/lib/files.js +65 -0
  85. package/tools/lib/logger.js +22 -0
  86. package/tools/lib/outputPath.js +141 -0
  87. package/tools/lib/pageActions.js +138 -0
  88. package/tools/lib/pageArtifacts.js +46 -0
  89. package/tools/lib/pageComponents.js +88 -0
  90. package/tools/lib/paths.js +61 -0
  91. package/tools/lib/project.js +54 -0
  92. package/tools/lib/siteData.js +93 -0
  93. package/tools/lib/text.js +47 -0
  94. package/tools/lib/validation.js +39 -0
  95. package/tools/res/templates/template.js +7 -5
  96. package/tools/res/templates/template.njk +8 -8
  97. package/tools/res/templates/template.scss +22 -22
  98. package/tools/res/templates/template.ts +7 -5
  99. package/tsconfig.json +24 -24
  100. package/tools/modules/constants.js +0 -66
  101. package/tools/modules/pageComponents.js +0 -77
  102. package/tools/modules/updateData.js +0 -90
  103. package/tools/modules/updateOutputPath.js +0 -133
  104. package/tools/modules/updatePage.js +0 -162
  105. package/tools/modules/utils.js +0 -27
  106. package/tools/modules/validation.js +0 -30
@@ -1,85 +1,85 @@
1
- # Nunjucks (HTML) Components
2
-
3
- ## What is Nunjucks
4
-
5
- Nunjucks (`.njk`) is an HTML file that supports logic like variables, `if` statements, and `for` loops. It can extend a base layout and include other `.njk` components
6
-
7
- ## Create a component
8
-
9
- Create a new `.njk` file anywhere inside `src/frontend/components/`. You can organize them into subfolders freely
10
-
11
- ```
12
- src/frontend/components/
13
- ├── global/
14
- ├── layouts/
15
- ├── modals/
16
- │ └── privacyModal.njk # You can move it to a modals/subfolder
17
- ├── welcome.njk
18
- ```
19
-
20
- ## Include a component
21
-
22
- To render a component inside a page, navigate to `src/frontend/layouts/` and edit `page-components.njk`
23
-
24
- ### page-components.njk <small>(`src/frontend/layouts/`)</small>
25
-
26
- ```js
27
- {% if title == "homepage" %}
28
- {% include "welcome.njk" %}
29
-
30
- {% elif title == "examplePage" %}
31
- {% include "exampleComponent1.njk" %}
32
- {% include "subfolder/exampleComponent2.njk" %}
33
-
34
- {% else %}
35
- {% include "404/_404.njk" %}
36
- {{ content | safe }}
37
- {% endif %}
38
- ```
39
-
40
- Add a new `{% elif %}` block for each page, listing its components in order. If a component lives in a subfolder, specify the relative path accordingly
41
-
42
- > ⚠️ A new `elif` block is automatically added when you create a page via the Assistant CLI
43
-
44
- > ⚠️ If you move or delete a component, always update `page-components.njk` or the site will break
45
-
46
- ## Nest components
47
-
48
- A component can include other components. This is useful for breaking complex sections into smaller, reusable pieces.
49
-
50
- ### exampleComponent.njk
51
- ```js
52
- <section class="hero">
53
- {% include "ui/heroTitle.njk" %}
54
- {% include "ui/heroButton.njk" %}
55
- </section>
56
- ```
57
-
58
- > The same path rules apply: if the included component is in a subfolder, specify the full relative path.
59
-
60
- ## Global components
61
-
62
- Header and footer live in `src/frontend/components/global/` and are automatically included in every page via `base.njk`. Edit them to change the site-wide layout
63
-
64
- ## Site data in components
65
-
66
- All values defined in `src/frontend/data/site.json` are globally available in every component via `{{ site.* }}`
67
-
68
- ### site.json <small>(`src/frontend/data/`)</small>
69
- ```json
70
- {
71
- "title": "My Site",
72
- "theme": "dark",
73
- "logo": "/assets/brand/logo.svg",
74
- "legal": {
75
- "privacy": "/privacy"
76
- }
77
- }
78
- ```
79
-
80
- ### Usage in any `.njk` file
81
- ```js
82
- <p>{{ site.title }}</p>
83
- <a href="{{ site.legal.privacy }}">Privacy Policy</a>
84
- <img src="{{ site.logo }}" alt="{{ site.title }}">
1
+ # Nunjucks (HTML) Components
2
+
3
+ ## What is Nunjucks
4
+
5
+ Nunjucks (`.njk`) is an HTML file that supports logic like variables, `if` statements, and `for` loops. It can extend a base layout and include other `.njk` components
6
+
7
+ ## Create a component
8
+
9
+ Create a new `.njk` file anywhere inside `src/frontend/components/`. You can organize them into subfolders freely
10
+
11
+ ```
12
+ src/frontend/components/
13
+ ├── global/
14
+ ├── layouts/
15
+ ├── modals/
16
+ │ └── privacyModal.njk # You can move it to a modals/subfolder
17
+ ├── welcome.njk
18
+ ```
19
+
20
+ ## Include a component
21
+
22
+ To render a component inside a page, navigate to `src/frontend/layouts/` and edit `page-components.njk`
23
+
24
+ ### page-components.njk <small>(`src/frontend/layouts/`)</small>
25
+
26
+ ```js
27
+ {% if title == "homepage" %}
28
+ {% include "welcome.njk" %}
29
+
30
+ {% elif title == "examplePage" %}
31
+ {% include "exampleComponent1.njk" %}
32
+ {% include "subfolder/exampleComponent2.njk" %}
33
+
34
+ {% else %}
35
+ {% include "404/_404.njk" %}
36
+ {{ content | safe }}
37
+ {% endif %}
38
+ ```
39
+
40
+ Add a new `{% elif %}` block for each page, listing its components in order. If a component lives in a subfolder, specify the relative path accordingly
41
+
42
+ > ⚠️ A new `elif` block is automatically added when you create a page via the Assistant CLI
43
+
44
+ > ⚠️ If you move or delete a component, always update `page-components.njk` or the site will break
45
+
46
+ ## Nest components
47
+
48
+ A component can include other components. This is useful for breaking complex sections into smaller, reusable pieces.
49
+
50
+ ### exampleComponent.njk
51
+ ```js
52
+ <section class="hero">
53
+ {% include "ui/heroTitle.njk" %}
54
+ {% include "ui/heroButton.njk" %}
55
+ </section>
56
+ ```
57
+
58
+ > The same path rules apply: if the included component is in a subfolder, specify the full relative path.
59
+
60
+ ## Global components
61
+
62
+ Header and footer live in `src/frontend/components/global/` and are automatically included in every page via `base.njk`. Edit them to change the site-wide layout
63
+
64
+ ## Site data in components
65
+
66
+ All values defined in `src/frontend/data/site.json` are globally available in every component via `{{ site.* }}`
67
+
68
+ ### site.json <small>(`src/frontend/data/`)</small>
69
+ ```json
70
+ {
71
+ "title": "My Site",
72
+ "theme": "dark",
73
+ "logo": "/assets/brand/logo.svg",
74
+ "legal": {
75
+ "privacy": "/privacy"
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### Usage in any `.njk` file
81
+ ```js
82
+ <p>{{ site.title }}</p>
83
+ <a href="{{ site.legal.privacy }}">Privacy Policy</a>
84
+ <img src="{{ site.logo }}" alt="{{ site.title }}">
85
85
  ```
@@ -1,65 +1,65 @@
1
- # Creating Pages
2
-
3
- > Examples use JavaScript, but everything applies equally to TypeScript. The only difference is the file extension (`.ts` instead of `.js`), that imports do **not** include the extension, and that paths use `src/frontend/ts/` instead of `src/frontend/js/`.
4
-
5
- The recommended way is via the **Assistant CLI**
6
-
7
- ## What gets created
8
- For a page named `my-page`:
9
-
10
- | File | Purpose |
11
- |---|---|
12
- | `src/frontend/routes/my-page.njk` | Template with front matter |
13
- | `src/frontend/scss/pages/myPage.scss` | Imports framework + modules |
14
- | `src/frontend/js/pages/myPage.js` | Imports JS modules |
15
-
16
- ## Adding content
17
-
18
- 1. Create a component in `src/frontend/components/` (e.g. `_myPage.njk`)
19
- 2. Include it in `src/frontend/layouts/page-components.njk` inside the generated `elif` block:
20
-
21
- ```njk
22
- {% elif title == "myPage" %}
23
- {% include "_myPage.njk" %}
24
- ```
25
-
26
- See **Components** DOC file for more info
27
-
28
- ## URL and title
29
-
30
- The URL is the kebab-case name (`/my-page/`). The `title` in the front matter is camelCase (`myPage`) and is used internally to load the correct CSS and JS files — do not change it.
31
-
32
- ## Subpages (nested URLs)
33
-
34
- To create a URL like `domain.it/about/team`, edit the `permalink` in `src/frontend/routes/team.njk` and add the parent segment before the final slash:
35
-
36
- ```njk
37
- ---
38
- title: "team"
39
- permalink: "about/team/"
40
- layout: page-components.njk
41
- ---
42
- ```
43
-
44
- The parent path (`about`) does **not** need to exist as a real page — it's just a URL prefix. Only the last segment (`team`) must match the filename and the `title` in the front matter.
45
-
46
- | Goal URL | permalink value | File |
47
- |---|---|---|
48
- | `/team/` | `/team/` | `routes/team.njk` |
49
- | `/about/team/` | `/about/team/` | `routes/team.njk` |
50
- | `/company/about/team/` | `/company/about/team/` | `routes/team.njk` |
51
-
52
- ## SEO
53
-
54
- The CLI creates a stub entry in `src/frontend/data/site.json`. Fill it in:
55
-
56
- ```json
57
- "myPage": {
58
- "seo": {
59
- "title": "My Page | Site Name",
60
- "description": "Page description"
61
- }
62
- }
63
- ```
64
-
1
+ # Creating Pages
2
+
3
+ > Examples use JavaScript, but everything applies equally to TypeScript. The only difference is the file extension (`.ts` instead of `.js`), that imports do **not** include the extension, and that paths use `src/frontend/ts/` instead of `src/frontend/js/`.
4
+
5
+ The recommended way is via the **Assistant CLI**
6
+
7
+ ## What gets created
8
+ For a page named `my-page`:
9
+
10
+ | File | Purpose |
11
+ |---|---|
12
+ | `src/frontend/routes/my-page.njk` | Template with front matter |
13
+ | `src/frontend/scss/pages/myPage.scss` | Imports framework + modules |
14
+ | `src/frontend/js/pages/myPage.js` | Imports JS modules |
15
+
16
+ ## Adding content
17
+
18
+ 1. Create a component in `src/frontend/components/` (e.g. `_myPage.njk`)
19
+ 2. Include it in `src/frontend/layouts/page-components.njk` inside the generated `elif` block:
20
+
21
+ ```njk
22
+ {% elif title == "myPage" %}
23
+ {% include "_myPage.njk" %}
24
+ ```
25
+
26
+ See **Components** DOC file for more info
27
+
28
+ ## URL and title
29
+
30
+ The URL is the kebab-case name (`/my-page/`). The `title` in the front matter is camelCase (`myPage`) and is used internally to load the correct CSS and JS files — do not change it.
31
+
32
+ ## Subpages (nested URLs)
33
+
34
+ To create a URL like `domain.it/about/team`, edit the `permalink` in `src/frontend/routes/team.njk` and add the parent segment before the final slash:
35
+
36
+ ```njk
37
+ ---
38
+ title: "team"
39
+ permalink: "about/team/"
40
+ layout: page-components.njk
41
+ ---
42
+ ```
43
+
44
+ The parent path (`about`) does **not** need to exist as a real page — it's just a URL prefix. Only the last segment (`team`) must match the filename and the `title` in the front matter.
45
+
46
+ | Goal URL | permalink value | File |
47
+ |---|---|---|
48
+ | `/team/` | `/team/` | `routes/team.njk` |
49
+ | `/about/team/` | `/about/team/` | `routes/team.njk` |
50
+ | `/company/about/team/` | `/company/about/team/` | `routes/team.njk` |
51
+
52
+ ## SEO
53
+
54
+ The CLI creates a stub entry in `src/frontend/data/site.json`. Fill it in:
55
+
56
+ ```json
57
+ "myPage": {
58
+ "seo": {
59
+ "title": "My Page | Site Name",
60
+ "description": "Page description"
61
+ }
62
+ }
63
+ ```
64
+
65
65
  See **Head & SEO** for all available options.