create-universal-dapp 1.0.0 → 1.0.2
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 +1 -1
- package/dist/templates/vite.d.ts +1 -0
- package/dist/templates/vite.d.ts.map +1 -1
- package/dist/templates/vite.js +106 -352
- package/dist/templates/vite.js.map +1 -1
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ VITE_PUSHCHAIN_NETWORK=testnet
|
|
|
128
128
|
To work on this CLI tool:
|
|
129
129
|
|
|
130
130
|
```bash
|
|
131
|
-
git clone https://github.com/
|
|
131
|
+
git clone https://github.com/pushchain/create-universal-dapp
|
|
132
132
|
cd create-universal-dapp
|
|
133
133
|
npm install
|
|
134
134
|
npm run build
|
package/dist/templates/vite.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/templates/vite.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/templates/vite.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B1E;AA4hBD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC/E"}
|
package/dist/templates/vite.js
CHANGED
|
@@ -16,8 +16,6 @@ export async function createViteApp(options) {
|
|
|
16
16
|
if (options.eslint) {
|
|
17
17
|
await createESLintConfig(options);
|
|
18
18
|
}
|
|
19
|
-
// Create Tailwind config (Tailwind-only setup)
|
|
20
|
-
await createTailwindConfig(options);
|
|
21
19
|
spinner.succeed('Vite project structure created');
|
|
22
20
|
}
|
|
23
21
|
catch (error) {
|
|
@@ -26,6 +24,26 @@ export async function createViteApp(options) {
|
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
async function createVitePackageJson(options) {
|
|
27
|
+
const baseDevDeps = {
|
|
28
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
29
|
+
"@types/react": "^19.1.10",
|
|
30
|
+
"@types/react-dom": "^19.1.7",
|
|
31
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
32
|
+
typescript: "^5.8.3",
|
|
33
|
+
vite: "^7.1.2",
|
|
34
|
+
tailwindcss: "^4.1.13",
|
|
35
|
+
};
|
|
36
|
+
const eslintDevDeps = {
|
|
37
|
+
"@eslint/js": "^9.33.0",
|
|
38
|
+
"eslint": "^9.33.0",
|
|
39
|
+
"typescript-eslint": "^8.39.1",
|
|
40
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
41
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
42
|
+
};
|
|
43
|
+
const devDependencies = {
|
|
44
|
+
...baseDevDeps,
|
|
45
|
+
...(options.eslint ? eslintDevDeps : {}),
|
|
46
|
+
};
|
|
29
47
|
const packageJson = {
|
|
30
48
|
name: options.projectName,
|
|
31
49
|
private: true,
|
|
@@ -34,24 +52,15 @@ async function createVitePackageJson(options) {
|
|
|
34
52
|
scripts: {
|
|
35
53
|
dev: "vite",
|
|
36
54
|
build: "tsc && vite build",
|
|
37
|
-
|
|
55
|
+
...(options.eslint && { lint: "eslint ." }),
|
|
38
56
|
preview: "vite preview"
|
|
39
57
|
},
|
|
40
58
|
dependencies: {
|
|
41
|
-
react: "^
|
|
42
|
-
"react-dom": "^
|
|
43
|
-
"@pushchain/ui-kit": "^1.1.
|
|
59
|
+
react: "^19.1.1",
|
|
60
|
+
"react-dom": "^19.1.1",
|
|
61
|
+
"@pushchain/ui-kit": "^1.1.34"
|
|
44
62
|
},
|
|
45
|
-
devDependencies
|
|
46
|
-
"@types/react": "^18.2.43",
|
|
47
|
-
"@types/react-dom": "^18.2.17",
|
|
48
|
-
"@vitejs/plugin-react": "^4.2.1",
|
|
49
|
-
typescript: "^5.2.2",
|
|
50
|
-
vite: "^5.0.8",
|
|
51
|
-
tailwindcss: "^3.3.0",
|
|
52
|
-
autoprefixer: "^10.4.16",
|
|
53
|
-
postcss: "^8.4.31"
|
|
54
|
-
}
|
|
63
|
+
devDependencies,
|
|
55
64
|
};
|
|
56
65
|
// Remove undefined values
|
|
57
66
|
Object.keys(packageJson.scripts).forEach(key => {
|
|
@@ -67,10 +76,11 @@ async function createViteConfig(options) {
|
|
|
67
76
|
const viteConfig = `import { defineConfig } from 'vite'
|
|
68
77
|
import react from '@vitejs/plugin-react'
|
|
69
78
|
import path from 'path'
|
|
79
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
70
80
|
|
|
71
81
|
// https://vitejs.dev/config/
|
|
72
82
|
export default defineConfig({
|
|
73
|
-
plugins: [react()],
|
|
83
|
+
plugins: [react(), tailwindcss()],
|
|
74
84
|
resolve: {
|
|
75
85
|
alias: {
|
|
76
86
|
"@": path.resolve(__dirname, "./src"),
|
|
@@ -80,41 +90,63 @@ export default defineConfig({
|
|
|
80
90
|
await fs.writeFile(path.join(options.targetDir, 'vite.config.ts'), viteConfig);
|
|
81
91
|
// TypeScript config
|
|
82
92
|
const tsConfig = {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
skipLibCheck: true,
|
|
89
|
-
moduleResolution: "bundler",
|
|
90
|
-
allowImportingTsExtensions: true,
|
|
91
|
-
resolveJsonModule: true,
|
|
92
|
-
isolatedModules: true,
|
|
93
|
-
noEmit: true,
|
|
94
|
-
jsx: "react-jsx",
|
|
95
|
-
strict: true,
|
|
96
|
-
noUnusedLocals: true,
|
|
97
|
-
noUnusedParameters: true,
|
|
98
|
-
noFallthroughCasesInSwitch: true,
|
|
99
|
-
baseUrl: ".",
|
|
100
|
-
paths: {
|
|
101
|
-
"@/*": ["./src/*"]
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
include: ["src"],
|
|
105
|
-
references: [{ "path": "./tsconfig.node.json" }]
|
|
93
|
+
"files": [],
|
|
94
|
+
"references": [
|
|
95
|
+
{ "path": "./tsconfig.app.json" },
|
|
96
|
+
{ "path": "./tsconfig.node.json" }
|
|
97
|
+
]
|
|
106
98
|
};
|
|
107
99
|
await fs.writeJSON(path.join(options.targetDir, 'tsconfig.json'), tsConfig, { spaces: 2 });
|
|
100
|
+
// App TypeScript config
|
|
101
|
+
const tsAppConfig = {
|
|
102
|
+
"compilerOptions": {
|
|
103
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
104
|
+
"target": "ES2022",
|
|
105
|
+
"useDefineForClassFields": true,
|
|
106
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
107
|
+
"module": "ESNext",
|
|
108
|
+
"skipLibCheck": true,
|
|
109
|
+
/* Bundler mode */
|
|
110
|
+
"moduleResolution": "bundler",
|
|
111
|
+
"allowImportingTsExtensions": true,
|
|
112
|
+
"verbatimModuleSyntax": true,
|
|
113
|
+
"moduleDetection": "force",
|
|
114
|
+
"noEmit": true,
|
|
115
|
+
"jsx": "react-jsx",
|
|
116
|
+
/* Linting */
|
|
117
|
+
"strict": true,
|
|
118
|
+
"noUnusedLocals": true,
|
|
119
|
+
"noUnusedParameters": true,
|
|
120
|
+
"erasableSyntaxOnly": true,
|
|
121
|
+
"noFallthroughCasesInSwitch": true,
|
|
122
|
+
"noUncheckedSideEffectImports": true
|
|
123
|
+
},
|
|
124
|
+
"include": ["src"]
|
|
125
|
+
};
|
|
126
|
+
await fs.writeJSON(path.join(options.targetDir, 'tsconfig.app.json'), tsAppConfig, { spaces: 2 });
|
|
108
127
|
// Node TypeScript config
|
|
109
128
|
const tsNodeConfig = {
|
|
110
|
-
compilerOptions: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
129
|
+
"compilerOptions": {
|
|
130
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
131
|
+
"target": "ES2023",
|
|
132
|
+
"lib": ["ES2023"],
|
|
133
|
+
"module": "ESNext",
|
|
134
|
+
"skipLibCheck": true,
|
|
135
|
+
/* Bundler mode */
|
|
136
|
+
"moduleResolution": "bundler",
|
|
137
|
+
"allowImportingTsExtensions": true,
|
|
138
|
+
"verbatimModuleSyntax": true,
|
|
139
|
+
"moduleDetection": "force",
|
|
140
|
+
"noEmit": true,
|
|
141
|
+
/* Linting */
|
|
142
|
+
"strict": true,
|
|
143
|
+
"noUnusedLocals": true,
|
|
144
|
+
"noUnusedParameters": true,
|
|
145
|
+
"erasableSyntaxOnly": true,
|
|
146
|
+
"noFallthroughCasesInSwitch": true,
|
|
147
|
+
"noUncheckedSideEffectImports": true
|
|
116
148
|
},
|
|
117
|
-
include: ["vite.config.ts"]
|
|
149
|
+
"include": ["vite.config.ts"]
|
|
118
150
|
};
|
|
119
151
|
await fs.writeJSON(path.join(options.targetDir, 'tsconfig.node.json'), tsNodeConfig, { spaces: 2 });
|
|
120
152
|
}
|
|
@@ -279,9 +311,7 @@ export default App`;
|
|
|
279
311
|
}`;
|
|
280
312
|
await fs.writeFile(path.join(srcDir, 'App.css'), appCss);
|
|
281
313
|
// Create index.css (Tailwind directives only)
|
|
282
|
-
const indexCss = `@
|
|
283
|
-
@tailwind components;
|
|
284
|
-
@tailwind utilities;
|
|
314
|
+
const indexCss = `@import "tailwindcss";
|
|
285
315
|
|
|
286
316
|
:root {
|
|
287
317
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
@@ -476,309 +506,33 @@ VITE_PUSHCHAIN_NETWORK=testnet
|
|
|
476
506
|
# VITE_APP_VERSION=1.0.0`;
|
|
477
507
|
await fs.writeFile(path.join(options.targetDir, '.env'), envFile);
|
|
478
508
|
}
|
|
479
|
-
async function createESLintConfig(options) {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
rules: {
|
|
492
|
-
'react-refresh/only-export-components': [
|
|
493
|
-
'warn',
|
|
494
|
-
{ allowConstantExport: true },
|
|
495
|
-
],
|
|
496
|
-
},
|
|
497
|
-
};
|
|
498
|
-
await fs.writeJSON(path.join(options.targetDir, '.eslintrc.json'), eslintConfig, { spaces: 2 });
|
|
499
|
-
}
|
|
500
|
-
async function createTailwindConfig(options) {
|
|
501
|
-
const tailwindConfig = `/** @type {import('tailwindcss').Config} */
|
|
502
|
-
export default {
|
|
503
|
-
darkMode: ["class"],
|
|
504
|
-
content: [
|
|
505
|
-
"./index.html",
|
|
506
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
507
|
-
],
|
|
508
|
-
theme: {
|
|
509
|
-
container: {
|
|
510
|
-
center: true,
|
|
511
|
-
padding: "2rem",
|
|
512
|
-
screens: {
|
|
513
|
-
"2xl": "1400px",
|
|
514
|
-
},
|
|
515
|
-
},
|
|
516
|
-
extend: {
|
|
517
|
-
colors: {
|
|
518
|
-
border: "hsl(var(--border))",
|
|
519
|
-
input: "hsl(var(--input))",
|
|
520
|
-
ring: "hsl(var(--ring))",
|
|
521
|
-
background: "hsl(var(--background))",
|
|
522
|
-
foreground: "hsl(var(--foreground))",
|
|
523
|
-
primary: {
|
|
524
|
-
DEFAULT: "hsl(var(--primary))",
|
|
525
|
-
foreground: "hsl(var(--primary-foreground))",
|
|
526
|
-
},
|
|
527
|
-
secondary: {
|
|
528
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
529
|
-
foreground: "hsl(var(--secondary-foreground))",
|
|
530
|
-
},
|
|
531
|
-
destructive: {
|
|
532
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
533
|
-
foreground: "hsl(var(--destructive-foreground))",
|
|
534
|
-
},
|
|
535
|
-
muted: {
|
|
536
|
-
DEFAULT: "hsl(var(--muted))",
|
|
537
|
-
foreground: "hsl(var(--muted-foreground))",
|
|
538
|
-
},
|
|
539
|
-
accent: {
|
|
540
|
-
DEFAULT: "hsl(var(--accent))",
|
|
541
|
-
foreground: "hsl(var(--accent-foreground))",
|
|
542
|
-
},
|
|
543
|
-
popover: {
|
|
544
|
-
DEFAULT: "hsl(var(--popover))",
|
|
545
|
-
foreground: "hsl(var(--popover-foreground))",
|
|
546
|
-
},
|
|
547
|
-
card: {
|
|
548
|
-
DEFAULT: "hsl(var(--card))",
|
|
549
|
-
foreground: "hsl(var(--card-foreground))",
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
borderRadius: {
|
|
553
|
-
lg: "var(--radius)",
|
|
554
|
-
md: "calc(var(--radius) - 2px)",
|
|
555
|
-
sm: "calc(var(--radius) - 4px)",
|
|
556
|
-
},
|
|
557
|
-
keyframes: {
|
|
558
|
-
"accordion-down": {
|
|
559
|
-
from: { height: 0 },
|
|
560
|
-
to: { height: "var(--radix-accordion-content-height)" },
|
|
561
|
-
},
|
|
562
|
-
"accordion-up": {
|
|
563
|
-
from: { height: "var(--radix-accordion-content-height)" },
|
|
564
|
-
to: { height: 0 },
|
|
565
|
-
},
|
|
566
|
-
},
|
|
567
|
-
animation: {
|
|
568
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
|
569
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
|
570
|
-
},
|
|
571
|
-
},
|
|
572
|
-
},
|
|
573
|
-
plugins: [require("tailwindcss-animate")],
|
|
574
|
-
}`;
|
|
575
|
-
await fs.writeFile(path.join(options.targetDir, 'tailwind.config.js'), tailwindConfig);
|
|
576
|
-
// PostCSS config
|
|
577
|
-
const postcssConfig = `export default {
|
|
578
|
-
plugins: {
|
|
579
|
-
tailwindcss: {},
|
|
580
|
-
autoprefixer: {},
|
|
581
|
-
},
|
|
582
|
-
}`;
|
|
583
|
-
await fs.writeFile(path.join(options.targetDir, 'postcss.config.js'), postcssConfig);
|
|
584
|
-
}
|
|
585
|
-
async function createShadcnConfig(options) {
|
|
586
|
-
const componentsJson = {
|
|
587
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
588
|
-
"style": "default",
|
|
589
|
-
"rsc": false,
|
|
590
|
-
"tsx": true,
|
|
591
|
-
"tailwind": {
|
|
592
|
-
"config": "tailwind.config.js",
|
|
593
|
-
"css": "src/index.css",
|
|
594
|
-
"baseColor": "slate",
|
|
595
|
-
"cssVariables": true
|
|
596
|
-
},
|
|
597
|
-
"aliases": {
|
|
598
|
-
"components": "@/components",
|
|
599
|
-
"utils": "@/lib/utils"
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
await fs.writeJSON(path.join(options.targetDir, 'components.json'), componentsJson, { spaces: 2 });
|
|
603
|
-
// Create basic shadcn components (same as Next.js version)
|
|
604
|
-
const componentsDir = path.join(options.targetDir, 'src', 'components', 'ui');
|
|
605
|
-
await fs.ensureDir(componentsDir);
|
|
606
|
-
// Button component (same as Next.js)
|
|
607
|
-
const buttonComponent = `import * as React from "react"
|
|
608
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
609
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
610
|
-
|
|
611
|
-
import { cn } from "@/lib/utils"
|
|
612
|
-
|
|
613
|
-
const buttonVariants = cva(
|
|
614
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
615
|
-
{
|
|
616
|
-
variants: {
|
|
617
|
-
variant: {
|
|
618
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
619
|
-
destructive:
|
|
620
|
-
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
621
|
-
outline:
|
|
622
|
-
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
623
|
-
secondary:
|
|
624
|
-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
625
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
626
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
627
|
-
},
|
|
628
|
-
size: {
|
|
629
|
-
default: "h-10 px-4 py-2",
|
|
630
|
-
sm: "h-9 rounded-md px-3",
|
|
631
|
-
lg: "h-11 rounded-md px-8",
|
|
632
|
-
icon: "h-10 w-10",
|
|
633
|
-
},
|
|
634
|
-
},
|
|
635
|
-
defaultVariants: {
|
|
636
|
-
variant: "default",
|
|
637
|
-
size: "default",
|
|
638
|
-
},
|
|
639
|
-
}
|
|
640
|
-
)
|
|
641
|
-
|
|
642
|
-
export interface ButtonProps
|
|
643
|
-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
644
|
-
VariantProps<typeof buttonVariants> {
|
|
645
|
-
asChild?: boolean
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
649
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
650
|
-
const Comp = asChild ? Slot : "button"
|
|
651
|
-
return (
|
|
652
|
-
<Comp
|
|
653
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
654
|
-
ref={ref}
|
|
655
|
-
{...props}
|
|
656
|
-
/>
|
|
657
|
-
)
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
Button.displayName = "Button"
|
|
661
|
-
|
|
662
|
-
export { Button, buttonVariants }`;
|
|
663
|
-
await fs.writeFile(path.join(componentsDir, 'button.tsx'), buttonComponent);
|
|
664
|
-
// Card and Badge components (same as Next.js)
|
|
665
|
-
const cardComponent = `import * as React from "react"
|
|
666
|
-
|
|
667
|
-
import { cn } from "@/lib/utils"
|
|
668
|
-
|
|
669
|
-
const Card = React.forwardRef<
|
|
670
|
-
HTMLDivElement,
|
|
671
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
672
|
-
>(({ className, ...props }, ref) => (
|
|
673
|
-
<div
|
|
674
|
-
ref={ref}
|
|
675
|
-
className={cn(
|
|
676
|
-
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
677
|
-
className
|
|
678
|
-
)}
|
|
679
|
-
{...props}
|
|
680
|
-
/>
|
|
681
|
-
))
|
|
682
|
-
Card.displayName = "Card"
|
|
683
|
-
|
|
684
|
-
const CardHeader = React.forwardRef<
|
|
685
|
-
HTMLDivElement,
|
|
686
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
687
|
-
>(({ className, ...props }, ref) => (
|
|
688
|
-
<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
|
|
689
|
-
))
|
|
690
|
-
CardHeader.displayName = "CardHeader"
|
|
691
|
-
|
|
692
|
-
const CardTitle = React.forwardRef<
|
|
693
|
-
HTMLParagraphElement,
|
|
694
|
-
React.HTMLAttributes<HTMLHeadingElement>
|
|
695
|
-
>(({ className, ...props }, ref) => (
|
|
696
|
-
<h3
|
|
697
|
-
ref={ref}
|
|
698
|
-
className={cn(
|
|
699
|
-
"text-2xl font-semibold leading-none tracking-tight",
|
|
700
|
-
className
|
|
701
|
-
)}
|
|
702
|
-
{...props}
|
|
703
|
-
/>
|
|
704
|
-
))
|
|
705
|
-
CardTitle.displayName = "CardTitle"
|
|
706
|
-
|
|
707
|
-
const CardDescription = React.forwardRef<
|
|
708
|
-
HTMLParagraphElement,
|
|
709
|
-
React.HTMLAttributes<HTMLParagraphElement>
|
|
710
|
-
>(({ className, ...props }, ref) => (
|
|
711
|
-
<p
|
|
712
|
-
ref={ref}
|
|
713
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
714
|
-
{...props}
|
|
715
|
-
/>
|
|
716
|
-
))
|
|
717
|
-
CardDescription.displayName = "CardDescription"
|
|
718
|
-
|
|
719
|
-
const CardContent = React.forwardRef<
|
|
720
|
-
HTMLDivElement,
|
|
721
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
722
|
-
>(({ className, ...props }, ref) => (
|
|
723
|
-
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
724
|
-
))
|
|
725
|
-
CardContent.displayName = "CardContent"
|
|
726
|
-
|
|
727
|
-
const CardFooter = React.forwardRef<
|
|
728
|
-
HTMLDivElement,
|
|
729
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
730
|
-
>(({ className, ...props }, ref) => (
|
|
731
|
-
<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
|
|
732
|
-
))
|
|
733
|
-
CardFooter.displayName = "CardFooter"
|
|
734
|
-
|
|
735
|
-
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }`;
|
|
736
|
-
await fs.writeFile(path.join(componentsDir, 'card.tsx'), cardComponent);
|
|
737
|
-
const badgeComponent = `import * as React from "react"
|
|
738
|
-
import { cva, type VariantProps } from "class-variance-authority"
|
|
739
|
-
|
|
740
|
-
import { cn } from "@/lib/utils"
|
|
741
|
-
|
|
742
|
-
const badgeVariants = cva(
|
|
743
|
-
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
509
|
+
export async function createESLintConfig(options) {
|
|
510
|
+
if (!options.eslint)
|
|
511
|
+
return;
|
|
512
|
+
const config = `import js from '@eslint/js'
|
|
513
|
+
import globals from 'globals'
|
|
514
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
515
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
516
|
+
import tseslint from 'typescript-eslint'
|
|
517
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
518
|
+
|
|
519
|
+
export default defineConfig([
|
|
520
|
+
globalIgnores(['dist']),
|
|
744
521
|
{
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
},
|
|
756
|
-
defaultVariants: {
|
|
757
|
-
variant: "default",
|
|
522
|
+
files: ['**/*.{ts,tsx}'],
|
|
523
|
+
extends: [
|
|
524
|
+
js.configs.recommended,
|
|
525
|
+
tseslint.configs.recommended,
|
|
526
|
+
reactHooks.configs['recommended-latest'],
|
|
527
|
+
reactRefresh.configs.vite,
|
|
528
|
+
],
|
|
529
|
+
languageOptions: {
|
|
530
|
+
ecmaVersion: 2020,
|
|
531
|
+
globals: globals.browser,
|
|
758
532
|
},
|
|
759
|
-
}
|
|
760
|
-
)
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
extends React.HTMLAttributes<HTMLDivElement>,
|
|
764
|
-
VariantProps<typeof badgeVariants> {}
|
|
765
|
-
|
|
766
|
-
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
767
|
-
return (
|
|
768
|
-
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
769
|
-
)
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
export { Badge, badgeVariants }`;
|
|
773
|
-
await fs.writeFile(path.join(componentsDir, 'badge.tsx'), badgeComponent);
|
|
774
|
-
// Utils file (same as Next.js)
|
|
775
|
-
const libDir = path.join(options.targetDir, 'src', 'lib');
|
|
776
|
-
const utilsFile = `import { type ClassValue, clsx } from "clsx"
|
|
777
|
-
import { twMerge } from "tailwind-merge"
|
|
778
|
-
|
|
779
|
-
export function cn(...inputs: ClassValue[]) {
|
|
780
|
-
return twMerge(clsx(inputs))
|
|
781
|
-
}`;
|
|
782
|
-
await fs.writeFile(path.join(libDir, 'utils.ts'), utilsFile);
|
|
533
|
+
},
|
|
534
|
+
])
|
|
535
|
+
`;
|
|
536
|
+
await fs.writeFile(path.join(options.targetDir, 'eslint.config.js'), config);
|
|
783
537
|
}
|
|
784
538
|
//# sourceMappingURL=vite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../../src/templates/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,4BAA4B,CAAC,CAAC,KAAK,EAAE,CAAC;IAE1D,IAAI,CAAC;QACH,sBAAsB;QACtB,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAErC,kCAAkC;QAClC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhC,0BAA0B;QAC1B,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAErC,sCAAsC;QACtC,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAE1C,oCAAoC;QACpC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QAED
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../../src/templates/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,4BAA4B,CAAC,CAAC,KAAK,EAAE,CAAC;IAE1D,IAAI,CAAC;QACH,sBAAsB;QACtB,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAErC,kCAAkC;QAClC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhC,0BAA0B;QAC1B,MAAM,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAErC,sCAAsC;QACtC,MAAM,0BAA0B,CAAC,O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AE1F,4CAA4C;IAC5C,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;kBAeA,OAAO,CAAC,WAAW;yBACZ,CAAC;IAExB,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAAuB;IAC9D,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAM;IAE3B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBhB,CAAA;IAEC,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC,EAChD,MAAM,CACP,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-universal-dapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI tool to scaffold Push Chain universal applications with Next.js or Vite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,26 +23,28 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
|
-
"push-chain",
|
|
27
|
-
"cli",
|
|
28
|
-
"scaffold",
|
|
29
|
-
"nextjs",
|
|
30
|
-
"vite",
|
|
31
|
-
"react",
|
|
26
|
+
"push-chain",
|
|
27
|
+
"cli",
|
|
28
|
+
"scaffold",
|
|
29
|
+
"nextjs",
|
|
30
|
+
"vite",
|
|
31
|
+
"react",
|
|
32
32
|
"universal-app",
|
|
33
33
|
"blockchain",
|
|
34
34
|
"web3",
|
|
35
35
|
"universal-wallet"
|
|
36
36
|
],
|
|
37
|
-
"
|
|
37
|
+
"authors": [
|
|
38
|
+
"https://github.com/riyanshu-patro"
|
|
39
|
+
],
|
|
38
40
|
"license": "MIT",
|
|
39
41
|
"repository": {
|
|
40
42
|
"type": "git",
|
|
41
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/pushchain/create-universal-dapp.git"
|
|
42
44
|
},
|
|
43
|
-
"homepage": "https://github.com/
|
|
45
|
+
"homepage": "https://github.com/pushchain/create-universal-dapp#readme",
|
|
44
46
|
"bugs": {
|
|
45
|
-
"url": "https://github.com/
|
|
47
|
+
"url": "https://github.com/pushchain/create-universal-dapp/issues"
|
|
46
48
|
},
|
|
47
49
|
"engines": {
|
|
48
50
|
"node": ">=16.0.0",
|