@dropi/ui 0.1.30 → 0.1.32

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 (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/setup.js +15 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/ui",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Dropi Design System — Web Components for Angular, React and Vue",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
package/scripts/setup.js CHANGED
@@ -28,8 +28,14 @@ const getPkg = () => {
28
28
  };
29
29
 
30
30
  const getPkgMgr = () => {
31
- if (fs.existsSync(path.join(projectRoot, 'yarn.lock'))) return 'yarn';
32
31
  if (fs.existsSync(path.join(projectRoot, 'pnpm-lock.yaml'))) return 'pnpm';
32
+ if (fs.existsSync(path.join(projectRoot, 'yarn.lock'))) {
33
+ // Yarn Berry (v2+) requiere Corepack — detectar por el campo packageManager
34
+ const pkg = getPkg();
35
+ const pm = pkg.packageManager || '';
36
+ if (pm.startsWith('yarn@') && !pm.startsWith('yarn@1')) return 'yarn-berry';
37
+ return 'yarn';
38
+ }
33
39
  return 'npm';
34
40
  };
35
41
 
@@ -78,7 +84,10 @@ async function run() {
78
84
 
79
85
  // 2. Instalación de Dependencias
80
86
  const pkgMgr = getPkgMgr();
81
- const installCmd = pkgMgr === 'yarn' ? 'yarn add' : pkgMgr === 'pnpm' ? 'pnpm add' : 'npm install';
87
+ const installCmd = pkgMgr === 'yarn-berry' ? 'corepack yarn add'
88
+ : pkgMgr === 'yarn' ? 'yarn add'
89
+ : pkgMgr === 'pnpm' ? 'pnpm add'
90
+ : 'npm install';
82
91
 
83
92
  if ((isReact || isNextJs) && (!hasDep('@dropi/ui') || !hasDep('@dropi/ui-react'))) {
84
93
  const toInstall = [
@@ -97,7 +106,10 @@ async function run() {
97
106
  if (isNextJsSsr && !hasDep('@stencil/ssr')) {
98
107
  log('Next.js SSR → Instalando @stencil/ssr...');
99
108
  try {
100
- execSync(`${installCmd} --save-dev @stencil/ssr --legacy-peer-deps`, { stdio: 'inherit', cwd: projectRoot });
109
+ const stencilCmd = pkgMgr === 'npm'
110
+ ? `${installCmd} --save-dev @stencil/ssr --legacy-peer-deps`
111
+ : `${installCmd} --dev @stencil/ssr`;
112
+ execSync(stencilCmd, { stdio: 'inherit', cwd: projectRoot });
101
113
  log('@stencil/ssr instalado.', 'ok');
102
114
  } catch (e) {
103
115
  log('Error instalando @stencil/ssr. Intenta instalarlo manualmente: npm install --save-dev @stencil/ssr --legacy-peer-deps', 'warn');