cli-error-capa-8 1.0.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/imgs/sombrero sin pupila.png +0 -0
- package/index.js +386 -0
- package/package.json +26 -0
- package/parches/App.jsx +206 -0
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import readline from "readline";
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const rl = readline.createInterface({
|
|
15
|
+
input: process.stdin,
|
|
16
|
+
output: process.stdout
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
function ask(text){
|
|
21
|
+
return new Promise(resolve=>{
|
|
22
|
+
rl.question(text,resolve);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
function run(command, cwd){
|
|
28
|
+
|
|
29
|
+
console.log("\n>", command);
|
|
30
|
+
|
|
31
|
+
if(cwd){
|
|
32
|
+
console.log("cwd:", path.resolve(cwd));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
execSync(command,{
|
|
36
|
+
cwd,
|
|
37
|
+
stdio:"inherit"
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function editFile(file, callback){
|
|
44
|
+
|
|
45
|
+
let content = fs.readFileSync(
|
|
46
|
+
file,
|
|
47
|
+
"utf8"
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
content = callback(content);
|
|
51
|
+
|
|
52
|
+
fs.writeFileSync(
|
|
53
|
+
file,
|
|
54
|
+
content
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
async function main(){
|
|
61
|
+
|
|
62
|
+
const name = (
|
|
63
|
+
await ask("Nombre del proyecto: ")
|
|
64
|
+
).trim();
|
|
65
|
+
name = name
|
|
66
|
+
.toLowerCase()
|
|
67
|
+
.replace(/\s+/g, "-")
|
|
68
|
+
.replace(/[^a-z0-9-_]/g, "");
|
|
69
|
+
|
|
70
|
+
if(!name){
|
|
71
|
+
console.log("Nombre inválido");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if(fs.existsSync(name)){
|
|
77
|
+
console.log("La carpeta ya existe");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
console.log("\nCreando React...");
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
run(
|
|
86
|
+
`npm create vite@latest ${name} -- --template react --no-interactive`,
|
|
87
|
+
process.cwd()
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const projectPath = path.resolve(
|
|
92
|
+
process.cwd(),
|
|
93
|
+
name
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
console.log("===========================\n");
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
console.log("\nInstalando dependencias...");
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
run(
|
|
105
|
+
"npm install",
|
|
106
|
+
projectPath
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
Dependencias extras
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
console.log(
|
|
115
|
+
"\nInstalando zod y react-hook-form..."
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
try{
|
|
119
|
+
|
|
120
|
+
run(
|
|
121
|
+
"npm install zod react-hook-form",
|
|
122
|
+
projectPath
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
console.log(
|
|
126
|
+
"zod y react-hook-form instalados"
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
}catch(e){
|
|
130
|
+
|
|
131
|
+
console.log(
|
|
132
|
+
"Error al instalar zod y react-hook-form:"
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
console.log(e.message);
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
console.log(
|
|
142
|
+
"\nInstalando tailwindcss y @tailwindcss/vite..."
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
run(
|
|
147
|
+
"npm install tailwindcss @tailwindcss/vite",
|
|
148
|
+
projectPath
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/*
|
|
154
|
+
Mostrar dependencias
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
try{
|
|
158
|
+
|
|
159
|
+
const packageJson = JSON.parse(
|
|
160
|
+
fs.readFileSync(
|
|
161
|
+
path.join(
|
|
162
|
+
projectPath,
|
|
163
|
+
"package.json"
|
|
164
|
+
),
|
|
165
|
+
"utf8"
|
|
166
|
+
)
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
console.log(
|
|
170
|
+
"\nDependencias detectadas:"
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
console.log(
|
|
174
|
+
packageJson.dependencies || {}
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
}catch(e){
|
|
178
|
+
|
|
179
|
+
console.log(
|
|
180
|
+
"No se pudo leer package.json"
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/*
|
|
188
|
+
modificar vite.config.js
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
const vite = path.join(
|
|
193
|
+
projectPath,
|
|
194
|
+
"vite.config.js"
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
console.log(
|
|
199
|
+
"\nVite config:",
|
|
200
|
+
vite
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
console.log(
|
|
204
|
+
"Existe:",
|
|
205
|
+
fs.existsSync(vite)
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
if(fs.existsSync(vite)){
|
|
210
|
+
|
|
211
|
+
editFile(vite,(data)=>{
|
|
212
|
+
|
|
213
|
+
if(
|
|
214
|
+
!data.includes("@tailwindcss/vite")
|
|
215
|
+
){
|
|
216
|
+
|
|
217
|
+
return data
|
|
218
|
+
.replace(
|
|
219
|
+
"import react from '@vitejs/plugin-react'",
|
|
220
|
+
"import react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'"
|
|
221
|
+
)
|
|
222
|
+
.replace(
|
|
223
|
+
"plugins: [react()]",
|
|
224
|
+
"plugins: [react(), tailwindcss()]"
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return data;
|
|
230
|
+
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
console.log(
|
|
234
|
+
"vite.config.js modificado"
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
modificar CSS
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
const css = path.join(
|
|
247
|
+
projectPath,
|
|
248
|
+
"src",
|
|
249
|
+
"index.css"
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
console.log(
|
|
254
|
+
"\nCSS:",
|
|
255
|
+
css
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
console.log(
|
|
259
|
+
"Existe:",
|
|
260
|
+
fs.existsSync(css)
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
if(fs.existsSync(css)){
|
|
265
|
+
|
|
266
|
+
fs.writeFileSync(
|
|
267
|
+
css,
|
|
268
|
+
`@import "tailwindcss";`
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
console.log(
|
|
272
|
+
"index.css modificado"
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
}
|
|
276
|
+
console.log(
|
|
277
|
+
"\nModificando App.css..."
|
|
278
|
+
);
|
|
279
|
+
const appcss = path.join(
|
|
280
|
+
projectPath,
|
|
281
|
+
"src",
|
|
282
|
+
"App.css"
|
|
283
|
+
);
|
|
284
|
+
console.log(
|
|
285
|
+
"\nAPPCSS:",
|
|
286
|
+
appcss
|
|
287
|
+
);
|
|
288
|
+
if(fs.existsSync(appcss)){
|
|
289
|
+
|
|
290
|
+
fs.writeFileSync(
|
|
291
|
+
appcss,
|
|
292
|
+
`@import "tailwindcss";`
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
console.log(
|
|
301
|
+
"\nAgregando Assets..."
|
|
302
|
+
);
|
|
303
|
+
const img_origin = path.join(
|
|
304
|
+
__dirname,
|
|
305
|
+
"imgs"
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
const assets = path.join(
|
|
309
|
+
projectPath,
|
|
310
|
+
"src","assets"
|
|
311
|
+
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
fs.cpSync(
|
|
315
|
+
img_origin,
|
|
316
|
+
assets,
|
|
317
|
+
{
|
|
318
|
+
recursive:true
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
console.log(
|
|
325
|
+
"\nModificando App.jsx ..."
|
|
326
|
+
);
|
|
327
|
+
const appjsx_origin = path.join(
|
|
328
|
+
__dirname,
|
|
329
|
+
"parches",
|
|
330
|
+
"App.jsx"
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const appjsx_dest = path.join(
|
|
334
|
+
projectPath,
|
|
335
|
+
"src",
|
|
336
|
+
"App.jsx"
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
fs.cpSync(
|
|
340
|
+
appjsx_origin,
|
|
341
|
+
appjsx_dest,
|
|
342
|
+
{
|
|
343
|
+
recursive:true
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
console.log(`
|
|
348
|
+
████████████████████████████████████████████████████████████████████████████████████████████████████████
|
|
349
|
+
██ ██
|
|
350
|
+
██ █████ ████ ████ ███ ████ ████ █████ ███ ███ ████ ███ ███ ██
|
|
351
|
+
██ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ██
|
|
352
|
+
██ ████ ████ ████ █ █ ████ ████ █ █ ████ ████ █ █████ ████ █████ ████ ███ ██
|
|
353
|
+
██ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ██
|
|
354
|
+
██ █████ █ █ █ █ ███ █ █ ████ █████ ███ █ █ █ █ █ ███ ██
|
|
355
|
+
██ ██
|
|
356
|
+
██ ██
|
|
357
|
+
██ ███ █ █ ████ █████ ███ █ ███ ███ ███ ███ █ █ ██
|
|
358
|
+
██ █ ██ █ █ █ █ █ █ █ █ █ █ █ █ ██ █ ██
|
|
359
|
+
██ █ █ █ █ ███ █ █████ █ █████ █ █ █ █ █ █ █ ██
|
|
360
|
+
██ █ █ ██ █ █ █ █ █ █ █ █ █ █ █ █ ██ ██
|
|
361
|
+
██ ███ █ █ ████ █ █ █ █████ █ █ ███ ███ ███ █ █ ██
|
|
362
|
+
██ ██
|
|
363
|
+
██ ██
|
|
364
|
+
██ █████ █ █ ███ █████ ███ ████ ███ ██
|
|
365
|
+
██ █ █ █ █ █ █ █ █ █ █ ██
|
|
366
|
+
██ ████ █ █ █ █ █ ███ █████ ██
|
|
367
|
+
██ █ █ █ █ █ █ █ █ █ █ ██
|
|
368
|
+
██ █████ █ █ ███ █ ███ ████ █ █ ██
|
|
369
|
+
██ ██
|
|
370
|
+
██ ██
|
|
371
|
+
████████████████████████████████████████████████████████████████████████████████████████████████████████
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
cd ${name}
|
|
375
|
+
|
|
376
|
+
npm run dev
|
|
377
|
+
`);
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
rl.close();
|
|
381
|
+
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cli-error-capa-8",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI para crear proyectos React configurados hecho por ERROR-CAPA-8 O Gasparin7u7 (SIGUEME EN IG AL MENOS P NO SEAS RATA)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"react-capa-8": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"imgs",
|
|
12
|
+
"parches"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"start": "node index.js"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"react",
|
|
19
|
+
"vite",
|
|
20
|
+
"tailwind",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"author": "GASPARIN7U7/ERROR-CAPA-8",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"type": "module"
|
|
26
|
+
}
|
package/parches/App.jsx
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import img from './assets/sombrero sin pupila.png'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import './App.css'
|
|
4
|
+
|
|
5
|
+
const TopHat = () => {
|
|
6
|
+
|
|
7
|
+
const [pos,setPos] = useState({x:0,y:0});
|
|
8
|
+
const [scale,setScale] = useState(1);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function move(e){
|
|
12
|
+
|
|
13
|
+
const box = e.currentTarget.getBoundingClientRect();
|
|
14
|
+
|
|
15
|
+
const x = e.clientX - box.left;
|
|
16
|
+
const y = e.clientY - box.top;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const centerX = box.width / 2;
|
|
20
|
+
const centerY = box.height / 2;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
let dx = x - centerX;
|
|
24
|
+
let dy = y - centerY;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const distance = Math.sqrt(
|
|
28
|
+
dx * dx + dy * dy
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const angle = Math.atan2(dy,dx);
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// zona central pequeña
|
|
36
|
+
const deadZone = 5;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// movimiento máximo
|
|
40
|
+
const maxRadius = 26;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
let radius = 0;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
if(distance > deadZone){
|
|
47
|
+
|
|
48
|
+
radius =
|
|
49
|
+
Math.min(
|
|
50
|
+
distance / (box.width / 2),
|
|
51
|
+
1
|
|
52
|
+
) * maxRadius;
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
setPos({
|
|
58
|
+
|
|
59
|
+
x: Math.cos(angle) * radius,
|
|
60
|
+
|
|
61
|
+
y: Math.sin(angle) * radius
|
|
62
|
+
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function leave(){
|
|
70
|
+
|
|
71
|
+
setPos({
|
|
72
|
+
x:0,
|
|
73
|
+
y:0
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
|
|
82
|
+
<div className="
|
|
83
|
+
min-h-screen
|
|
84
|
+
bg-black
|
|
85
|
+
flex
|
|
86
|
+
flex-col
|
|
87
|
+
items-center
|
|
88
|
+
justify-center
|
|
89
|
+
gap-8
|
|
90
|
+
overflow-hidden
|
|
91
|
+
">
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
{/* CIRCULO */}
|
|
95
|
+
<div
|
|
96
|
+
|
|
97
|
+
onMouseMove={move}
|
|
98
|
+
onMouseLeave={leave}
|
|
99
|
+
|
|
100
|
+
className="
|
|
101
|
+
relative
|
|
102
|
+
w-[clamp(320px,70vw,800px)]
|
|
103
|
+
h-[clamp(320px,70vw,800px)]
|
|
104
|
+
rounded-full
|
|
105
|
+
bg-[#071a3d]
|
|
106
|
+
shadow-[0_0_90px_rgba(10,40,120,0.9)]
|
|
107
|
+
overflow-hidden
|
|
108
|
+
"
|
|
109
|
+
>
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
{/* SOMBRERO */}
|
|
113
|
+
<img
|
|
114
|
+
|
|
115
|
+
src={img}
|
|
116
|
+
|
|
117
|
+
className="
|
|
118
|
+
absolute
|
|
119
|
+
w-[70%]
|
|
120
|
+
h-[70%]
|
|
121
|
+
left-[15%]
|
|
122
|
+
top-[15%]
|
|
123
|
+
object-contain
|
|
124
|
+
"
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
{/* IRIS DRAGÓN */}
|
|
130
|
+
<div
|
|
131
|
+
|
|
132
|
+
onMouseEnter={()=>{
|
|
133
|
+
|
|
134
|
+
setScale(0.65)
|
|
135
|
+
|
|
136
|
+
}}
|
|
137
|
+
|
|
138
|
+
onMouseLeave={()=>{
|
|
139
|
+
|
|
140
|
+
setScale(1)
|
|
141
|
+
|
|
142
|
+
}}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
className="
|
|
146
|
+
absolute
|
|
147
|
+
left-[50%]
|
|
148
|
+
top-[48%]
|
|
149
|
+
w-[45px]
|
|
150
|
+
h-[60px]
|
|
151
|
+
bg-gray-900
|
|
152
|
+
transition-transform
|
|
153
|
+
duration-100
|
|
154
|
+
"
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
style={{
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
clipPath:
|
|
161
|
+
"path('M22.5 0 C27 10 32 22 32 30 C32 38 27 50 22.5 60 C18 50 13 38 13 30 C13 22 18 10 22.5 0 Z')",
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
transform:
|
|
166
|
+
`
|
|
167
|
+
translate(-50%,-90%)
|
|
168
|
+
translate(${pos.x}px,${pos.y}px)
|
|
169
|
+
scale(${scale})
|
|
170
|
+
`
|
|
171
|
+
|
|
172
|
+
}}
|
|
173
|
+
|
|
174
|
+
/>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<div
|
|
182
|
+
|
|
183
|
+
className="
|
|
184
|
+
text-white
|
|
185
|
+
tracking-[0.5em]
|
|
186
|
+
sm:tracking-[0.8em]
|
|
187
|
+
text-sm
|
|
188
|
+
sm:text-xl
|
|
189
|
+
font-mono
|
|
190
|
+
text-center
|
|
191
|
+
"
|
|
192
|
+
|
|
193
|
+
>
|
|
194
|
+
|
|
195
|
+
CLI - ERROR-CAPA-8
|
|
196
|
+
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export default TopHat;
|