create-react-zr-architecture 1.0.3 β 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/README.md +11 -3
- package/bin/cli.js +18 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,15 @@ Generador CLI para crear proyectos React con **Clean Architecture**, TypeScript,
|
|
|
18
18
|
## π¦ InstalaciΓ³n
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
21
|
+
# Con npm
|
|
22
|
+
npm create react-zr-architecture mi-proyecto
|
|
23
|
+
|
|
24
|
+
# Con pnpm
|
|
25
|
+
pnpm create react-zr-architecture mi-proyecto
|
|
26
|
+
|
|
27
|
+
# Con npx
|
|
28
|
+
npx create-react-zr-architecture mi-proyecto
|
|
29
|
+
|
|
22
30
|
cd mi-proyecto
|
|
23
31
|
npm run dev
|
|
24
32
|
```
|
|
@@ -267,8 +275,8 @@ MIT Β© Diego Aguilera
|
|
|
267
275
|
|
|
268
276
|
## π Enlaces
|
|
269
277
|
|
|
270
|
-
- [Repositorio](https://github.com/diegoAguilera02/create-react-
|
|
271
|
-
- [Issues](https://github.com/diegoAguilera02/create-react-
|
|
278
|
+
- [Repositorio](https://github.com/diegoAguilera02/create-react-zr-architecture)
|
|
279
|
+
- [Issues](https://github.com/diegoAguilera02/create-react-zr-architecture/issues)
|
|
272
280
|
- [shadcn/ui](https://ui.shadcn.com/)
|
|
273
281
|
- [Vite](https://vitejs.dev/)
|
|
274
282
|
- [TanStack Query](https://tanstack.com/query/latest)
|
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,15 +94,27 @@ async function main() {
|
|
|
95
94
|
const templatePath = path.join(__dirname, '../template');
|
|
96
95
|
|
|
97
96
|
try {
|
|
98
|
-
//
|
|
97
|
+
// Borrar src/ de Vite
|
|
98
|
+
const viteSrcPath = path.join(projectPath, 'src');
|
|
99
|
+
if (fs.existsSync(viteSrcPath)) {
|
|
100
|
+
fs.removeSync(viteSrcPath);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Copiar template
|
|
99
104
|
fs.copySync(templatePath, projectPath, {
|
|
100
105
|
overwrite: true,
|
|
101
106
|
filter: (src) => {
|
|
102
|
-
|
|
103
|
-
return !src.includes('node_modules');
|
|
107
|
+
return !src.includes('node_modules') && !src.includes('.sh');
|
|
104
108
|
}
|
|
105
109
|
});
|
|
106
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
|
+
|
|
107
118
|
// Renombrar archivos con _ prefix
|
|
108
119
|
const filesToRename = [
|
|
109
120
|
{ from: '_package.json', to: 'package.json' },
|