create-berna-stencil 1.0.1 → 1.0.6
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/{tools → _tools}/assistant.js +13 -18
- package/bin/create.js +4 -4
- package/package.json +4 -4
- package/src/data/site.json +53 -53
- /package/{tools → _tools}/cleanOutput.js +0 -0
- /package/{tools → _tools}/modules/updateData.js +0 -0
- /package/{tools → _tools}/modules/updateIncludes.js +0 -0
- /package/{tools → _tools}/modules/updateOutputPath.js +0 -0
- /package/{tools → _tools}/modules/updatePage.js +0 -0
- /package/{tools → _tools}/res/templates.json +0 -0
|
@@ -17,31 +17,26 @@ function toKebabCase(str) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function handleCreateRequest() {
|
|
20
|
-
readerInterface.question('\n>
|
|
20
|
+
readerInterface.question('\n> Enter the name of the new page: ', (inputName) => {
|
|
21
21
|
const kebabName = toKebabCase(inputName);
|
|
22
22
|
if (!kebabName) {
|
|
23
|
-
console.log('(!)
|
|
23
|
+
console.log('(!) Invalid name.');
|
|
24
24
|
} else if (/^\d/.test(kebabName)) {
|
|
25
|
-
console.log('(!)
|
|
25
|
+
console.log('(!) Invalid name. Page name cannot start with a number.');
|
|
26
26
|
} else if (PROTECTED_PAGES.includes(kebabName)) {
|
|
27
27
|
console.log(`(!) "${kebabName}" is a protected page and cannot be created.`);
|
|
28
28
|
} else {
|
|
29
|
-
|
|
30
|
-
const parentPath = inputParent.trim().toLowerCase().replace(/\\/g, '/').replace(/^\/|\/$/g, '');
|
|
31
|
-
addPage(kebabName, parentPath || null);
|
|
32
|
-
displayMainMenu();
|
|
33
|
-
});
|
|
34
|
-
return;
|
|
29
|
+
addPage(kebabName, null);
|
|
35
30
|
}
|
|
36
31
|
displayMainMenu();
|
|
37
32
|
});
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
function handleRenameRequest() {
|
|
41
|
-
readerInterface.question('\n>
|
|
36
|
+
readerInterface.question('\n> Enter the name of the page to rename: ', (inputOld) => {
|
|
42
37
|
const oldName = toKebabCase(inputOld);
|
|
43
38
|
if (!oldName) {
|
|
44
|
-
console.log('(!)
|
|
39
|
+
console.log('(!) Invalid name.');
|
|
45
40
|
return displayMainMenu();
|
|
46
41
|
}
|
|
47
42
|
if (PROTECTED_PAGES.includes(oldName)) {
|
|
@@ -53,11 +48,11 @@ function handleRenameRequest() {
|
|
|
53
48
|
if (!newName) {
|
|
54
49
|
console.log('(!) invalid name.');
|
|
55
50
|
} else if (/^\d/.test(newName)) {
|
|
56
|
-
console.log('(!)
|
|
51
|
+
console.log('(!) Invalid name. Page name cannot start with a number.');
|
|
57
52
|
} else if (PROTECTED_PAGES.includes(newName)) {
|
|
58
53
|
console.log(`(!) "${newName}" is a protected page name.`);
|
|
59
54
|
} else if (oldName === newName) {
|
|
60
|
-
console.log('(!)
|
|
55
|
+
console.log('(!) Old and new name are the same.');
|
|
61
56
|
} else {
|
|
62
57
|
renamePage(oldName, newName);
|
|
63
58
|
}
|
|
@@ -67,12 +62,12 @@ function handleRenameRequest() {
|
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
function handleRemoveRequest() {
|
|
70
|
-
readerInterface.question('\n>
|
|
65
|
+
readerInterface.question('\n> Enter the name of the page to remove: ', (inputName) => {
|
|
71
66
|
const kebabName = toKebabCase(inputName);
|
|
72
67
|
if (!kebabName) {
|
|
73
|
-
console.log('(!)
|
|
68
|
+
console.log('(!) Invalid name.');
|
|
74
69
|
} else if (PROTECTED_PAGES.includes(kebabName)) {
|
|
75
|
-
console.log(`(!) "${kebabName}"
|
|
70
|
+
console.log(`(!) "${kebabName}" Is a protected page and cannot be removed.`);
|
|
76
71
|
} else {
|
|
77
72
|
removePage(kebabName);
|
|
78
73
|
}
|
|
@@ -84,9 +79,9 @@ function handleOutputPathRequest() {
|
|
|
84
79
|
const current = getCurrentOutputPath();
|
|
85
80
|
const currentLabel = current ? ` (current: "${current}")` : '';
|
|
86
81
|
|
|
87
|
-
readerInterface.question(`\n>
|
|
82
|
+
readerInterface.question(`\n> Enter the new output path${currentLabel}\n (e.g. C:/laragon/www or . for root): `, (inputPath) => {
|
|
88
83
|
if (!inputPath.trim()) {
|
|
89
|
-
console.log('(!)
|
|
84
|
+
console.log('(!) Invalid path.');
|
|
90
85
|
} else {
|
|
91
86
|
updateOutputPath(inputPath);
|
|
92
87
|
}
|
package/bin/create.js
CHANGED
|
@@ -8,7 +8,7 @@ const templateDir = path.join(__dirname, '..');
|
|
|
8
8
|
|
|
9
9
|
const COPY_TARGETS = [
|
|
10
10
|
'src',
|
|
11
|
-
'
|
|
11
|
+
'_tools',
|
|
12
12
|
'.eleventy.js',
|
|
13
13
|
'.eleventyignore',
|
|
14
14
|
'.gitignore',
|
|
@@ -17,7 +17,7 @@ const COPY_TARGETS = [
|
|
|
17
17
|
|
|
18
18
|
const PROJECT_PACKAGE = {
|
|
19
19
|
name: path.basename(targetDir),
|
|
20
|
-
version: '1.0.
|
|
20
|
+
version: '1.0.6',
|
|
21
21
|
private: true,
|
|
22
22
|
scripts: {
|
|
23
23
|
'build:css': 'sass src/scss:out/css --no-source-map --style=compressed --quiet',
|
|
@@ -27,9 +27,9 @@ const PROJECT_PACKAGE = {
|
|
|
27
27
|
'serve:css': 'sass --watch src/scss:out/css --no-source-map --quiet',
|
|
28
28
|
'serve:js': 'esbuild "src/js/pages/*.js" --bundle --outdir=out/js/pages --watch',
|
|
29
29
|
'serve:11ty': 'eleventy --serve --quiet',
|
|
30
|
-
'clean': 'node
|
|
30
|
+
'clean': 'node _tools/cleanOutput.js',
|
|
31
31
|
'serve': 'npm run clean && concurrently "npm run serve:11ty" "npm run serve:css" "npm run serve:js"',
|
|
32
|
-
'assistant': 'node
|
|
32
|
+
'assistant': 'node _tools/assistant.js',
|
|
33
33
|
},
|
|
34
34
|
dependencies: {
|
|
35
35
|
'@11ty/eleventy': '^3.1.2',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-berna-stencil",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Eleventy boilerplate with per-page SCSS/JS pipeline, esbuild bundling, multi-framework CSS support and a built-in page management CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eleventy",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"bin/",
|
|
34
34
|
"src/",
|
|
35
|
-
"
|
|
35
|
+
"_tools/",
|
|
36
36
|
".eleventy.js",
|
|
37
37
|
".eleventyignore",
|
|
38
38
|
".gitignore",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"serve:css": "sass --watch src/scss:out/css --no-source-map --quiet",
|
|
65
65
|
"serve:js": "esbuild \"src/js/pages/*.js\" --bundle --outdir=out/js/pages --watch",
|
|
66
66
|
"serve:11ty": "eleventy --serve --quiet",
|
|
67
|
-
"clean": "node
|
|
67
|
+
"clean": "node _tools/cleanOutput.js",
|
|
68
68
|
"serve": "npm run clean && concurrently \"npm run serve:11ty\" \"npm run serve:css\" \"npm run serve:js\"",
|
|
69
|
-
"assistant": "node
|
|
69
|
+
"assistant": "node _tools/assistant.js"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/src/data/site.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"site_name": "Site name",
|
|
3
|
-
"title": "Site title",
|
|
4
|
-
"description": "Site description",
|
|
5
|
-
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
-
"domain": "yoursite.com",
|
|
7
|
-
"url": "https://yoursite.com",
|
|
8
|
-
"lang": "en",
|
|
9
|
-
"author": "Name and surname",
|
|
10
|
-
"data_bs_theme": "dark",
|
|
11
|
-
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
-
"logo": "/assets/brand/logo.svg",
|
|
13
|
-
"copyright": {
|
|
14
|
-
"year": "2026",
|
|
15
|
-
"text": "Copyright text"
|
|
16
|
-
},
|
|
17
|
-
"legal": {
|
|
18
|
-
"privacy": "",
|
|
19
|
-
"cookie": "",
|
|
20
|
-
"cookieControls": "",
|
|
21
|
-
"terms": ""
|
|
22
|
-
},
|
|
23
|
-
"pages": {
|
|
24
|
-
"404": {
|
|
25
|
-
"seo": {
|
|
26
|
-
"title": "404 - Not found"
|
|
27
|
-
},
|
|
28
|
-
"cdn": {
|
|
29
|
-
"css": [],
|
|
30
|
-
"js": []
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"homepage": {
|
|
34
|
-
"seo": {
|
|
35
|
-
"title": "Homepage",
|
|
36
|
-
"description": "Description"
|
|
37
|
-
},
|
|
38
|
-
"cdn": {
|
|
39
|
-
"css": [],
|
|
40
|
-
"js": []
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"anotherPage": {
|
|
44
|
-
"seo": {
|
|
45
|
-
"title": "Another Page",
|
|
46
|
-
"description": "description"
|
|
47
|
-
},
|
|
48
|
-
"cdn": {
|
|
49
|
-
"css": [],
|
|
50
|
-
"js": []
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"site_name": "Site name",
|
|
3
|
+
"title": "Site title",
|
|
4
|
+
"description": "Site description",
|
|
5
|
+
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
+
"domain": "yoursite.com",
|
|
7
|
+
"url": "https://yoursite.com",
|
|
8
|
+
"lang": "en",
|
|
9
|
+
"author": "Name and surname",
|
|
10
|
+
"data_bs_theme": "dark",
|
|
11
|
+
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
+
"logo": "/assets/brand/logo.svg",
|
|
13
|
+
"copyright": {
|
|
14
|
+
"year": "2026",
|
|
15
|
+
"text": "Copyright text"
|
|
16
|
+
},
|
|
17
|
+
"legal": {
|
|
18
|
+
"privacy": "",
|
|
19
|
+
"cookie": "",
|
|
20
|
+
"cookieControls": "",
|
|
21
|
+
"terms": ""
|
|
22
|
+
},
|
|
23
|
+
"pages": {
|
|
24
|
+
"404": {
|
|
25
|
+
"seo": {
|
|
26
|
+
"title": "404 - Not found"
|
|
27
|
+
},
|
|
28
|
+
"cdn": {
|
|
29
|
+
"css": [],
|
|
30
|
+
"js": []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"homepage": {
|
|
34
|
+
"seo": {
|
|
35
|
+
"title": "Homepage",
|
|
36
|
+
"description": "Description"
|
|
37
|
+
},
|
|
38
|
+
"cdn": {
|
|
39
|
+
"css": [],
|
|
40
|
+
"js": []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"anotherPage": {
|
|
44
|
+
"seo": {
|
|
45
|
+
"title": "Another Page",
|
|
46
|
+
"description": "description"
|
|
47
|
+
},
|
|
48
|
+
"cdn": {
|
|
49
|
+
"css": [],
|
|
50
|
+
"js": []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|