@orxataguy/tyr 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orxataguy/tyr",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tyr": "./bin/tyr.js"
@@ -2,8 +2,17 @@ import path from 'path';
2
2
  import yaml from 'js-yaml';
3
3
  import { homedir, platform } from 'os';
4
4
  import { existsSync, cpSync, rmSync } from 'fs';
5
+ import { execSync } from 'child_process';
5
6
  import type { TyrContext } from '../Kernel';
6
7
 
8
+ function removeDirRecursive(dirPath: string): void {
9
+ if (platform() === 'win32') {
10
+ execSync(`rd /s /q "${dirPath}"`, { stdio: 'pipe' });
11
+ } else {
12
+ rmSync(dirPath, { recursive: true, force: true });
13
+ }
14
+ }
15
+
7
16
  // ─── Shell RC detection ───────────────────────────────────────────────────────
8
17
 
9
18
  function detectShellRcFile(homeDir: string): string | null {
@@ -128,7 +137,7 @@ export default function config({ logger, fs: tyrFs, frameworkRoot, shell }: TyrC
128
137
  if (existsSync(userRoot)) {
129
138
  backupPath = `${userRoot}.bak.${makeTimestamp()}`;
130
139
  cpSync(userRoot, backupPath, { recursive: true });
131
- rmSync(userRoot, { recursive: true, force: true });
140
+ removeDirRecursive(userRoot);
132
141
  logger.warn(`Configuración anterior respaldada en: ${backupPath}`);
133
142
  }
134
143
 
@@ -142,7 +151,7 @@ export default function config({ logger, fs: tyrFs, frameworkRoot, shell }: TyrC
142
151
  // Restore backup if clone failed
143
152
  if (backupPath && existsSync(backupPath)) {
144
153
  cpSync(backupPath, userRoot, { recursive: true });
145
- rmSync(backupPath, { recursive: true, force: true });
154
+ removeDirRecursive(backupPath);
146
155
  logger.warn('Error al clonar. Configuración anterior restaurada.');
147
156
  }
148
157
  throw e;