nibula 1.2.4 → 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.
- package/.eleventy.js +81 -81
- package/.eleventyignore +3 -3
- package/.github/workflows/publish.yml +37 -0
- package/CHANGELOG.md +166 -148
- package/LICENSE +169 -169
- package/NOTICE +4 -4
- package/README.md +120 -123
- package/bin/create.js +507 -507
- package/bin/nibula.js +317 -305
- package/docs/Assistant CLI.md +65 -65
- package/docs/Backend.md +295 -295
- package/docs/Components.md +84 -84
- package/docs/Creating pages.md +64 -64
- package/docs/Deploy.md +189 -189
- package/docs/Head and SEO.md +138 -138
- package/docs/Javascript.md +50 -50
- package/docs/Styling with SCSS.md +141 -141
- package/nginx.conf +75 -75
- package/package.json +1 -1
- package/src/backend/.htaccess +6 -6
- package/src/backend/_core/composer.json +5 -5
- package/src/backend/_core/composer.lock +492 -492
- package/src/backend/_core/index.js +267 -267
- package/src/backend/_core/index.php +147 -147
- package/src/backend/_core/init.js +52 -52
- package/src/backend/_core/init.php +33 -33
- package/src/backend/_core/modules/RateLimiter.js +58 -58
- package/src/backend/_core/modules/RateLimiter.php +30 -30
- package/src/backend/_core/modules/Response.js +59 -59
- package/src/backend/_core/modules/Response.php +48 -48
- package/src/backend/api/protected/example-protected.js +23 -23
- package/src/backend/api/protected/example-protected.php +16 -16
- package/src/backend/api/public/example-public.js +24 -24
- package/src/backend/api/public/example-public.php +16 -16
- package/src/backend/backend-node.service.example +30 -30
- package/src/backend/database/Database.js +46 -46
- package/src/backend/database/Database.php +23 -23
- package/src/backend/example.config.js +37 -37
- package/src/backend/example.config.php +27 -27
- package/src/backend/package.json +18 -18
- package/src/backend/web.config +16 -16
- package/src/frontend/.htaccess +51 -51
- package/src/frontend/404.njk +17 -17
- package/src/frontend/assets/brand/favicon.svg +54 -54
- package/src/frontend/assets/brand/logo.svg +54 -54
- package/src/frontend/components/global/footer.njk +25 -25
- package/src/frontend/components/global/header.njk +6 -6
- package/src/frontend/components/welcome.njk +114 -114
- package/src/frontend/data/site.json +48 -48
- package/src/frontend/index.njk +8 -8
- package/src/frontend/js/modules/exampleModule.js +2 -2
- package/src/frontend/js/pages/404.js +6 -6
- package/src/frontend/js/pages/homepage.js +6 -6
- package/src/frontend/layouts/base.njk +132 -132
- package/src/frontend/layouts/page-components.njk +13 -13
- package/src/frontend/llms.njk +17 -17
- package/src/frontend/robots.njk +7 -7
- package/src/frontend/scss/modules/_animations.scss +24 -24
- package/src/frontend/scss/modules/_footer.scss +27 -27
- package/src/frontend/scss/modules/_global.scss +47 -47
- package/src/frontend/scss/modules/_header.scss +27 -27
- package/src/frontend/scss/modules/_mobile.scss +29 -29
- package/src/frontend/scss/modules/_root.scss +34 -34
- package/src/frontend/scss/modules/_typography.scss +14 -14
- package/src/frontend/scss/modules/frameworks/_bootstrap.scss +109 -109
- package/src/frontend/scss/modules/frameworks/_bulma.scss +108 -108
- package/src/frontend/scss/modules/frameworks/_foundation.scss +138 -139
- package/src/frontend/scss/modules/frameworks/_uikit.scss +109 -109
- package/src/frontend/scss/pages/404.scss +27 -27
- package/src/frontend/scss/pages/homepage.scss +22 -22
- package/src/frontend/sitemap.njk +17 -17
- package/src/frontend/ts/modules/exampleModule.ts +2 -2
- package/src/frontend/ts/pages/404.ts +6 -6
- package/src/frontend/ts/pages/homepage.ts +6 -6
- package/src/frontend/web.config +55 -55
- package/tools/config/messages.json +3 -1
- package/tools/res/templates/template.js +6 -6
- package/tools/res/templates/template.njk +8 -8
- package/tools/res/templates/template.scss +22 -22
- package/tools/res/templates/template.ts +6 -6
- package/tsconfig.json +24 -24
package/docs/Javascript.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
# JavaScript
|
|
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
|
-
## Page JS
|
|
6
|
-
|
|
7
|
-
Each page has its own JS entry point in `src/frontend/js/pages/`, bundled and minified by esbuild and loaded automatically by `base.njk`.
|
|
8
|
-
|
|
9
|
-
Import only what the page needs.
|
|
10
|
-
|
|
11
|
-
### examplePage.js <small>(`src/frontend/js/pages/`)</small>
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
// import { initExampleModule } from '../modules/exampleModule.js';
|
|
15
|
-
|
|
16
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
-
// initExampleModule();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Page logic here
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Modules
|
|
24
|
-
|
|
25
|
-
Modules live in `src/frontend/js/modules/`. Modules that interact with the DOM must be called inside `DOMContentLoaded`; others can be called anywhere.
|
|
26
|
-
|
|
27
|
-
## Adding a module
|
|
28
|
-
|
|
29
|
-
Create a new `.js` file in `src/frontend/js/modules/`. Subfolders are allowed.
|
|
30
|
-
|
|
31
|
-
Use ESM syntax — esbuild handles the bundling:
|
|
32
|
-
|
|
33
|
-
### exampleModule.js <small>(`src/frontend/js/modules/`)</small>
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
export function exampleModule() {
|
|
37
|
-
// Module logic here
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Then import it in the pages that need it:
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
import { exampleModule } from '../modules/exampleModule.js';
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
In TypeScript, omit the extension:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
import { exampleModule } from '../modules/exampleModule';
|
|
1
|
+
# JavaScript
|
|
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
|
+
## Page JS
|
|
6
|
+
|
|
7
|
+
Each page has its own JS entry point in `src/frontend/js/pages/`, bundled and minified by esbuild and loaded automatically by `base.njk`.
|
|
8
|
+
|
|
9
|
+
Import only what the page needs.
|
|
10
|
+
|
|
11
|
+
### examplePage.js <small>(`src/frontend/js/pages/`)</small>
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// import { initExampleModule } from '../modules/exampleModule.js';
|
|
15
|
+
|
|
16
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
+
// initExampleModule();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Page logic here
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Modules
|
|
24
|
+
|
|
25
|
+
Modules live in `src/frontend/js/modules/`. Modules that interact with the DOM must be called inside `DOMContentLoaded`; others can be called anywhere.
|
|
26
|
+
|
|
27
|
+
## Adding a module
|
|
28
|
+
|
|
29
|
+
Create a new `.js` file in `src/frontend/js/modules/`. Subfolders are allowed.
|
|
30
|
+
|
|
31
|
+
Use ESM syntax — esbuild handles the bundling:
|
|
32
|
+
|
|
33
|
+
### exampleModule.js <small>(`src/frontend/js/modules/`)</small>
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
export function exampleModule() {
|
|
37
|
+
// Module logic here
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then import it in the pages that need it:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { exampleModule } from '../modules/exampleModule.js';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
In TypeScript, omit the extension:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { exampleModule } from '../modules/exampleModule';
|
|
51
51
|
```
|
|
@@ -1,142 +1,142 @@
|
|
|
1
|
-
# Styling with SCSS
|
|
2
|
-
|
|
3
|
-
## Page CSS
|
|
4
|
-
|
|
5
|
-
Each page has its own SCSS entry point in `src/frontend/scss/pages/`
|
|
6
|
-
|
|
7
|
-
It must contain `_root.scss` + other modules like `_global.scss` or any other one that you need and its own specific css rules
|
|
8
|
-
|
|
9
|
-
`_root.scss` uses `@use` to enable namespaced access (`root.$var`); other modules use `@import` as they don't expose variables.
|
|
10
|
-
|
|
11
|
-
### examplePage.scss <small>(`src/frontend/scss/pages/`)</small>
|
|
12
|
-
```scss
|
|
13
|
-
//==========================
|
|
14
|
-
// CSS MODULES IMPORTS
|
|
15
|
-
//==========================
|
|
16
|
-
|
|
17
|
-
@use "../modules/root" as root;
|
|
18
|
-
|
|
19
|
-
@import "../modules/global";
|
|
20
|
-
|
|
21
|
-
//==========================
|
|
22
|
-
// PAGE CUSTOM CSS RULES
|
|
23
|
-
//==========================
|
|
24
|
-
|
|
25
|
-
body {
|
|
26
|
-
background-color: root.$primary;
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Global Variables
|
|
31
|
-
|
|
32
|
-
Instead of using `:root` in your custom modules or pages, the best thing to do is to centralize all your variables in a single file (that will be tree-shaken automatically by Sass)
|
|
33
|
-
|
|
34
|
-
### _root.scss <small>(`src/frontend/scss/modules/`)</small>
|
|
35
|
-
```scss
|
|
36
|
-
$header-height: 10vh;
|
|
37
|
-
|
|
38
|
-
// Usage example (in any other file):
|
|
39
|
-
header {
|
|
40
|
-
height: root.$header-height;
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Scss modules
|
|
45
|
-
|
|
46
|
-
You can create your custom css modules by creating a new `.scss` file in `src/frontend/scss/modules/` (the name of the file must start with `_`)
|
|
47
|
-
|
|
48
|
-
You can create subfolders if you want to refactor the structure, but be sure to update the relative paths in the pages that import them
|
|
49
|
-
|
|
50
|
-
### _yourModule.scss <small>(`src/frontend/scss/modules/subfolder/`)</small>
|
|
51
|
-
```scss
|
|
52
|
-
@use '../root' as root;
|
|
53
|
-
|
|
54
|
-
body {
|
|
55
|
-
background-color: root.$primary;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### examplePage.scss
|
|
60
|
-
```scss
|
|
61
|
-
@import "../modules/subfolder/yourModule";
|
|
62
|
-
|
|
63
|
-
// This page will now inherit the body tag rules
|
|
64
|
-
// If the same property is declared in both, the last imported one wins
|
|
65
|
-
body {
|
|
66
|
-
color: root.$dark;
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Pre-existing modules
|
|
71
|
-
|
|
72
|
-
| File | Purpose |
|
|
73
|
-
|---|---|
|
|
74
|
-
| `_root.scss` | Global variables (colors, spacing) |
|
|
75
|
-
| `_global.scss` | Site-wide base rules and frameworks |
|
|
76
|
-
| `_typography.scss` | Font rules |
|
|
77
|
-
| `_header.scss` | Header styles |
|
|
78
|
-
| `_footer.scss` | Footer styles |
|
|
79
|
-
| `_mobile.scss` | Media query rules |
|
|
80
|
-
| `_animations.scss` | Keyframe animations (`fade-in`, `spin`) |
|
|
81
|
-
|
|
82
|
-
## CSS Framework
|
|
83
|
-
|
|
84
|
-
Some of the most popular css frameworks that supports scss with modules are already installed in `node_modules`
|
|
85
|
-
|
|
86
|
-
You can choose one or none of them (more than 1 works, but you may get in various conflicts)
|
|
87
|
-
|
|
88
|
-
To enable/disable them you have to modify 3 files around the project by just commenting them
|
|
89
|
-
|
|
90
|
-
### 1. _global.scss <small>(`src/frontend/scss/modules/`)</small>
|
|
91
|
-
```scss
|
|
92
|
-
@import "../modules/frameworks/bootstrap";
|
|
93
|
-
// @import "../modules/frameworks/bulma";
|
|
94
|
-
// @import "../modules/frameworks/foundation";
|
|
95
|
-
// @import "../modules/frameworks/uikit";
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 2. base.njk <small>(`src/frontend/layouts/`)</small>
|
|
99
|
-
|
|
100
|
-
```html
|
|
101
|
-
{# Bootstrap JS #}
|
|
102
|
-
<script src="/js/bootstrap.bundle.min.js" defer></script>
|
|
103
|
-
|
|
104
|
-
{# Foundation JS #}
|
|
105
|
-
{# <script src="/js/foundation.min.js" defer></script> #}
|
|
106
|
-
|
|
107
|
-
{# UIkit JS #}
|
|
108
|
-
{# <script src="/js/uikit.min.js" defer></script> #}
|
|
109
|
-
{# <script src="/js/uikit-icons.min.js" defer></script> #}
|
|
110
|
-
|
|
111
|
-
{# Bulma — no JS needed #}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 3. eleventy.config.js
|
|
115
|
-
|
|
116
|
-
```javascript
|
|
117
|
-
eleventyConfig.addPassthroughCopy({
|
|
118
|
-
// Bootstrap
|
|
119
|
-
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "js/bootstrap.bundle.min.js",
|
|
120
|
-
"node_modules/bootstrap-icons/font/fonts": "css/fonts",
|
|
121
|
-
|
|
122
|
-
// Foundation
|
|
123
|
-
// "node_modules/foundation-sites/dist/js/foundation.min.js": "js/foundation.min.js",
|
|
124
|
-
|
|
125
|
-
// UIkit
|
|
126
|
-
// "node_modules/uikit/dist/js/uikit.min.js": "js/uikit.min.js",
|
|
127
|
-
// "node_modules/uikit/dist/js/uikit-icons.min.js": "js/uikit-icons.min.js",
|
|
128
|
-
|
|
129
|
-
// Bulma — CSS only, no JS passthrough needed
|
|
130
|
-
});
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
> ⚠️ Changes to `eleventy.config.js` are not picked up while the dev server is running — restart it.
|
|
134
|
-
|
|
135
|
-
### Reducing bundle size
|
|
136
|
-
|
|
137
|
-
To reduce the bundle size, open the corresponding framework file (`src/frontend/scss/modules/frameworks/`) and comment out any modules you don't need
|
|
138
|
-
|
|
139
|
-
```scss
|
|
140
|
-
@import "bootstrap/scss/card"; // Cards
|
|
141
|
-
@import "bootstrap/scss/carousel"; // Carousel
|
|
1
|
+
# Styling with SCSS
|
|
2
|
+
|
|
3
|
+
## Page CSS
|
|
4
|
+
|
|
5
|
+
Each page has its own SCSS entry point in `src/frontend/scss/pages/`
|
|
6
|
+
|
|
7
|
+
It must contain `_root.scss` + other modules like `_global.scss` or any other one that you need and its own specific css rules
|
|
8
|
+
|
|
9
|
+
`_root.scss` uses `@use` to enable namespaced access (`root.$var`); other modules use `@import` as they don't expose variables.
|
|
10
|
+
|
|
11
|
+
### examplePage.scss <small>(`src/frontend/scss/pages/`)</small>
|
|
12
|
+
```scss
|
|
13
|
+
//==========================
|
|
14
|
+
// CSS MODULES IMPORTS
|
|
15
|
+
//==========================
|
|
16
|
+
|
|
17
|
+
@use "../modules/root" as root;
|
|
18
|
+
|
|
19
|
+
@import "../modules/global";
|
|
20
|
+
|
|
21
|
+
//==========================
|
|
22
|
+
// PAGE CUSTOM CSS RULES
|
|
23
|
+
//==========================
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
background-color: root.$primary;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Global Variables
|
|
31
|
+
|
|
32
|
+
Instead of using `:root` in your custom modules or pages, the best thing to do is to centralize all your variables in a single file (that will be tree-shaken automatically by Sass)
|
|
33
|
+
|
|
34
|
+
### _root.scss <small>(`src/frontend/scss/modules/`)</small>
|
|
35
|
+
```scss
|
|
36
|
+
$header-height: 10vh;
|
|
37
|
+
|
|
38
|
+
// Usage example (in any other file):
|
|
39
|
+
header {
|
|
40
|
+
height: root.$header-height;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Scss modules
|
|
45
|
+
|
|
46
|
+
You can create your custom css modules by creating a new `.scss` file in `src/frontend/scss/modules/` (the name of the file must start with `_`)
|
|
47
|
+
|
|
48
|
+
You can create subfolders if you want to refactor the structure, but be sure to update the relative paths in the pages that import them
|
|
49
|
+
|
|
50
|
+
### _yourModule.scss <small>(`src/frontend/scss/modules/subfolder/`)</small>
|
|
51
|
+
```scss
|
|
52
|
+
@use '../root' as root;
|
|
53
|
+
|
|
54
|
+
body {
|
|
55
|
+
background-color: root.$primary;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### examplePage.scss
|
|
60
|
+
```scss
|
|
61
|
+
@import "../modules/subfolder/yourModule";
|
|
62
|
+
|
|
63
|
+
// This page will now inherit the body tag rules
|
|
64
|
+
// If the same property is declared in both, the last imported one wins
|
|
65
|
+
body {
|
|
66
|
+
color: root.$dark;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Pre-existing modules
|
|
71
|
+
|
|
72
|
+
| File | Purpose |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `_root.scss` | Global variables (colors, spacing) |
|
|
75
|
+
| `_global.scss` | Site-wide base rules and frameworks |
|
|
76
|
+
| `_typography.scss` | Font rules |
|
|
77
|
+
| `_header.scss` | Header styles |
|
|
78
|
+
| `_footer.scss` | Footer styles |
|
|
79
|
+
| `_mobile.scss` | Media query rules |
|
|
80
|
+
| `_animations.scss` | Keyframe animations (`fade-in`, `spin`) |
|
|
81
|
+
|
|
82
|
+
## CSS Framework
|
|
83
|
+
|
|
84
|
+
Some of the most popular css frameworks that supports scss with modules are already installed in `node_modules`
|
|
85
|
+
|
|
86
|
+
You can choose one or none of them (more than 1 works, but you may get in various conflicts)
|
|
87
|
+
|
|
88
|
+
To enable/disable them you have to modify 3 files around the project by just commenting them
|
|
89
|
+
|
|
90
|
+
### 1. _global.scss <small>(`src/frontend/scss/modules/`)</small>
|
|
91
|
+
```scss
|
|
92
|
+
@import "../modules/frameworks/bootstrap";
|
|
93
|
+
// @import "../modules/frameworks/bulma";
|
|
94
|
+
// @import "../modules/frameworks/foundation";
|
|
95
|
+
// @import "../modules/frameworks/uikit";
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. base.njk <small>(`src/frontend/layouts/`)</small>
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
{# Bootstrap JS #}
|
|
102
|
+
<script src="/js/bootstrap.bundle.min.js" defer></script>
|
|
103
|
+
|
|
104
|
+
{# Foundation JS #}
|
|
105
|
+
{# <script src="/js/foundation.min.js" defer></script> #}
|
|
106
|
+
|
|
107
|
+
{# UIkit JS #}
|
|
108
|
+
{# <script src="/js/uikit.min.js" defer></script> #}
|
|
109
|
+
{# <script src="/js/uikit-icons.min.js" defer></script> #}
|
|
110
|
+
|
|
111
|
+
{# Bulma — no JS needed #}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. eleventy.config.js
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
eleventyConfig.addPassthroughCopy({
|
|
118
|
+
// Bootstrap
|
|
119
|
+
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "js/bootstrap.bundle.min.js",
|
|
120
|
+
"node_modules/bootstrap-icons/font/fonts": "css/fonts",
|
|
121
|
+
|
|
122
|
+
// Foundation
|
|
123
|
+
// "node_modules/foundation-sites/dist/js/foundation.min.js": "js/foundation.min.js",
|
|
124
|
+
|
|
125
|
+
// UIkit
|
|
126
|
+
// "node_modules/uikit/dist/js/uikit.min.js": "js/uikit.min.js",
|
|
127
|
+
// "node_modules/uikit/dist/js/uikit-icons.min.js": "js/uikit-icons.min.js",
|
|
128
|
+
|
|
129
|
+
// Bulma — CSS only, no JS passthrough needed
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
> ⚠️ Changes to `eleventy.config.js` are not picked up while the dev server is running — restart it.
|
|
134
|
+
|
|
135
|
+
### Reducing bundle size
|
|
136
|
+
|
|
137
|
+
To reduce the bundle size, open the corresponding framework file (`src/frontend/scss/modules/frameworks/`) and comment out any modules you don't need
|
|
138
|
+
|
|
139
|
+
```scss
|
|
140
|
+
@import "bootstrap/scss/card"; // Cards
|
|
141
|
+
@import "bootstrap/scss/carousel"; // Carousel
|
|
142
142
|
```
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nibula",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
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
5
|
"keywords": [
|
|
6
6
|
"static-site-generator",
|
package/src/backend/.htaccess
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<IfModule mod_rewrite.c>
|
|
2
|
-
RewriteEngine On
|
|
3
|
-
RewriteBase /api/
|
|
4
|
-
|
|
5
|
-
RewriteRule ^_core/index\.php$ - [L]
|
|
6
|
-
RewriteRule ^(.*)$ _core/index.php [QSA,L]
|
|
1
|
+
<IfModule mod_rewrite.c>
|
|
2
|
+
RewriteEngine On
|
|
3
|
+
RewriteBase /api/
|
|
4
|
+
|
|
5
|
+
RewriteRule ^_core/index\.php$ - [L]
|
|
6
|
+
RewriteRule ^(.*)$ _core/index.php [QSA,L]
|
|
7
7
|
</IfModule>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"require": {
|
|
3
|
-
"vlucas/phpdotenv": "^5.6"
|
|
4
|
-
}
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"require": {
|
|
3
|
+
"vlucas/phpdotenv": "^5.6"
|
|
4
|
+
}
|
|
5
|
+
}
|