@velsefy/cli 0.1.1 → 0.2.0
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/README.md +20 -7
- package/THEME-DEVELOPMENT.md +5 -1
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +38 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/theme.js +400 -71
- package/dist/commands/theme.js.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/api.d.ts +26 -10
- package/dist/lib/api.js +138 -43
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/logger.js +1 -1
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/validate.d.ts +2 -2
- package/dist/lib/validate.js +42 -6
- package/dist/lib/validate.js.map +1 -1
- package/dist/types.d.ts +51 -2
- package/examples/default-theme/assets/theme.css +3 -0
- package/examples/default-theme/config/settings_schema.json +16 -0
- package/examples/default-theme/layout/theme.liquid +12 -0
- package/examples/default-theme/sections/hero.liquid +31 -0
- package/examples/default-theme/snippets/head.liquid +1 -0
- package/examples/default-theme/templates/index.json +22 -0
- package/examples/default-theme/velsefy.settings_schema.json +44 -0
- package/package.json +72 -62
package/README.md
CHANGED
|
@@ -45,13 +45,19 @@ node dist/bin/velsefy.js --help
|
|
|
45
45
|
|---|---|---|
|
|
46
46
|
| `velsefy login --token <token>` | Guarda el token (almacén seguro del SO) | — |
|
|
47
47
|
| `velsefy logout` | Elimina el token guardado | — |
|
|
48
|
-
| `velsefy theme
|
|
48
|
+
| `velsefy theme init [dir]` | Crea un tema local desde el starter oficial (ya válido) | — |
|
|
49
|
+
| `velsefy theme list [--json]` | Lista los temas instalados de tu tienda | token de acceso |
|
|
50
|
+
| `velsefy theme install --sku <sku>` | Instala un tema del catálogo en tu tienda | token de acceso |
|
|
49
51
|
| `velsefy theme pull --install <id> -o <dir>` | Descarga los assets de un tema instalado | token de acceso |
|
|
50
|
-
| `velsefy theme
|
|
51
|
-
| `velsefy theme
|
|
52
|
-
| `velsefy theme
|
|
52
|
+
| `velsefy theme push --install <id> --dir <dir>` | Sube cambios y borra en el servidor lo que eliminaste local (409 si hay conflicto) | token de acceso |
|
|
53
|
+
| `velsefy theme publish --install <id>` | Activa el tema instalado en la tienda | token de acceso |
|
|
54
|
+
| `velsefy theme preview --install <id> --session <token>` | URL de vista previa (necesita sesión de usuario) | token de acceso |
|
|
55
|
+
| `velsefy theme validate --dir <dir>` | Validación LOCAL (Liquid/JSON/schema/paths/semver/inicio) | No requiere |
|
|
53
56
|
| `velsefy theme create --sku <sku> --name "<Nombre>" [--from <baseSku>]` | Crea un tema base nuevo en el catálogo global | credenciales de plataforma |
|
|
54
|
-
| `velsefy theme
|
|
57
|
+
| `velsefy theme pull-catalog --sku <sku> -o <dir>` | Descarga los assets del **catálogo global** (el base) | credenciales de plataforma |
|
|
58
|
+
| `velsefy theme release --sku <sku> --changelog "..." --dir <dir> --yes` | Publica una release al catálogo de temas | credenciales de plataforma |
|
|
59
|
+
| `velsefy theme releases --sku <sku>` | Historial de releases del tema | credenciales de plataforma |
|
|
60
|
+
| `velsefy theme rollback --sku <sku> --release <id>` | Vuelve a una release anterior como versión nueva | credenciales de plataforma |
|
|
55
61
|
|
|
56
62
|
---
|
|
57
63
|
|
|
@@ -72,8 +78,15 @@ velsefy theme validate --dir ./mi-tema
|
|
|
72
78
|
|
|
73
79
|
# subir los cambios (409 si hubo conflicto en otro lado)
|
|
74
80
|
velsefy theme push --install <installId> --dir ./mi-tema
|
|
81
|
+
|
|
82
|
+
# verlo sin activarlo, y activarlo cuando esté listo
|
|
83
|
+
velsefy theme preview --install <installId> --session <sessionToken>
|
|
84
|
+
velsefy theme publish --install <installId>
|
|
75
85
|
```
|
|
76
86
|
|
|
87
|
+
Los borrados viajan con el push: si eliminas un archivo en local, deja de existir en la
|
|
88
|
+
instalación. Sin cambios reales el push no hace peticiones.
|
|
89
|
+
|
|
77
90
|
### Publicar al catálogo global (solo plataforma)
|
|
78
91
|
|
|
79
92
|
```bash
|
|
@@ -83,8 +96,8 @@ velsefy theme pull-catalog --sku THEME-DEFAULT -o ./mi-tema
|
|
|
83
96
|
|
|
84
97
|
# editar en VS Code… validar… y publicar la nueva versión
|
|
85
98
|
velsefy theme validate --dir ./mi-tema
|
|
86
|
-
velsefy theme release --sku THEME-DEFAULT --changelog "
|
|
87
|
-
# → { ok: true, version:
|
|
99
|
+
velsefy theme release --sku THEME-DEFAULT --changelog "nuevo hero" --dir ./mi-tema --bump minor --yes
|
|
100
|
+
# → { ok: true, version: 21, version_semver: "2.8.0" }
|
|
88
101
|
```
|
|
89
102
|
|
|
90
103
|
---
|
package/THEME-DEVELOPMENT.md
CHANGED
|
@@ -57,7 +57,11 @@ La versión semver (`MAJOR.MINOR.PATCH`) vive **SOLO** en `config/settings_schem
|
|
|
57
57
|
|
|
58
58
|
- La versión se lee de `theme_info.theme_version` (semver, única fuente en el tema).
|
|
59
59
|
- La **versión del catálogo** (lo que se compara para "actualización disponible") la gestiona la plataforma al publicar.
|
|
60
|
-
- Al publicar con `velsefy theme release`, el servidor **bump** la versión
|
|
60
|
+
- Al publicar con `velsefy theme release`, el servidor **bump** la versión: `patch` por
|
|
61
|
+
defecto, o `--bump minor` / `--bump major` cuando el cambio lo justifica.
|
|
62
|
+
- Una release sin archivos modificados se rechaza: no se crean versiones vacías.
|
|
63
|
+
- Los archivos que borres en local se borran del catálogo al publicar (el release
|
|
64
|
+
guarda el estado resultante, así que un rollback nunca deja huérfanos).
|
|
61
65
|
|
|
62
66
|
---
|
|
63
67
|
|
package/dist/commands/login.d.ts
CHANGED
package/dist/commands/login.js
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import { logger } from "../lib/logger.js";
|
|
2
3
|
import { setToken } from "../lib/credentials.js";
|
|
4
|
+
import { listCatalogThemes, listThemes } from "../lib/api.js";
|
|
5
|
+
/** Prefijos válidos de token: personal (pat), app (tok) y plataforma (dev). */
|
|
6
|
+
const TOKEN_PREFIX = /^vls_(tok|dev|pat)_[A-Za-z0-9._-]{10,}$/;
|
|
7
|
+
function readStdinToken() {
|
|
8
|
+
try {
|
|
9
|
+
return fs.readFileSync(0, "utf8").trim();
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
3
15
|
export function loginCommand(program) {
|
|
4
16
|
program
|
|
5
17
|
.command("login")
|
|
6
18
|
.description("Guarda un token de acceso de VELSEFY")
|
|
7
|
-
// TODO: OAuth Device Flow (RFC 8628) interactivo
|
|
8
|
-
// Por ahora se acepta un token
|
|
9
|
-
|
|
10
|
-
.
|
|
19
|
+
// TODO: OAuth Device Flow (RFC 8628) interactivo.
|
|
20
|
+
// Por ahora se acepta un token emitido desde tu cuenta (vls_pat_/vls_tok_) o
|
|
21
|
+
// un token de plataforma (vls_dev_) para publicar al catálogo.
|
|
22
|
+
.option("--token <token>", "Token de acceso (evita pasarlo por argv en CI)")
|
|
23
|
+
.option("--token-stdin", "Lee el token desde stdin (recomendado en CI)")
|
|
24
|
+
.option("--verify", "Verifica el token contra la API antes de guardarlo")
|
|
25
|
+
.action(async (options) => {
|
|
11
26
|
try {
|
|
12
|
-
|
|
27
|
+
const raw = options.tokenStdin ? readStdinToken() : options.token;
|
|
28
|
+
const token = (raw ?? "").trim();
|
|
29
|
+
if (!token) {
|
|
30
|
+
throw new Error("Falta el token: usa --token <t> o --token-stdin.");
|
|
31
|
+
}
|
|
32
|
+
if (!TOKEN_PREFIX.test(token)) {
|
|
33
|
+
throw new Error("El token no tiene un formato válido (vls_pat_, vls_tok_ o vls_dev_).");
|
|
34
|
+
}
|
|
35
|
+
if (options.verify) {
|
|
36
|
+
if (token.startsWith("vls_dev_")) {
|
|
37
|
+
await listCatalogThemes(token);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
await listThemes(token);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
setToken(token);
|
|
13
44
|
logger.success("Credenciales guardadas.");
|
|
45
|
+
if (options.verify)
|
|
46
|
+
logger.muted("Token verificado contra la API.");
|
|
14
47
|
}
|
|
15
48
|
catch (err) {
|
|
16
49
|
logger.error(err instanceof Error ? err.message : String(err));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ9D,+EAA+E;AAC/E,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAE/D,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,sCAAsC,CAAC;QACpD,kDAAkD;QAClD,6EAA6E;QAC7E,+DAA+D;SAC9D,MAAM,CAAC,iBAAiB,EAAE,gDAAgD,CAAC;SAC3E,MAAM,CAAC,eAAe,EAAE,8CAA8C,CAAC;SACvE,MAAM,CAAC,UAAU,EAAE,oDAAoD,CAAC;SACxE,MAAM,CAAC,KAAK,EAAE,OAAqB,EAAE,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,EAAE,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