create-berna-stencil 1.0.29 → 1.0.30
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/bin/create.js +18 -5
- package/package.json +1 -1
- package/src/scss/modules/_global.scss +0 -2
- package/src/scss/modules/_buttons.scss +0 -19
package/bin/create.js
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { writeSync } = require('fs');
|
|
5
6
|
|
|
6
7
|
const targetDir = process.argv[2] ? path.resolve(process.argv[2]) : process.cwd();
|
|
7
8
|
const templateDir = path.join(__dirname, '..');
|
|
8
9
|
|
|
10
|
+
// I file e le cartelle da copiare. Notare 'gitignore' senza il punto.
|
|
9
11
|
const COPY_TARGETS = [
|
|
10
12
|
'src',
|
|
11
13
|
'_tools',
|
|
12
14
|
'.eleventy.js',
|
|
13
15
|
'.eleventyignore',
|
|
14
|
-
'
|
|
16
|
+
'gitignore',
|
|
15
17
|
'README.md',
|
|
16
18
|
];
|
|
17
19
|
|
|
18
20
|
const PROJECT_PACKAGE = {
|
|
19
21
|
name: path.basename(targetDir),
|
|
20
|
-
version: '1.0.
|
|
22
|
+
version: '1.0.30',
|
|
21
23
|
private: true,
|
|
22
24
|
scripts: {
|
|
23
25
|
"build:css": "sass src/scss:c:/laragon/www/Berna-Stencil-out/css --no-source-map --style=compressed --quiet",
|
|
@@ -49,8 +51,6 @@ const PROJECT_PACKAGE = {
|
|
|
49
51
|
},
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
const { writeSync } = require('fs');
|
|
53
|
-
|
|
54
54
|
function log(msg) {
|
|
55
55
|
writeSync(1, msg + '\n');
|
|
56
56
|
}
|
|
@@ -68,12 +68,14 @@ function copyRecursive(src, dest) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
// 1. Crea la cartella di destinazione se non esiste
|
|
71
72
|
if (!fs.existsSync(targetDir)) {
|
|
72
73
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
log(`\n>> Creating berna-stencil project in ${targetDir}\n`);
|
|
76
77
|
|
|
78
|
+
// 2. Copia tutti i file e le cartelle specificati in COPY_TARGETS
|
|
77
79
|
for (const target of COPY_TARGETS) {
|
|
78
80
|
const src = path.join(templateDir, target);
|
|
79
81
|
const dest = path.join(targetDir, target);
|
|
@@ -83,16 +85,27 @@ for (const target of COPY_TARGETS) {
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
88
|
+
// 3. Rinomina gitignore in .gitignore nella cartella di destinazione
|
|
89
|
+
const gitignoreSrc = path.join(targetDir, 'gitignore');
|
|
90
|
+
const gitignoreDest = path.join(targetDir, '.gitignore');
|
|
91
|
+
|
|
92
|
+
if (fs.existsSync(gitignoreSrc)) {
|
|
93
|
+
fs.renameSync(gitignoreSrc, gitignoreDest);
|
|
94
|
+
log('~ Rinominato gitignore in .gitignore');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 4. Genera e scrivi il file package.json
|
|
86
98
|
fs.writeFileSync(
|
|
87
99
|
path.join(targetDir, 'package.json'),
|
|
88
100
|
JSON.stringify(PROJECT_PACKAGE, null, 2)
|
|
89
101
|
);
|
|
90
102
|
log('+ package.json');
|
|
91
103
|
|
|
104
|
+
// 5. Mostra i messaggi finali all'utente
|
|
92
105
|
log(`\n>> Done! Now run:\n`);
|
|
93
106
|
if (process.argv[2]) {
|
|
94
107
|
log(`cd ${process.argv[2]}`);
|
|
95
108
|
}
|
|
96
109
|
log('npm install');
|
|
97
110
|
log('npm run serve\n');
|
|
98
|
-
log("
|
|
111
|
+
log("Don't forget to check the documentation at https://bernastencil.com\n");
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.btn {
|
|
2
|
-
background: none;
|
|
3
|
-
border: 0.5px solid #333;
|
|
4
|
-
border-radius: 8px;
|
|
5
|
-
padding: 8px 18px;
|
|
6
|
-
color: #aaa;
|
|
7
|
-
font-size: 13px;
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
transition: color 0.15s, border-color 0.15s;
|
|
10
|
-
|
|
11
|
-
&:hover {
|
|
12
|
-
color: #eee;
|
|
13
|
-
border-color: #666;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&:active {
|
|
17
|
-
transform: scale(0.97);
|
|
18
|
-
}
|
|
19
|
-
}
|