create-openclass-uniminuto 1.4.2 → 1.6.2

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.
Files changed (28) hide show
  1. package/bin/create-openclass-uniminuto.mjs +138 -2
  2. package/package.json +2 -2
  3. package/template/README.md +612 -326
  4. package/template/package-lock.json +11568 -11568
  5. package/template/package.json +64 -61
  6. package/template/public/imagenes/avion.png +0 -0
  7. package/template/public/imagenes/favicon.png +0 -0
  8. package/template/scripts/decks.mjs +48 -10
  9. package/template/scripts/dev-all.mjs +20 -7
  10. package/template/scripts/generar-desde-config.mjs +348 -511
  11. package/template/theme/uniminuto/components/AutoFitText.vue +7 -2
  12. package/template/theme/uniminuto/components/TitleRibbon.vue +222 -0
  13. package/template/theme/uniminuto/layouts/README.md +99 -0
  14. package/template/theme/uniminuto/layouts/slide-02-titulo.vue +29 -47
  15. package/template/theme/uniminuto/layouts/slide-03-imagen-izquierda.vue +43 -69
  16. package/template/theme/uniminuto/layouts/slide-04-imagen-derecha.vue +49 -75
  17. package/template/theme/uniminuto/layouts/slide-05-titulo-superior-texto-derecha.vue +34 -66
  18. package/template/theme/uniminuto/layouts/slide-06-titulo-superior-texto-izquierda.vue +28 -78
  19. package/template/theme/uniminuto/layouts/slide-07-multimedia-con-titulo.vue +10 -66
  20. package/template/theme/uniminuto/layouts/slide-08-titulo-texto.vue +24 -53
  21. package/template/theme/uniminuto/layouts/slide-09-objetivos.vue +26 -53
  22. package/template/theme/uniminuto/layouts/slide-10-titulo-dos-columnas.vue +27 -59
  23. package/template/theme/uniminuto/layouts/slide-11-dos-titulos-dos-columnas.vue +32 -65
  24. package/template/theme/uniminuto/layouts/slide-codigo.vue +16 -113
  25. package/template/theme/uniminuto/styles/base.css +214 -108
  26. package/template/public/fondos/slide-02-titulo.png +0 -0
  27. package/template/public/fondos/slide-03-imagen-izquierda.png +0 -0
  28. package/template/public/fondos/slide-04-imagen-derecha.png +0 -0
@@ -15,7 +15,21 @@ const positional = args.filter((arg) => !arg.startsWith("--"));
15
15
  const targetArg = positional[0] || "openclass-uniminuto";
16
16
  const targetDir = path.resolve(process.cwd(), targetArg);
17
17
  const isCurrentDirectoryTarget = targetArg === "." || targetArg === "./";
18
- const forceOverwrite = flags.has("--force");
18
+ function envFlag(name) {
19
+ const value = process.env[name];
20
+ if (value === undefined) return false;
21
+ return ["1", "true", "yes", "on"].includes(String(value).toLowerCase());
22
+ }
23
+
24
+ const forceOverwrite =
25
+ flags.has("--force") ||
26
+ envFlag("npm_config_force");
27
+
28
+ const updateTheme =
29
+ flags.has("--update-theme") ||
30
+ flags.has("--sync-theme") ||
31
+ envFlag("npm_config_update_theme") ||
32
+ envFlag("npm_config_sync_theme");
19
33
 
