tsoft-cli 3.6.1 → 3.7.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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to T-Soft CLI will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.7.0] - 2026-04-15
9
+
10
+ ### Added
11
+ - Live preview link in `tsoft theme dev` — press **P** to open the dev theme in your browser
12
+ - HMAC-signed preview URL with cookie-based session (default 24h) so navigation across pages keeps the dev theme rendered
13
+ - `?_preview_clear=1` to exit preview mode
14
+
8
15
  ## [3.5.1] - 2026-04-09
9
16
 
10
17
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsoft-cli",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "tsoft360 tema geliştirme ve yönetim aracı",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,6 +5,7 @@ import path from 'path';
5
5
  import AdmZip from 'adm-zip';
6
6
  import chokidar from 'chokidar';
7
7
  import {createApiClient} from '../api-client.js';
8
+ import open from 'open';
8
9
  import {normalizeStoreDomain, slugify, setActiveTheme, getActiveTheme, getActiveStore} from '../storage.js';
9
10
  import {brandedConfirm, brandedSelect, showWarning, showError, showInfo} from '../ui/prompt-wrapper.js';
10
11
  import { t } from '../i18n.js';
@@ -169,6 +170,45 @@ async function startFileWatcher(themeUuid, themePath) {
169
170
  console.log(chalk.gray(t('dev.env_running')));
170
171
  console.log(chalk.gray(' ' + t('dev.exit_tip') + '\n'));
171
172
 
173
+ // Preview URL — backend HMAC token uretip dev temayi onizleme link'i veriyor
174
+ let previewUrl = null;
175
+ try {
176
+ const apiClient = await createApiClient();
177
+ const previewRes = await apiClient.get(`/theme/${themeUuid}/preview-url`);
178
+ previewUrl = previewRes?.data?.preview_url || null;
179
+ if (previewUrl) {
180
+ const expIso = previewRes?.data?.expires_at;
181
+ console.log(chalk.bgGreen.black(' [P] Preview ') + ' ' + chalk.white(previewUrl));
182
+ console.log(chalk.gray(' ' + chalk.dim('basın: ') + chalk.bold('P') + chalk.dim(' tarayıcıda aç')) + (expIso ? chalk.gray(` ${chalk.dim('exp:')} ${expIso}`) : '') + '\n');
183
+ }
184
+ } catch (err) {
185
+ console.log(chalk.gray(' (preview link alinamadi: ' + (err?.message || 'unknown') + ')\n'));
186
+ }
187
+
188
+ // Klavye dinleyici — 'P' tarayıcıda preview URL'ini acar, Ctrl+C cikis
189
+ if (previewUrl && process.stdin.isTTY) {
190
+ try {
191
+ process.stdin.setRawMode(true);
192
+ process.stdin.resume();
193
+ process.stdin.setEncoding('utf8');
194
+ process.stdin.on('data', async (key) => {
195
+ if (key === '\u0003') { // Ctrl+C
196
+ process.exit(0);
197
+ }
198
+ if (key === 'p' || key === 'P') {
199
+ console.log(chalk.cyan(' tarayıcıda açılıyor: ') + chalk.white(previewUrl));
200
+ try {
201
+ await open(previewUrl);
202
+ } catch (e) {
203
+ console.log(chalk.red(' tarayıcı acilamadi: ' + e.message));
204
+ }
205
+ }
206
+ });
207
+ } catch (e) {
208
+ // raw mode bazi terminallerde calismaz — sessizce gec
209
+ }
210
+ }
211
+
172
212
  const watcher = chokidar.watch(themePath, {
173
213
  ignored: /(^|[\/\\])\../, persistent: true, ignoreInitial: true, awaitWriteFinish: {
174
214
  stabilityThreshold: 300, pollInterval: 100