create-berna-stencil 2.6.3 → 2.6.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/index.js +3 -0
- package/package.json +4 -27
- package/.eleventy.js +0 -94
- package/.eleventyignore +0 -4
- package/LICENSE +0 -170
- package/NOTICE +0 -5
- package/README.md +0 -53
- package/_tools/assistant.js +0 -150
- package/_tools/buildJs.js +0 -28
- package/_tools/cleanOutput.js +0 -20
- package/_tools/modules/constants.js +0 -23
- package/_tools/modules/pageComponents.js +0 -77
- package/_tools/modules/updateData.js +0 -84
- package/_tools/modules/updateOutputPath.js +0 -112
- package/_tools/modules/updatePage.js +0 -162
- package/_tools/modules/utils.js +0 -27
- package/_tools/modules/validation.js +0 -20
- package/_tools/res/templates/template.js +0 -5
- package/_tools/res/templates/template.njk +0 -9
- package/_tools/res/templates/template.scss +0 -23
- package/_tools/res/templates/template.ts +0 -5
- package/bin/create.js +0 -429
- package/docs/Assistant CLI.md +0 -61
- package/docs/Backend.md +0 -148
- package/docs/Components.md +0 -96
- package/docs/Creating pages.md +0 -65
- package/docs/Deploy.md +0 -55
- package/docs/Head and SEO.md +0 -94
- package/docs/Javascript.md +0 -53
- package/docs/Styling with SCSS.md +0 -140
- package/nginx.conf +0 -69
- package/src/backend/.htaccess +0 -7
- package/src/backend/_core/composer.json +0 -5
- package/src/backend/_core/composer.lock +0 -492
- package/src/backend/_core/index.php +0 -148
- package/src/backend/_core/init.php +0 -34
- package/src/backend/_core/modules/RateLimiter.php +0 -31
- package/src/backend/_core/modules/Response.php +0 -49
- package/src/backend/api/protected/example-protected.php +0 -17
- package/src/backend/api/public/example-public.php +0 -17
- package/src/backend/database/Database.php +0 -24
- package/src/backend/database/migrations/create_example_db.sql +0 -1
- package/src/backend/web.config +0 -17
- package/src/frontend/.htaccess +0 -16
- package/src/frontend/404.njk +0 -17
- package/src/frontend/assets/brand/favicon.svg +0 -37
- package/src/frontend/assets/brand/logo.svg +0 -37
- package/src/frontend/components/global/footer.njk +0 -27
- package/src/frontend/components/global/header.njk +0 -11
- package/src/frontend/components/welcome.njk +0 -251
- package/src/frontend/data/site.json +0 -44
- package/src/frontend/index.njk +0 -9
- package/src/frontend/js/modules/exampleModule.js +0 -3
- package/src/frontend/js/pages/404.js +0 -7
- package/src/frontend/js/pages/homepage.js +0 -7
- package/src/frontend/layouts/base.njk +0 -137
- package/src/frontend/layouts/pageComponents.njk +0 -14
- package/src/frontend/llms.njk +0 -18
- package/src/frontend/robots.njk +0 -8
- package/src/frontend/scss/modules/_animations.scss +0 -25
- package/src/frontend/scss/modules/_buttons.scss +0 -24
- package/src/frontend/scss/modules/_footer.scss +0 -32
- package/src/frontend/scss/modules/_global.scss +0 -46
- package/src/frontend/scss/modules/_header.scss +0 -33
- package/src/frontend/scss/modules/_mobile.scss +0 -30
- package/src/frontend/scss/modules/_notification.scss +0 -56
- package/src/frontend/scss/modules/_root.scss +0 -35
- package/src/frontend/scss/modules/_typography.scss +0 -15
- package/src/frontend/scss/modules/frameworks/_bootstrap.scss +0 -110
- package/src/frontend/scss/modules/frameworks/_bulma.scss +0 -109
- package/src/frontend/scss/modules/frameworks/_foundation.scss +0 -139
- package/src/frontend/scss/modules/frameworks/_uikit.scss +0 -110
- package/src/frontend/scss/pages/404.scss +0 -28
- package/src/frontend/scss/pages/homepage.scss +0 -23
- package/src/frontend/sitemap.njk +0 -17
- package/src/frontend/ts/modules/exampleModule.ts +0 -3
- package/src/frontend/ts/pages/404.ts +0 -7
- package/src/frontend/ts/pages/homepage.ts +0 -7
- package/src/frontend/web.config +0 -27
- package/tsconfig.json +0 -25
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-berna-stencil",
|
|
3
|
-
"version": "2.6.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"build:css": "sass src/frontend/scss:out/css --no-source-map --style=compressed --quiet --load-path=node_modules",
|
|
7
|
-
"build:js": "node _tools/buildJs.js",
|
|
8
|
-
"build:11ty": "eleventy",
|
|
9
|
-
"build": "npm run clean && npm run build:css && npm run build:js && npm run build:11ty",
|
|
10
|
-
"serve:css": "sass --watch src/frontend/scss:out/css --no-source-map --quiet --load-path=node_modules",
|
|
11
|
-
"serve:js": "node _tools/buildJs.js --watch",
|
|
12
|
-
"serve:11ty": "eleventy --serve --quiet",
|
|
13
|
-
"clean": "node _tools/cleanOutput.js",
|
|
14
|
-
"serve": "npm run clean && concurrently \"npm run serve:11ty\" \"npm run serve:css\" \"npm run serve:js\"",
|
|
15
|
-
"assistant": "node _tools/assistant.js"
|
|
3
|
+
"version": "2.6.4",
|
|
4
|
+
"bin": {
|
|
5
|
+
"create-berna-stencil": "index.js"
|
|
16
6
|
},
|
|
17
7
|
"dependencies": {
|
|
18
|
-
"
|
|
19
|
-
"@11ty/eleventy-img": "^6.0.4",
|
|
20
|
-
"bootstrap": "^5.3.8",
|
|
21
|
-
"bootstrap-icons": "^1.13.1",
|
|
22
|
-
"bulma": "^1.0.4",
|
|
23
|
-
"foundation-sites": "^6.9.0",
|
|
24
|
-
"github-markdown-css": "^5.9.0",
|
|
25
|
-
"glob": "^13.0.6",
|
|
26
|
-
"uikit": "^3.25.13"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"concurrently": "^9.2.1",
|
|
30
|
-
"esbuild": "^0.27.3",
|
|
31
|
-
"sass": "^1.77.0"
|
|
8
|
+
"berna-stencil": "^2.6.3"
|
|
32
9
|
}
|
|
33
10
|
}
|
package/.eleventy.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
const esbuild = require("esbuild");
|
|
2
|
-
const glob = require("glob");
|
|
3
|
-
const Image = require("@11ty/eleventy-img");
|
|
4
|
-
const markdownIt = require('markdown-it');
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
|
|
8
|
-
const OUTPUT_DIR = "out";
|
|
9
|
-
|
|
10
|
-
module.exports = function (eleventyConfig) {
|
|
11
|
-
|
|
12
|
-
function copyRecursiveSync(src, dest) {
|
|
13
|
-
if (!fs.existsSync(src)) return;
|
|
14
|
-
if (src.includes('.git')) return;
|
|
15
|
-
const stat = fs.statSync(src);
|
|
16
|
-
if (stat.isDirectory()) {
|
|
17
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
18
|
-
for (const child of fs.readdirSync(src)) {
|
|
19
|
-
copyRecursiveSync(path.join(src, child), path.join(dest, child));
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
23
|
-
fs.copyFileSync(src, dest);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const md = markdownIt({ html: true });
|
|
28
|
-
|
|
29
|
-
eleventyConfig.addShortcode('mdFile', function(filePath) {
|
|
30
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
31
|
-
return md.render(content);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
eleventyConfig.addPassthroughCopy({
|
|
35
|
-
"node_modules/github-markdown-css/github-markdown-dark.css": "css/github-markdown-dark.css",
|
|
36
|
-
"node_modules/github-markdown-css/github-markdown-light.css": "css/github-markdown-light.css",
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
eleventyConfig.on("eleventy.before", () => {
|
|
40
|
-
copyRecursiveSync("src/backend", `${OUTPUT_DIR}/backend`);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
eleventyConfig.addPassthroughCopy("src/frontend/.htaccess");
|
|
44
|
-
eleventyConfig.addPassthroughCopy("src/frontend/web.config");
|
|
45
|
-
eleventyConfig.addPassthroughCopy("src/frontend/assets");
|
|
46
|
-
eleventyConfig.addPassthroughCopy("src/frontend/data");
|
|
47
|
-
eleventyConfig.addPassthroughCopy("src/frontend/robots.txt");
|
|
48
|
-
|
|
49
|
-
eleventyConfig.addPassthroughCopy({
|
|
50
|
-
"node_modules/bootstrap/dist/js/bootstrap.bundle.min.js": "js/bootstrap.bundle.min.js",
|
|
51
|
-
"node_modules/bootstrap-icons/font/fonts": "css/fonts",
|
|
52
|
-
|
|
53
|
-
// Foundation
|
|
54
|
-
// "node_modules/foundation-sites/dist/js/foundation.min.js": "js/foundation.min.js",
|
|
55
|
-
|
|
56
|
-
// UIkit
|
|
57
|
-
// "node_modules/uikit/dist/js/uikit.min.js": "js/uikit.min.js",
|
|
58
|
-
// "node_modules/uikit/dist/js/uikit-icons.min.js": "js/uikit-icons.min.js",
|
|
59
|
-
|
|
60
|
-
// Bulma — CSS only, no JS passthrough needed
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
eleventyConfig.addShortcode("image", async function (src, alt) {
|
|
64
|
-
let metadata = await Image(src, {
|
|
65
|
-
widths: [320, 480, 720, 1280, 1920, 2048, 2560, 3840, 4096, 7680],
|
|
66
|
-
formats: ["webp", "jpeg"],
|
|
67
|
-
outputDir: `${OUTPUT_DIR}/assets/images/`,
|
|
68
|
-
urlPath: "/assets/images/",
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return Image.generateHTML(metadata, {
|
|
72
|
-
alt,
|
|
73
|
-
sizes: "(max-width: 768px) 100vw, 50vw",
|
|
74
|
-
loading: "lazy",
|
|
75
|
-
decoding: "async",
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
eleventyConfig.addWatchTarget("./src/frontend/scss");
|
|
80
|
-
|
|
81
|
-
eleventyConfig.setServerOptions({
|
|
82
|
-
watch: [`${OUTPUT_DIR}/js/**/*.js`]
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
dir: {
|
|
87
|
-
input: "src/frontend",
|
|
88
|
-
output: OUTPUT_DIR,
|
|
89
|
-
includes: "components",
|
|
90
|
-
layouts: "layouts",
|
|
91
|
-
data: "data",
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
};
|
package/.eleventyignore
DELETED
package/LICENSE
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other
|
|
43
|
-
modifications represent, as a whole, an original work of authorship.
|
|
44
|
-
For the purposes of this License, Derivative Works shall not include
|
|
45
|
-
works that remain separable from, or merely link (or bind by name)
|
|
46
|
-
to the interfaces of, the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
49
|
-
in the Work by the copyright owner or by an individual or Legal Entity
|
|
50
|
-
authorized to submit on behalf of the copyright owner. For the
|
|
51
|
-
purposes of this definition, "submitted" means any form of electronic,
|
|
52
|
-
verbal, or written communication sent to the Licensor or its
|
|
53
|
-
representatives, including but not limited to communication on
|
|
54
|
-
electronic mailing lists, source code control systems, and issue
|
|
55
|
-
tracking systems that are managed by, or on behalf of, the Licensor
|
|
56
|
-
for the purpose of discussing and improving the Work, but excluding
|
|
57
|
-
communication that is conspicuously marked or otherwise designated
|
|
58
|
-
in writing by the copyright owner as "Not a Contribution."
|
|
59
|
-
|
|
60
|
-
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
61
|
-
whom a Contribution has been received by the Licensor and incorporated
|
|
62
|
-
within the Work.
|
|
63
|
-
|
|
64
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
65
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
66
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
67
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
68
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
69
|
-
Work and such Derivative Works in Source or Object form.
|
|
70
|
-
|
|
71
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
72
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
-
(except as stated in this section) patent license to make, have made,
|
|
75
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
76
|
-
where such license applies only to those patent claims licensable
|
|
77
|
-
by such Contributor that are necessarily infringed by their
|
|
78
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
79
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
80
|
-
institute patent litigation against any entity (including a
|
|
81
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
82
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
83
|
-
or contributory patent infringement, then any patent licenses
|
|
84
|
-
granted to You under this License for that Work shall terminate
|
|
85
|
-
as of the date such litigation is filed.
|
|
86
|
-
|
|
87
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
88
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
89
|
-
modifications, and in Source or Object form, provided that You
|
|
90
|
-
meet the following conditions:
|
|
91
|
-
|
|
92
|
-
(a) You must give any other recipients of the Work or Derivative
|
|
93
|
-
Works a copy of this License; and
|
|
94
|
-
|
|
95
|
-
(b) You must cause any modified files to carry prominent notices
|
|
96
|
-
stating that You changed the files; and
|
|
97
|
-
|
|
98
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
99
|
-
that You distribute, all copyright, patent, trademark, and
|
|
100
|
-
attribution notices from the Source form of the Work,
|
|
101
|
-
excluding those notices that do not pertain to any part of
|
|
102
|
-
the Derivative Works; and
|
|
103
|
-
|
|
104
|
-
(d) If the Work includes a NOTICE text file, You must include a
|
|
105
|
-
readable copy of the attribution notices contained within such
|
|
106
|
-
NOTICE file, in at least one of the following places: within
|
|
107
|
-
a NOTICE text file distributed as part of the Derivative Works;
|
|
108
|
-
within the Source form or documentation, if provided along with
|
|
109
|
-
the Derivative Works; or, within a display generated by the
|
|
110
|
-
Derivative Works, if and wherever such third-party notices
|
|
111
|
-
normally appear. The contents of the NOTICE file are for
|
|
112
|
-
informational purposes only and do not modify the License.
|
|
113
|
-
|
|
114
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
115
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
116
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
117
|
-
this License, without any additional terms or conditions.
|
|
118
|
-
|
|
119
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
120
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
121
|
-
except as required for reasonable and customary use in describing the
|
|
122
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
123
|
-
|
|
124
|
-
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
125
|
-
to in writing, Licensor provides the Work (and each Contributor
|
|
126
|
-
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
127
|
-
OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
128
|
-
without limitation, any warranties or conditions of TITLE,
|
|
129
|
-
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
|
|
130
|
-
PURPOSE. You are solely responsible for determining the
|
|
131
|
-
appropriateness of using or reproducing the Work and assume any
|
|
132
|
-
risks associated with Your exercise of permissions under this License.
|
|
133
|
-
|
|
134
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
135
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
136
|
-
unless required by applicable law (such as deliberate and grossly
|
|
137
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
138
|
-
liable to You for damages, including any direct, indirect, special,
|
|
139
|
-
incidental, or exemplary damages of any character arising as a
|
|
140
|
-
result of this License or out of the use or inability to use the
|
|
141
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
142
|
-
work stoppage, computer failure or malfunction, or all other
|
|
143
|
-
commercial damages or losses), even if such Contributor has been
|
|
144
|
-
advised of the possibility of such damages.
|
|
145
|
-
|
|
146
|
-
9. Accepting Warranty or Liability While Redistributing. You may choose
|
|
147
|
-
to offer, and charge a fee for, acceptance of support, warranty,
|
|
148
|
-
indemnity, or other liability obligations and/or rights consistent
|
|
149
|
-
with this License. However, in accepting such obligations, You may
|
|
150
|
-
act only on Your own behalf and on Your sole responsibility, not on
|
|
151
|
-
behalf of any other Contributor, and only if You agree to indemnify,
|
|
152
|
-
defend, and hold each Contributor harmless for any liability incurred
|
|
153
|
-
by, or claims asserted against, such Contributor by reason of your
|
|
154
|
-
accepting any such warranty or additional liability.
|
|
155
|
-
|
|
156
|
-
END OF TERMS AND CONDITIONS
|
|
157
|
-
|
|
158
|
-
Copyright 2026 Michele Garofalo
|
|
159
|
-
|
|
160
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
161
|
-
you may not use this file except in compliance with the License.
|
|
162
|
-
You may obtain a copy of the License at
|
|
163
|
-
|
|
164
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
165
|
-
|
|
166
|
-
Unless required by applicable law or agreed to in writing, software
|
|
167
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
168
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
169
|
-
implied. See the License for the specific language governing
|
|
170
|
-
permissions and limitations under the License.
|
package/NOTICE
DELETED
package/README.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# ✏️ Berna-Stencil
|
|
2
|
-
**Berna-Stencil** is an open source static site generator built on top of [Eleventy](https://www.11ty.dev/), designed with one clear mission: make web development simple, approachable, and enjoyable — for everyone.
|
|
3
|
-
|
|
4
|
-
Berna-Stencil stays deliberately close to plain, vanilla web development — you work with real HTML, CSS, and JavaScript, not a heavy abstraction layer to learn first. That means a gentle, fast learning curve: the skills you build here are the same ones you'd use anywhere on the web.
|
|
5
|
-
|
|
6
|
-
Whether you're a seasoned developer looking for a clean starting point or a beginner taking your first steps into the world of web creation, Berna-Stencil gives you everything you need, right out of the box. No complicated setup, no hours spent reading documentation, no frustration — just a solid, well-structured foundation ready to become your next website.
|
|
7
|
-
|
|
8
|
-
### ✨ Why Berna-Stencil?
|
|
9
|
-
|
|
10
|
-
Building a website from scratch involves a lot of moving parts: templating engines, build pipelines, asset management, backend logic, project structure. Berna-Stencil takes care of all of that for you, so you can focus on what actually matters — **your content and your ideas**.
|
|
11
|
-
|
|
12
|
-
Because it keeps you close to the fundamentals instead of hiding them, you spend your time actually learning the web — not memorizing a framework's conventions that stop being useful the moment you switch tool.
|
|
13
|
-
|
|
14
|
-
- 🔧 **Zero-config ready** — clone, install, and you're live in minutes
|
|
15
|
-
- 🔗 **Integrated backend** — essential server-side functionality included, no extra setup required
|
|
16
|
-
- 📁 **Scalable structure** — a clean, opinionated project layout that grows with your needs
|
|
17
|
-
- 🌍 **Open source** — free to use, free to modify, free to share
|
|
18
|
-
|
|
19
|
-

|
|
20
|
-

|
|
21
|
-

|
|
22
|
-
|
|
23
|
-
## Prerequisites
|
|
24
|
-
* **Node.js**: v18.0.0 or higher
|
|
25
|
-
* **Composer**: latest stable version
|
|
26
|
-
* #### Optional: Better Nunjucks VS Code extension by Ed Heltzel
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
* Open your IDE (e.g. Visual Studio Code), open the folder that contains your websites and open a new terminal
|
|
30
|
-
* Run the command for your system to download the project and install everything:
|
|
31
|
-
```bash
|
|
32
|
-
npm create berna-stencil@latest your-project
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
* Navigate into the project folder
|
|
36
|
-
```bash
|
|
37
|
-
cd your-project
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
* Install all the node_modules
|
|
41
|
-
```bash
|
|
42
|
-
npm install
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
* Run the command to launch the live server and build the site, then visit localhost:8080:
|
|
46
|
-
```bash
|
|
47
|
-
npm run serve
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Roadmap
|
|
51
|
-
* [ ] Add support for multiple themes
|
|
52
|
-
* [ ] Extend documentation with advanced usage examples
|
|
53
|
-
* [ ] Assistant CLI improvement for safer inputs
|
package/_tools/assistant.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
const readline = require('readline');
|
|
2
|
-
|
|
3
|
-
const { addPage, removePage, renamePage, pageExists } = require('./modules/updatePage');
|
|
4
|
-
const { updateOutputPath, getCurrentOutputPath } = require('./modules/updateOutputPath');
|
|
5
|
-
const { validatePageName, validateOutputPath } = require('./modules/validation');
|
|
6
|
-
const { toKebabCase } = require('./modules/utils');
|
|
7
|
-
|
|
8
|
-
const color = {
|
|
9
|
-
reset: '\x1b[0m',
|
|
10
|
-
bold: '\x1b[1m',
|
|
11
|
-
dim: '\x1b[2m',
|
|
12
|
-
red: '\x1b[31m',
|
|
13
|
-
green: '\x1b[32m',
|
|
14
|
-
yellow: '\x1b[33m',
|
|
15
|
-
magenta: '\x1b[35m',
|
|
16
|
-
cyan: '\x1b[36m',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const rl = readline.createInterface({
|
|
20
|
-
input: process.stdin,
|
|
21
|
-
output: process.stdout,
|
|
22
|
-
terminal: true,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
function sanitizeInput(value) {
|
|
26
|
-
return (value ?? '').replace(/[\x00-\x1F\x7F]/g, '').trim();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function ask(prompt) {
|
|
30
|
-
return new Promise((resolve) => {
|
|
31
|
-
const onClose = () => resolve(null);
|
|
32
|
-
rl.once('close', onClose);
|
|
33
|
-
rl.question(prompt, (answer) => {
|
|
34
|
-
rl.off('close', onClose);
|
|
35
|
-
resolve(sanitizeInput(answer));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function confirm(prompt) {
|
|
41
|
-
const answer = await ask(`${prompt} ${color.dim}[y/N]${color.reset} `);
|
|
42
|
-
return /^y(es)?$/i.test((answer ?? '').trim());
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function askPageName(prompt) {
|
|
46
|
-
const raw = await ask(prompt);
|
|
47
|
-
if (raw === null) return null;
|
|
48
|
-
|
|
49
|
-
const name = toKebabCase(raw);
|
|
50
|
-
const error = validatePageName(name);
|
|
51
|
-
if (error) {
|
|
52
|
-
console.log(`\n${color.red}✖ ${error}${color.reset}`);
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return name;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function handleCreate() {
|
|
59
|
-
const name = await askPageName(`\n${color.green}❯${color.reset} Name of the new page: `);
|
|
60
|
-
if (name) addPage(name);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function handleRemove() {
|
|
64
|
-
const name = await askPageName(`\n${color.red}❯${color.reset} Name of the page to remove: `);
|
|
65
|
-
if (!name) return;
|
|
66
|
-
|
|
67
|
-
if (!pageExists(name)) {
|
|
68
|
-
console.log(`\n${color.yellow}⚠ Page "${name}" does not exist.${color.reset}`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const confirmed = await confirm(`This permanently deletes all files for "${name}".`);
|
|
73
|
-
if (!confirmed) {
|
|
74
|
-
console.log(`\n${color.dim}Cancelled.${color.reset}`);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
removePage(name);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async function handleRename() {
|
|
81
|
-
const oldName = await askPageName(`\n${color.yellow}❯${color.reset} Page to rename: `);
|
|
82
|
-
if (!oldName) return;
|
|
83
|
-
|
|
84
|
-
const newName = await askPageName(`${color.yellow}❯${color.reset} New name: `);
|
|
85
|
-
if (!newName) return;
|
|
86
|
-
|
|
87
|
-
if (oldName === newName) {
|
|
88
|
-
console.log(`\n${color.yellow}⚠ Old and new name are the same.${color.reset}`);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
renamePage(oldName, newName);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function handleOutputPath() {
|
|
95
|
-
const current = getCurrentOutputPath();
|
|
96
|
-
const label = current ? `\n${color.dim}Current path: "${current}"${color.reset}\n` : '\n';
|
|
97
|
-
|
|
98
|
-
const input = await ask(`${label}${color.magenta}❯${color.reset} New output path: `);
|
|
99
|
-
if (input === null) return;
|
|
100
|
-
|
|
101
|
-
const error = validateOutputPath(input);
|
|
102
|
-
if (error) {
|
|
103
|
-
console.log(`\n${color.red}✖ ${error}${color.reset}`);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
updateOutputPath(input);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const MENU_ACTIONS = {
|
|
110
|
-
'1': handleCreate,
|
|
111
|
-
'2': handleRemove,
|
|
112
|
-
'3': handleRename,
|
|
113
|
-
'4': handleOutputPath,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
function renderMenu() {
|
|
117
|
-
console.log(`\n${color.cyan}${color.bold}╭────────────────────────╮`);
|
|
118
|
-
console.log(`│ Berna-Stencil CLI │`);
|
|
119
|
-
console.log(`╰────────────────────────╯${color.reset}\n`);
|
|
120
|
-
console.log(` ${color.green}1.${color.reset} Create page`);
|
|
121
|
-
console.log(` ${color.red}2.${color.reset} Remove page`);
|
|
122
|
-
console.log(` ${color.yellow}3.${color.reset} Rename page`);
|
|
123
|
-
console.log(` ${color.magenta}4.${color.reset} Configure output path`);
|
|
124
|
-
console.log(` ${color.dim}CTRL + C to exit\n`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async function main() {
|
|
128
|
-
while (true) {
|
|
129
|
-
renderMenu();
|
|
130
|
-
|
|
131
|
-
const choice = await ask(`${color.cyan}❯${color.reset} Choose an option: `);
|
|
132
|
-
|
|
133
|
-
const action = MENU_ACTIONS[choice];
|
|
134
|
-
if (!action) {
|
|
135
|
-
console.log(`\n${color.red}✖ Invalid option.${color.reset}`);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
await action();
|
|
141
|
-
} catch (err) {
|
|
142
|
-
console.log(`\n${color.red}✖ Unexpected error: ${err.message}${color.reset}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
rl.close();
|
|
147
|
-
process.exit(0);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
main();
|
package/_tools/buildJs.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const esbuild = require("esbuild");
|
|
2
|
-
const glob = require("glob");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const pkg = require("../package.json");
|
|
5
|
-
|
|
6
|
-
const isWatch = process.argv.includes("--watch");
|
|
7
|
-
const outputDir = pkg.outputDir || "out";
|
|
8
|
-
|
|
9
|
-
const jsFiles = glob.sync("src/frontend/js/pages/*.js");
|
|
10
|
-
const tsFiles = glob.sync("src/frontend/ts/pages/*.ts");
|
|
11
|
-
const entryPoints = [...jsFiles, ...tsFiles];
|
|
12
|
-
|
|
13
|
-
if (entryPoints.length === 0) {
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const options = {
|
|
18
|
-
entryPoints,
|
|
19
|
-
bundle: true,
|
|
20
|
-
outdir: path.join(outputDir, "js/pages"),
|
|
21
|
-
minify: !isWatch,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (isWatch) {
|
|
25
|
-
esbuild.context(options).then(ctx => ctx.watch()).catch(() => process.exit(1));
|
|
26
|
-
} else {
|
|
27
|
-
esbuild.build(options).catch(() => process.exit(1));
|
|
28
|
-
}
|
package/_tools/cleanOutput.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const PACKAGE_JSON = path.resolve(__dirname, '../package.json');
|
|
5
|
-
|
|
6
|
-
const pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON, 'utf-8'));
|
|
7
|
-
|
|
8
|
-
if (!pkg.outputDir) {
|
|
9
|
-
console.log('(!) outputDir not found in package.json');
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const outputDir = path.resolve(__dirname, '..', pkg.outputDir);
|
|
14
|
-
|
|
15
|
-
if (fs.existsSync(outputDir)) {
|
|
16
|
-
fs.rmSync(outputDir, { recursive: true, force: true });
|
|
17
|
-
console.log(`(✓) cleaned → ${outputDir}`);
|
|
18
|
-
} else {
|
|
19
|
-
console.log(`(i) nothing to clean → ${outputDir}`);
|
|
20
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const ROOT = path.resolve(__dirname, '..', '..');
|
|
4
|
-
const FRONTEND_DIR = path.join(ROOT, 'src', 'frontend');
|
|
5
|
-
|
|
6
|
-
const MAX_PAGE_NAME_LENGTH = 50;
|
|
7
|
-
const PROTECTED_PAGES = Object.freeze(['homepage', '404']);
|
|
8
|
-
|
|
9
|
-
const PATHS = Object.freeze({
|
|
10
|
-
root: ROOT,
|
|
11
|
-
routes: path.join(FRONTEND_DIR, '_routes'),
|
|
12
|
-
scssPages: path.join(FRONTEND_DIR, 'scss', 'pages'),
|
|
13
|
-
jsPages: path.join(FRONTEND_DIR, 'js', 'pages'),
|
|
14
|
-
tsPages: path.join(FRONTEND_DIR, 'ts', 'pages'),
|
|
15
|
-
siteData: path.join(FRONTEND_DIR, 'data', 'site.json'),
|
|
16
|
-
pageComponents: path.join(FRONTEND_DIR, 'layouts', 'pageComponents.njk'),
|
|
17
|
-
templates: path.join(ROOT, '_tools', 'res', 'templates'),
|
|
18
|
-
eleventyConfig: path.join(ROOT, '.eleventy.js'),
|
|
19
|
-
packageJson: path.join(ROOT, 'package.json'),
|
|
20
|
-
tsconfig: path.join(ROOT, 'tsconfig.json'),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
module.exports = { PATHS, MAX_PAGE_NAME_LENGTH, PROTECTED_PAGES };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const { PATHS } = require('./constants');
|
|
3
|
-
const { toCamelCase } = require('./utils');
|
|
4
|
-
|
|
5
|
-
function readPageComponents() {
|
|
6
|
-
if (!fs.existsSync(PATHS.pageComponents)) {
|
|
7
|
-
console.log(`[skip] not found: ${PATHS.pageComponents}`);
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return fs.readFileSync(PATHS.pageComponents, 'utf8');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function writePageComponents(content) {
|
|
14
|
-
fs.writeFileSync(PATHS.pageComponents, content);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function elifBlockRegex(camelName) {
|
|
18
|
-
return new RegExp(
|
|
19
|
-
`[ \\t]*\\{%\\s*elif\\s+title\\s*==\\s*"${camelName}"\\s*%\\}[\\s\\S]*?(?=[ \\t]*\\{%\\s*(?:elif|else|endif))`,
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function addPageBlock(pageName) {
|
|
24
|
-
const content = readPageComponents();
|
|
25
|
-
if (!content) return;
|
|
26
|
-
|
|
27
|
-
const camelName = toCamelCase(pageName);
|
|
28
|
-
if (content.includes(`{% elif title == "${camelName}" %}`)) return;
|
|
29
|
-
|
|
30
|
-
if (!content.includes('{% else %}')) {
|
|
31
|
-
console.log('[skip] no {% else %} anchor in pageComponents.njk');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const block =
|
|
36
|
-
`{% elif title == "${camelName}" %}\n` +
|
|
37
|
-
` {#{% include "component.njk" %}#}\n\n`;
|
|
38
|
-
|
|
39
|
-
writePageComponents(content.replace('{% else %}', `${block}{% else %}`));
|
|
40
|
-
console.log(`[updated] page block added for "${camelName}"`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function removePageBlock(pageName) {
|
|
44
|
-
const content = readPageComponents();
|
|
45
|
-
if (!content) return;
|
|
46
|
-
|
|
47
|
-
const camelName = toCamelCase(pageName);
|
|
48
|
-
if (!elifBlockRegex(camelName).test(content)) {
|
|
49
|
-
console.log(`[skip] page block for "${camelName}" not found`);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const updated = content
|
|
54
|
-
.replace(elifBlockRegex(camelName), '')
|
|
55
|
-
.replace(/\n\s*\n\s*\n/g, '\n\n');
|
|
56
|
-
|
|
57
|
-
writePageComponents(updated);
|
|
58
|
-
console.log(`[cleaned] page block removed for "${camelName}"`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function renamePageBlock(oldName, newName) {
|
|
62
|
-
const content = readPageComponents();
|
|
63
|
-
if (!content) return;
|
|
64
|
-
|
|
65
|
-
const oldLine = `{% elif title == "${toCamelCase(oldName)}" %}`;
|
|
66
|
-
const newLine = `{% elif title == "${toCamelCase(newName)}" %}`;
|
|
67
|
-
|
|
68
|
-
if (!content.includes(oldLine)) {
|
|
69
|
-
console.log(`[skip] page block for "${toCamelCase(oldName)}" not found`);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
writePageComponents(content.replace(oldLine, newLine));
|
|
74
|
-
console.log(`[renamed] page block "${toCamelCase(oldName)}" → "${toCamelCase(newName)}"`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = { addPageBlock, removePageBlock, renamePageBlock };
|