create-openclass-uniminuto 1.4.1 → 1.6.1
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-openclass-uniminuto.mjs +81 -1
- package/package.json +3 -3
- package/template/README.md +326 -329
- package/template/package-lock.json +11568 -11576
- package/template/package.json +63 -65
- package/template/public/imagenes/avion.png +0 -0
- package/template/public/imagenes/favicon.png +0 -0
- package/template/scripts/generar-desde-config.mjs +348 -632
- package/template/theme/uniminuto/components/AutoFitText.vue +7 -2
- package/template/theme/uniminuto/components/TitleRibbon.vue +222 -0
- package/template/theme/uniminuto/layouts/README.md +99 -0
- package/template/theme/uniminuto/layouts/slide-02-titulo.vue +29 -47
- package/template/theme/uniminuto/layouts/slide-03-imagen-izquierda.vue +43 -69
- package/template/theme/uniminuto/layouts/slide-04-imagen-derecha.vue +49 -75
- package/template/theme/uniminuto/layouts/slide-05-titulo-superior-texto-derecha.vue +34 -66
- package/template/theme/uniminuto/layouts/slide-06-titulo-superior-texto-izquierda.vue +28 -78
- package/template/theme/uniminuto/layouts/slide-07-multimedia-con-titulo.vue +10 -66
- package/template/theme/uniminuto/layouts/slide-08-titulo-texto.vue +24 -53
- package/template/theme/uniminuto/layouts/slide-09-objetivos.vue +26 -53
- package/template/theme/uniminuto/layouts/slide-10-titulo-dos-columnas.vue +27 -59
- package/template/theme/uniminuto/layouts/slide-11-dos-titulos-dos-columnas.vue +32 -65
- package/template/theme/uniminuto/layouts/slide-codigo.vue +16 -113
- package/template/theme/uniminuto/styles/base.css +214 -109
- package/template/public/fondos/slide-02-titulo.png +0 -0
- package/template/public/fondos/slide-03-imagen-izquierda.png +0 -0
- package/template/public/fondos/slide-04-imagen-derecha.png +0 -0
|
@@ -16,6 +16,7 @@ const targetArg = positional[0] || "openclass-uniminuto";
|
|
|
16
16
|
const targetDir = path.resolve(process.cwd(), targetArg);
|
|
17
17
|
const isCurrentDirectoryTarget = targetArg === "." || targetArg === "./";
|
|
18
18
|
const forceOverwrite = flags.has("--force");
|
|
19
|
+
const updateTheme = flags.has("--update-theme") || flags.has("--sync-theme");
|
|
19
20
|
|
|
20
21
|
function log(message = "") {
|
|
21
22
|
console.log(message);
|
|
@@ -38,6 +39,7 @@ function cleanPackageName(value) {
|
|
|
38
39
|
function copyTemplate(src, dest) {
|
|
39
40
|
const base = path.basename(src);
|
|
40
41
|
if (["node_modules", "dist", ".slidev", ".git"].includes(base)) return;
|
|
42
|
+
|
|
41
43
|
const stat = fs.statSync(src);
|
|
42
44
|
if (stat.isDirectory()) {
|
|
43
45
|
fs.mkdirSync(dest, { recursive: true });
|
|
@@ -46,14 +48,82 @@ function copyTemplate(src, dest) {
|
|
|
46
48
|
}
|
|
47
49
|
return;
|
|
48
50
|
}
|
|
51
|
+
|
|
49
52
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
50
53
|
if (fs.existsSync(dest) && !forceOverwrite) {
|
|
51
54
|
log(`↷ Conservado archivo existente: ${path.relative(targetDir, dest)}`);
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
57
|
+
|
|
54
58
|
fs.copyFileSync(src, dest);
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
function copyPathAlways(src, dest) {
|
|
62
|
+
const base = path.basename(src);
|
|
63
|
+
if (["node_modules", "dist", ".slidev", ".git"].includes(base)) return;
|
|
64
|
+
|
|
65
|
+
if (!fs.existsSync(src)) return;
|
|
66
|
+
|
|
67
|
+
const stat = fs.statSync(src);
|
|
68
|
+
if (stat.isDirectory()) {
|
|
69
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
70
|
+
for (const child of fs.readdirSync(src)) {
|
|
71
|
+
copyPathAlways(path.join(src, child), path.join(dest, child));
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
77
|
+
fs.copyFileSync(src, dest);
|
|
78
|
+
log(`✓ Actualizado: ${path.relative(targetDir, dest)}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function ensureFileFromTemplate(relativePath, options = {}) {
|
|
82
|
+
const src = path.join(templateRoot, relativePath);
|
|
83
|
+
const dest = path.join(targetDir, relativePath);
|
|
84
|
+
if (!fs.existsSync(src)) return;
|
|
85
|
+
if (fs.existsSync(dest) && options.onlyIfMissing) return;
|
|
86
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
87
|
+
fs.copyFileSync(src, dest);
|
|
88
|
+
log(`✓ Actualizado: ${relativePath}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function updateThemeOnly() {
|
|
92
|
+
if (!fs.existsSync(targetDir)) {
|
|
93
|
+
fail(`No existe la carpeta destino: ${targetDir}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
log("\n┌──────────────────────────────────────────────┐");
|
|
97
|
+
log("│ Actualizar tema Open Class UNIMINUTO │");
|
|
98
|
+
log("└──────────────────────────────────────────────┘\n");
|
|
99
|
+
log(`Destino: ${targetDir}`);
|
|
100
|
+
log("Modo: solo theme/components/styles/layouts y recursos base seguros\n");
|
|
101
|
+
|
|
102
|
+
const pathsToUpdate = [
|
|
103
|
+
"theme/uniminuto/components",
|
|
104
|
+
"theme/uniminuto/layouts",
|
|
105
|
+
"theme/uniminuto/styles",
|
|
106
|
+
"theme/uniminuto/package.json",
|
|
107
|
+
"theme/uniminuto/README-AutoFit.md",
|
|
108
|
+
"setup",
|
|
109
|
+
"snippets"
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
for (const relativePath of pathsToUpdate) {
|
|
113
|
+
copyPathAlways(path.join(templateRoot, relativePath), path.join(targetDir, relativePath));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
ensureFileFromTemplate("public/favicon.png", { onlyIfMissing: true });
|
|
117
|
+
ensureFileFromTemplate("public/imagenes/favicon.png", { onlyIfMissing: true });
|
|
118
|
+
ensureFileFromTemplate("public/imagenes/avion.png", { onlyIfMissing: false });
|
|
119
|
+
|
|
120
|
+
log("\n✅ Tema actualizado sin tocar semanas, slides.md ni openclass.config.json.");
|
|
121
|
+
log(" Recomendado ahora:");
|
|
122
|
+
log(" npm run dev");
|
|
123
|
+
log(" npm run export:downloads");
|
|
124
|
+
log("");
|
|
125
|
+
}
|
|
126
|
+
|
|
57
127
|
function isEffectivelyEmptyProject(dir) {
|
|
58
128
|
if (!fs.existsSync(dir)) return true;
|
|
59
129
|
const entries = fs.readdirSync(dir).filter((entry) => ![".git", ".gitkeep"].includes(entry));
|
|
@@ -71,12 +141,20 @@ if (!fs.existsSync(templateRoot)) {
|
|
|
71
141
|
fail("No se encontró la carpeta template dentro del paquete npm.");
|
|
72
142
|
}
|
|
73
143
|
|
|
144
|
+
if (updateTheme) {
|
|
145
|
+
updateThemeOnly();
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
|
|
74
149
|
if (fs.existsSync(targetDir) && !isEffectivelyEmptyProject(targetDir) && !forceOverwrite) {
|
|
75
150
|
fail(`La carpeta destino ya contiene archivos: ${targetDir}
|
|
76
151
|
|
|
77
152
|
Para trabajar dentro de un repositorio ya creado en GitHub, usa una carpeta vacía o ejecuta con --force si deseas sobrescribir archivos existentes.
|
|
78
153
|
Ejemplo:
|
|
79
|
-
npm create openclass-uniminuto@latest . -- --iot --force
|
|
154
|
+
npm create openclass-uniminuto@latest . -- --iot --force
|
|
155
|
+
|
|
156
|
+
Para actualizar únicamente layouts/tema de un proyecto existente, usa:
|
|
157
|
+
npm create openclass-uniminuto@latest . -- --update-theme`);
|
|
80
158
|
}
|
|
81
159
|
|
|
82
160
|
log("\n┌──────────────────────────────────────────────┐");
|
|
@@ -137,6 +215,8 @@ log(" npm run semana -- 1");
|
|
|
137
215
|
log(" npm run dev");
|
|
138
216
|
log("\nPara activar una semana adicional:");
|
|
139
217
|
log(" npm run semana -- 2 --title \"Título de la semana 2\"");
|
|
218
|
+
log("\nPara actualizar layouts/tema en un proyecto existente:");
|
|
219
|
+
log(" npm create openclass-uniminuto@latest . -- --update-theme");
|
|
140
220
|
log("\nPara revisar la publicación en GitHub Pages:");
|
|
141
221
|
log(" npm run pages:check");
|
|
142
222
|
log("");
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-openclass-uniminuto",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Creador de proyectos Open Class UNIMINUTO basados en Slidev, con generación incremental por semanas y GitHub Pages.",
|
|
3
|
+
"version": "1.6.1",
|
|
4
|
+
"description": "Creador de proyectos Open Class UNIMINUTO basados en Slidev, con generación incremental por semanas, actualización de tema y GitHub Pages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"create-openclass-uniminuto": "
|
|
7
|
+
"create-openclass-uniminuto": "bin/create-openclass-uniminuto.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"bin",
|