20
34
  function log(message = "") {
21
35
  console.log(message);
@@ -38,6 +52,7 @@ function cleanPackageName(value) {
38
52
  function copyTemplate(src, dest) {
39
53
  const base = path.basename(src);
40
54
  if (["node_modules", "dist", ".slidev", ".git"].includes(base)) return;
55
+
41
56
  const stat = fs.statSync(src);
42
57
  if (stat.isDirectory()) {
43
58
  fs.mkdirSync(dest, { recursive: true });
@@ -46,14 +61,123 @@ function copyTemplate(src, dest) {
46
61
  }
47
62
  return;
48
63
  }
64
+
49
65
  fs.mkdirSync(path.dirname(dest), { recursive: true });
50
66
  if (fs.existsSync(dest) && !forceOverwrite) {
51
67
  log(`↷ Conservado archivo existente: ${path.relative(targetDir, dest)}`);
52
68
  return;
53
69
  }
70
+
54
71
  fs.copyFileSync(src, dest);
55
72
  }
56
73
 
74
+ function copyPathAlways(src, dest) {
75
+ const base = path.basename(src);
76
+ if (["node_modules", "dist", ".slidev", ".git"].includes(base)) return;
77
+
78
+ if (!fs.existsSync(src)) return;
79
+
80
+ const stat = fs.statSync(src);
81
+ if (stat.isDirectory()) {
82
+ fs.mkdirSync(dest, { recursive: true });
83
+ for (const child of fs.readdirSync(src)) {
84
+ copyPathAlways(path.join(src, child), path.join(dest, child));
85
+ }
86
+ return;
87
+ }
88
+
89
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
90
+ fs.copyFileSync(src, dest);
91
+ log(`✓ Actualizado: ${path.relative(targetDir, dest)}`);
92
+ }
93
+
94
+ function ensureFileFromTemplate(relativePath, options = {}) {
95
+ const src = path.join(templateRoot, relativePath);
96
+ const dest = path.join(targetDir, relativePath);
97
+ if (!fs.existsSync(src)) return;
98
+ if (fs.existsSync(dest) && options.onlyIfMissing) return;
99
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
100
+ fs.copyFileSync(src, dest);
101
+ log(`✓ Actualizado: ${relativePath}`);
102
+ }
103
+
104
+ function updateThemeOnly() {
105
+ if (!fs.existsSync(targetDir)) {
106
+ fail(`No existe la carpeta destino: ${targetDir}`);
107
+ }
108
+
109
+ log("\n┌──────────────────────────────────────────────┐");
110
+ log("│ Actualizar tema Open Class UNIMINUTO │");
111
+ log("└──────────────────────────────────────────────┘\n");
112
+ log(`Destino: ${targetDir}`);
113
+ log("Modo: solo theme/components/styles/layouts y recursos base seguros\n");
114
+
115
+ const pathsToUpdate = [
116
+ "README.md",
117
+ "theme/uniminuto/components",
118
+ "theme/uniminuto/layouts",
119
+ "theme/uniminuto/styles",
120
+ "theme/uniminuto/package.json",
121
+ "theme/uniminuto/README-AutoFit.md",
122
+ "setup",
123
+ "snippets",
124
+ "scripts/build-site.mjs",
125
+ "scripts/build-incremental.mjs",
126
+ "scripts/decks.mjs",
127
+ "scripts/dev-all.mjs",
128
+ "scripts/export-downloads.mjs",
129
+ "scripts/export-incremental.mjs",
130
+ "scripts/preparar-github-pages.mjs",
131
+ "scripts/semana.mjs",
132
+ ".github/workflows/deploy.yml"
133
+ ];
134
+
135
+ for (const relativePath of pathsToUpdate) {
136
+ copyPathAlways(path.join(templateRoot, relativePath), path.join(targetDir, relativePath));
137
+ }
138
+
139
+ ensureFileFromTemplate("public/favicon.png", { onlyIfMissing: true });
140
+ ensureFileFromTemplate("public/imagenes/favicon.png", { onlyIfMissing: true });
141
+ ensureFileFromTemplate("public/imagenes/avion.png", { onlyIfMissing: false });
142
+
143
+ patchJson(path.join(targetDir, "package.json"), (pkg) => {
144
+ pkg.scripts = pkg.scripts || {};
145
+ pkg.scripts["dev"] = pkg.scripts["dev"] || "slidev slides.md --open --port 3000";
146
+ pkg.scripts["dev:all"] = "node scripts/dev-all.mjs";
147
+ pkg.scripts["dev:todo"] = "node scripts/dev-all.mjs";
148
+ pkg.scripts["build:all"] = "node scripts/build-site.mjs";
149
+ pkg.scripts["build:incremental"] = "node scripts/build-incremental.mjs";
150
+ pkg.scripts["export:downloads"] = "node scripts/export-downloads.mjs";
151
+ pkg.scripts["export:incremental"] = "node scripts/export-incremental.mjs";
152
+ pkg.scripts["pages:check"] = "node scripts/preparar-github-pages.mjs";
153
+ pkg.scripts["pages:build"] = "npm run export:downloads && npm run build:all";
154
+ pkg.scripts["pages:preview"] = "npm run preview:pages";
155
+ pkg.scripts["semana"] = "node scripts/semana.mjs";
156
+ pkg.scripts["actualizar:tema"] = "npm create openclass-uniminuto@latest . -- --update-theme";
157
+ });
158
+
159
+ patchJson(path.join(targetDir, "package.json"), (pkg) => {
160
+ pkg.scripts = pkg.scripts || {};
161
+ pkg.scripts["dev"] = pkg.scripts["dev"] || "slidev slides.md --open --port 3000";
162
+ pkg.scripts["dev:all"] = "node scripts/dev-all.mjs";
163
+ pkg.scripts["dev:todo"] = "node scripts/dev-all.mjs";
164
+ pkg.scripts["build:all"] = "node scripts/build-site.mjs";
165
+ pkg.scripts["build:incremental"] = "node scripts/build-incremental.mjs";
166
+ pkg.scripts["export:downloads"] = "node scripts/export-downloads.mjs";
167
+ pkg.scripts["export:incremental"] = "node scripts/export-incremental.mjs";
168
+ pkg.scripts["pages:check"] = "node scripts/preparar-github-pages.mjs";
169
+ pkg.scripts["pages:build"] = "npm run export:downloads && npm run build:all";
170
+ pkg.scripts["pages:preview"] = "npm run preview:pages";
171
+ pkg.scripts["semana"] = "node scripts/semana.mjs";
172
+ pkg.scripts["actualizar:tema"] = "npm create openclass-uniminuto@latest . -- --update-theme";
173
+ });
174
+ log("\n✅ Tema actualizado sin tocar semanas, slides.md ni openclass.config.json.");
175
+ log(" Recomendado ahora:");
176
+ log(" npm run dev");
177
+ log(" npm run export:downloads");
178
+ log("");
179
+ }
180
+
57
181
  function isEffectivelyEmptyProject(dir) {
58
182
  if (!fs.existsSync(dir)) return true;
59
183
  const entries = fs.readdirSync(dir).filter((entry) => ![".git", ".gitkeep"].includes(entry));
@@ -71,12 +195,20 @@ if (!fs.existsSync(templateRoot)) {
71
195
  fail("No se encontró la carpeta template dentro del paquete npm.");
72
196
  }
73
197
 
198
+ if (updateTheme) {
199
+ updateThemeOnly();
200
+ process.exit(0);
201
+ }
202
+
74
203
  if (fs.existsSync(targetDir) && !isEffectivelyEmptyProject(targetDir) && !forceOverwrite) {
75
204
  fail(`La carpeta destino ya contiene archivos: ${targetDir}
76
205
 
77
206
  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
207
  Ejemplo:
79
- npm create openclass-uniminuto@latest . -- --iot --force`);
208
+ npm create openclass-uniminuto@latest . -- --iot --force
209
+
210
+ Para actualizar únicamente layouts/tema de un proyecto existente, usa:
211
+ npm create openclass-uniminuto@latest . -- --update-theme`);
80
212
  }
81
213
 
82
214
  log("\n┌──────────────────────────────────────────────┐");
@@ -137,6 +269,10 @@ log(" npm run semana -- 1");
137
269
  log(" npm run dev");
138
270
  log("\nPara activar una semana adicional:");
139
271
  log(" npm run semana -- 2 --title \"Título de la semana 2\"");
272
+ log("\nPara actualizar layouts/tema en un proyecto existente:");
273
+ log(" npm create openclass-uniminuto@latest . -- --update-theme");
140
274
  log("\nPara revisar la publicación en GitHub Pages:");
141
275
  log(" npm run pages:check");
142
276
  log("");
277
+
278
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-openclass-uniminuto",
3
- "version": "1.4.2",
4
- "description": "Creador de proyectos Open Class UNIMINUTO basados en Slidev, con generación incremental por semanas y GitHub Pages.",
3
+ "version": "1.6.2",
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
7
  "create-openclass-uniminuto": "bin/create-openclass-uniminuto.mjs"