create-berna-stencil 1.0.5 → 1.0.7
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/assistant.js +13 -18
- package/bin/create.js +2 -1
- package/package.json +1 -1
- package/src/data/site.json +53 -53
package/_tools/assistant.js
CHANGED
|
@@ -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
|
@@ -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.7',
|
|
21
21
|
private: true,
|
|
22
22
|
scripts: {
|
|
23
23
|
'build:css': 'sass src/scss:out/css --no-source-map --style=compressed --quiet',
|
|
@@ -94,3 +94,4 @@ if (process.argv[2]) {
|
|
|
94
94
|
}
|
|
95
95
|
log('npm install');
|
|
96
96
|
log('npm run serve\n');
|
|
97
|
+
log("\nDon't forget to check the documentation at https://bernastencil.com");
|
package/package.json
CHANGED
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
|
}
|