create-react-zr-architecture 1.0.4 → 1.0.5
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/bin/cli.js +12 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -71,12 +71,11 @@ async function main() {
|
|
|
71
71
|
// ════════════════════════════════════════════════════════════
|
|
72
72
|
const spinnerVite = ora('Creando proyecto base con Vite...').start();
|
|
73
73
|
|
|
74
|
-
// Responder "No" a "Install and start now"
|
|
75
74
|
const createCommand = pkgManager === 'pnpm'
|
|
76
|
-
? `
|
|
75
|
+
? `pnpm create vite@latest ${projectName} --template react-ts`
|
|
77
76
|
: pkgManager === 'yarn'
|
|
78
|
-
? `
|
|
79
|
-
: `
|
|
77
|
+
? `yarn create vite ${projectName} --template react-ts`
|
|
78
|
+
: `npm create vite@latest ${projectName} -- --template react-ts`;
|
|
80
79
|
|
|
81
80
|
const viteSuccess = runCommand(createCommand);
|
|
82
81
|
|
|
@@ -95,11 +94,13 @@ async function main() {
|
|
|
95
94
|
const templatePath = path.join(__dirname, '../template');
|
|
96
95
|
|
|
97
96
|
try {
|
|
97
|
+
// Borrar src/ de Vite
|
|
98
98
|
const viteSrcPath = path.join(projectPath, 'src');
|
|
99
99
|
if (fs.existsSync(viteSrcPath)) {
|
|
100
100
|
fs.removeSync(viteSrcPath);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// Copiar template
|
|
103
104
|
fs.copySync(templatePath, projectPath, {
|
|
104
105
|
overwrite: true,
|
|
105
106
|
filter: (src) => {
|
|
@@ -107,6 +108,13 @@ async function main() {
|
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
110
|
|
|
111
|
+
// Copiar src/ del template explícitamente
|
|
112
|
+
const templateSrcPath = path.join(templatePath, 'src');
|
|
113
|
+
const projectSrcPath = path.join(projectPath, 'src');
|
|
114
|
+
if (fs.existsSync(templateSrcPath)) {
|
|
115
|
+
fs.copySync(templateSrcPath, projectSrcPath, { overwrite: true });
|
|
116
|
+
}
|
|
117
|
+
|
|
110
118
|
// Renombrar archivos con _ prefix
|
|
111
119
|
const filesToRename = [
|
|
112
120
|
{ from: '_package.json', to: 'package.json' },
|