tiendu 0.3.1 → 0.4.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 CHANGED
@@ -126,22 +126,31 @@ tiendu dev
126
126
  Zips and uploads files to the active preview, replacing its content entirely.
127
127
 
128
128
  - **Buildless themes:** uploads from the current directory.
129
- - **Built themes:** uploads from `dist/`.
129
+ - **Built themes:** runs `tiendu build` first, then uploads from `dist/`.
130
130
 
131
131
  ```bash
132
132
  tiendu push
133
+ tiendu push --skip-build
133
134
  ```
134
135
 
136
+ Use `--skip-build` to upload the existing `dist/` output without rebuilding.
137
+
135
138
  ---
136
139
 
137
140
  ### `tiendu publish`
138
141
 
139
142
  Publishes the active preview to the live storefront. Visitors will see the new theme immediately. All previews for the store are removed after publishing.
140
143
 
144
+ - **Buildless themes:** publishes the active preview as-is.
145
+ - **Built themes:** builds the theme, uploads the latest `dist/` output to the preview, then publishes it.
146
+
141
147
  ```bash
142
148
  tiendu publish
149
+ tiendu publish --skip-build
143
150
  ```
144
151
 
152
+ Use `--skip-build` to publish after uploading the existing `dist/` output without rebuilding.
153
+
145
154
  ---
146
155
 
147
156
  ### `tiendu check-updates`
package/bin/tiendu.js CHANGED
@@ -26,9 +26,10 @@ Usage:
26
26
  tiendu init [dir] Set up a theme project (optionally in a new directory)
27
27
  tiendu pull Download the live theme from your store
28
28
  tiendu build Build a theme (requires tiendu.config.json)
29
- tiendu push Upload local files to the active preview (full replace)
29
+ tiendu push [--skip-build] Upload local files to the active preview (full replace)
30
30
  tiendu dev Start dev mode: auto-sync changes to a live preview URL
31
- tiendu publish Publish the active preview to the live storefront
31
+ tiendu publish [--skip-build]
32
+ Publish the active preview to the live storefront
32
33
 
33
34
  tiendu preview Show the active preview details
34
35
  tiendu preview create Create a new remote preview
@@ -55,6 +56,7 @@ const main = async () => {
55
56
  const args = process.argv.slice(2);
56
57
  const command = args[0];
57
58
  const subcommand = args[1];
59
+ const skipBuild = args.includes("--skip-build");
58
60
 
59
61
  if (
60
62
  command === "version" ||
@@ -100,7 +102,7 @@ const main = async () => {
100
102
  }
101
103
 
102
104
  if (command === "push") {
103
- await push();
105
+ await push({ skipBuild });
104
106
  return;
105
107
  }
106
108
 
@@ -110,7 +112,7 @@ const main = async () => {
110
112
  }
111
113
 
112
114
  if (command === "publish") {
113
- await publish();
115
+ await publish({ skipBuild });
114
116
  return;
115
117
  }
116
118
 
package/bin/tiendu.mjs CHANGED
@@ -23,9 +23,10 @@ tiendu — CLI para desarrollar temas de Tiendu
23
23
  Uso:
24
24
  tiendu init Inicializar un tema en el directorio actual
25
25
  tiendu pull Descargar el tema live desde Tiendu
26
- tiendu push Subir archivos locales al preview activo (ZIP)
26
+ tiendu push [--skip-build] Subir archivos locales al preview activo (ZIP)
27
27
  tiendu dev Modo desarrollo: watch + sync automático
28
- tiendu publish Publicar el preview activo al storefront live
28
+ tiendu publish [--skip-build]
29
+ Publicar el preview activo al storefront live
29
30
 
30
31
  tiendu preview create Crear un preview remoto
31
32
  tiendu preview list Listar previews de la tienda
@@ -46,6 +47,7 @@ const main = async () => {
46
47
  const args = process.argv.slice(2);
47
48
  const command = args[0];
48
49
  const subcommand = args[1];
50
+ const skipBuild = args.includes("--skip-build");
49
51
 
50
52
  if (
51
53
  command === "version" ||
@@ -84,7 +86,7 @@ const main = async () => {
84
86
  }
85
87
 
86
88
  if (command === "push") {
87
- await push();
89
+ await push({ skipBuild });
88
90
  return;
89
91
  }
90
92
 
@@ -94,7 +96,7 @@ const main = async () => {
94
96
  }
95
97
 
96
98
  if (command === "publish") {
97
- await publish();
99
+ await publish({ skipBuild });
98
100
  return;
99
101
  }
100
102
 
package/lib/publish.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as p from "@clack/prompts";
2
- import { loadConfigOrFail, writeConfig } from "./config.mjs";
2
+ import { loadConfigOrFail, writeConfig, isBuiltTheme } from "./config.mjs";
3
3
  import { publishPreview } from "./preview.mjs";
4
+ import { push } from "./push.mjs";
4
5
 
5
- export const publish = async () => {
6
+ export const publish = async ({ skipBuild = false } = {}) => {
6
7
  const { config, credentials } = await loadConfigOrFail();
7
8
 
8
9
  if (!config.previewKey) {
@@ -19,6 +20,15 @@ export const publish = async () => {
19
20
  process.exit(0);
20
21
  }
21
22
 
23
+ if (await isBuiltTheme()) {
24
+ p.log.info(
25
+ skipBuild
26
+ ? "Syncing existing dist/ output to the preview before publishing..."
27
+ : "Building and syncing the latest dist/ output before publishing...",
28
+ );
29
+ await push({ skipBuild });
30
+ }
31
+
22
32
  const spinner = p.spinner();
23
33
  spinner.start("Publishing preview...");
24
34
 
package/lib/push.mjs CHANGED
@@ -4,6 +4,7 @@ import * as p from "@clack/prompts";
4
4
  import { zipSync } from "fflate";
5
5
  import { loadConfigOrFail, isBuiltTheme, getDistDir } from "./config.mjs";
6
6
  import { uploadPreviewZip } from "./api.mjs";
7
+ import { build } from "./build.mjs";
7
8
 
8
9
  /** @param {number} bytes */
9
10
  const formatBytes = (bytes) => {
@@ -51,7 +52,7 @@ const createZipFromDirectory = async (rootDir) => {
51
52
  return Buffer.from(zipSync(entries, { level: 6 }));
52
53
  };
53
54
 
54
- export const push = async () => {
55
+ export const push = async ({ skipBuild = false } = {}) => {
55
56
  const { config, credentials } = await loadConfigOrFail();
56
57
 
57
58
  if (!config.previewKey) {
@@ -59,7 +60,16 @@ export const push = async () => {
59
60
  process.exit(1);
60
61
  }
61
62
 
62
- const rootDir = (await isBuiltTheme()) ? getDistDir() : process.cwd();
63
+ const builtTheme = await isBuiltTheme();
64
+
65
+ if (builtTheme && !skipBuild) {
66
+ const result = await build();
67
+ if (!result.ok) {
68
+ process.exit(1);
69
+ }
70
+ }
71
+
72
+ const rootDir = builtTheme ? getDistDir() : process.cwd();
63
73
  const spinner = p.spinner();
64
74
  spinner.start("Packing files...");
65
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiendu",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "CLI para desarrollar y publicar temas en Tiendu",
5
5
  "type": "module",
6
6
  "bin": {