weloop-kosign 1.1.3 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weloop-kosign",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "CLI tool for installing Weloop UI components",
5
5
  "keywords": [
6
6
  "weloop",
@@ -1493,6 +1493,305 @@ async function initProject() {
1493
1493
  return;
1494
1494
  }
1495
1495
 
1496
+ // Step 3: Setup project structure based on shadcn/ui + Next.js
1497
+ info('\nšŸ—ļø Setting up project structure...');
1498
+
1499
+ // Create basic Next.js project structure
1500
+ const directories = [
1501
+ 'app',
1502
+ 'components',
1503
+ 'components/ui',
1504
+ 'lib',
1505
+ 'hooks',
1506
+ 'types',
1507
+ 'public',
1508
+ 'public/icons'
1509
+ ];
1510
+
1511
+ directories.forEach(dir => {
1512
+ const dirPath = path.join(process.cwd(), dir);
1513
+ if (!fs.existsSync(dirPath)) {
1514
+ fs.mkdirSync(dirPath, { recursive: true });
1515
+ info(` → Created ${dir}/ directory`);
1516
+ }
1517
+ });
1518
+
1519
+ // Create Next.js app structure files
1520
+ const appFiles = {
1521
+ 'app/layout.tsx': `import type { Metadata } from "next";
1522
+ import { Inter } from "next/font/google";
1523
+ import "./globals.css";
1524
+
1525
+ const inter = Inter({ subsets: ["latin"] });
1526
+
1527
+ export const metadata: Metadata = {
1528
+ title: "${projectName}",
1529
+ description: "Built with Weloop Design System",
1530
+ };
1531
+
1532
+ export default function RootLayout({
1533
+ children,
1534
+ }: {
1535
+ children: React.ReactNode;
1536
+ }) {
1537
+ return (
1538
+ <html lang="en">
1539
+ <body className={inter.className}>{children}</body>
1540
+ </html>
1541
+ );
1542
+ }`,
1543
+ 'app/page.tsx': `export default function Home() {
1544
+ return (
1545
+ <main className="flex min-h-screen flex-col items-center justify-between p-24">
1546
+ <div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
1547
+ <h1 className="text-4xl font-bold">
1548
+ Welcome to ${projectName}
1549
+ </h1>
1550
+ </div>
1551
+ </main>
1552
+ );
1553
+ }`,
1554
+ 'app/globals.css': `@tailwind base;
1555
+ @tailwind components;
1556
+ @tailwind utilities;
1557
+
1558
+ @layer base {
1559
+ :root {
1560
+ --background: 0 0% 100%;
1561
+ --foreground: 222.2 84% 4.9%;
1562
+ --card: 0 0% 100%;
1563
+ --card-foreground: 222.2 84% 4.9%;
1564
+ --popover: 0 0% 100%;
1565
+ --popover-foreground: 222.2 84% 4.9%;
1566
+ --primary: 222.2 47.4% 11.2%;
1567
+ --primary-foreground: 210 40% 98%;
1568
+ --secondary: 210 40% 96%;
1569
+ --secondary-foreground: 222.2 84% 4.9%;
1570
+ --muted: 210 40% 96%;
1571
+ --muted-foreground: 215.4 16.3% 46.9%;
1572
+ --accent: 210 40% 96%;
1573
+ --accent-foreground: 222.2 84% 4.9%;
1574
+ --destructive: 0 84.2% 60.2%;
1575
+ --destructive-foreground: 210 40% 98%;
1576
+ --border: 214.3 31.8% 91.4%;
1577
+ --input: 214.3 31.8% 91.4%;
1578
+ --ring: 222.2 84% 4.9%;
1579
+ --radius: ${selectedRadius.replace('px', '')};
1580
+ --chart-1: 12 76% 61%;
1581
+ --chart-2: 173 58% 39%;
1582
+ --chart-3: 197 37% 24%;
1583
+ --chart-4: 43 74% 66%;
1584
+ --chart-5: 27 87% 67%;
1585
+ }
1586
+
1587
+ .dark {
1588
+ --background: 222.2 84% 4.9%;
1589
+ --foreground: 210 40% 98%;
1590
+ --card: 222.2 84% 4.9%;
1591
+ --card-foreground: 210 40% 98%;
1592
+ --popover: 222.2 84% 4.9%;
1593
+ --popover-foreground: 210 40% 98%;
1594
+ --primary: 210 40% 98%;
1595
+ --primary-foreground: 222.2 47.4% 11.2%;
1596
+ --secondary: 217.2 32.6% 17.5%;
1597
+ --secondary-foreground: 210 40% 98%;
1598
+ --muted: 217.2 32.6% 17.5%;
1599
+ --muted-foreground: 215 20.2% 65.1%;
1600
+ --accent: 217.2 32.6% 17.5%;
1601
+ --accent-foreground: 210 40% 98%;
1602
+ --destructive: 0 62.8% 30.6%;
1603
+ --destructive-foreground: 210 40% 98%;
1604
+ --border: 217.2 32.6% 17.5%;
1605
+ --input: 217.2 32.6% 17.5%;
1606
+ --ring: 212.7 26.8% 83.9%;
1607
+ --chart-1: 220 70% 50%;
1608
+ --chart-2: 160 60% 45%;
1609
+ --chart-3: 30 80% 55%;
1610
+ --chart-4: 280 65% 60%;
1611
+ --chart-5: 340 75% 55%;
1612
+ }
1613
+ }
1614
+
1615
+ @layer base {
1616
+ * {
1617
+ @apply border-border;
1618
+ }
1619
+ body {
1620
+ @apply bg-background text-foreground;
1621
+ }
1622
+ }`,
1623
+ 'next.config.mjs': `/** @type {import('next').NextConfig} */
1624
+ const nextConfig = {
1625
+ experimental: {
1626
+ appDir: true,
1627
+ },
1628
+ };
1629
+
1630
+ export default nextConfig;`,
1631
+ 'tailwind.config.ts': `import type { Config } from "tailwindcss";
1632
+
1633
+ const config: Config = {
1634
+ darkMode: ["class"],
1635
+ content: [
1636
+ "./pages/**/*.{ts,tsx}",
1637
+ "./components/**/*.{ts,tsx}",
1638
+ "./app/**/*.{ts,tsx}",
1639
+ "./src/**/*.{ts,tsx}",
1640
+ ],
1641
+ prefix: "",
1642
+ theme: {
1643
+ container: {
1644
+ center: true,
1645
+ padding: "2rem",
1646
+ screens: {
1647
+ "2xl": "1400px",
1648
+ },
1649
+ },
1650
+ extend: {
1651
+ colors: {
1652
+ border: "hsl(var(--border))",
1653
+ input: "hsl(var(--input))",
1654
+ ring: "hsl(var(--ring))",
1655
+ background: "hsl(var(--background))",
1656
+ foreground: "hsl(var(--foreground))",
1657
+ primary: {
1658
+ DEFAULT: "hsl(var(--primary))",
1659
+ foreground: "hsl(var(--primary-foreground))",
1660
+ },
1661
+ secondary: {
1662
+ DEFAULT: "hsl(var(--secondary))",
1663
+ foreground: "hsl(var(--secondary-foreground))",
1664
+ },
1665
+ destructive: {
1666
+ DEFAULT: "hsl(var(--destructive))",
1667
+ foreground: "hsl(var(--destructive-foreground))",
1668
+ },
1669
+ muted: {
1670
+ DEFAULT: "hsl(var(--muted))",
1671
+ foreground: "hsl(var(--muted-foreground))",
1672
+ },
1673
+ accent: {
1674
+ DEFAULT: "hsl(var(--accent))",
1675
+ foreground: "hsl(var(--accent-foreground))",
1676
+ },
1677
+ popover: {
1678
+ DEFAULT: "hsl(var(--popover))",
1679
+ foreground: "hsl(var(--popover-foreground))",
1680
+ },
1681
+ card: {
1682
+ DEFAULT: "hsl(var(--card))",
1683
+ foreground: "hsl(var(--card-foreground))",
1684
+ },
1685
+ },
1686
+ borderRadius: {
1687
+ lg: "var(--radius)",
1688
+ md: "calc(var(--radius) - 2px)",
1689
+ sm: "calc(var(--radius) - 4px)",
1690
+ },
1691
+ keyframes: {
1692
+ "accordion-down": {
1693
+ from: { height: "0" },
1694
+ to: { height: "var(--radix-accordion-content-height)" },
1695
+ },
1696
+ "accordion-up": {
1697
+ from: { height: "var(--radix-accordion-content-height)" },
1698
+ to: { height: "0" },
1699
+ },
1700
+ },
1701
+ animation: {
1702
+ "accordion-down": "accordion-down 0.2s ease-out",
1703
+ "accordion-up": "accordion-up 0.2s ease-out",
1704
+ },
1705
+ },
1706
+ },
1707
+ plugins: [require("tailwindcss-animate")],
1708
+ } satisfies Config;
1709
+
1710
+ export default config;`,
1711
+ 'tsconfig.json': `{
1712
+ "compilerOptions": {
1713
+ "target": "es5",
1714
+ "lib": ["dom", "dom.iterable", "es6"],
1715
+ "allowJs": true,
1716
+ "skipLibCheck": true,
1717
+ "strict": true,
1718
+ "noEmit": true,
1719
+ "esModuleInterop": true,
1720
+ "module": "esnext",
1721
+ "moduleResolution": "bundler",
1722
+ "resolveJsonModule": true,
1723
+ "isolatedModules": true,
1724
+ "jsx": "preserve",
1725
+ "incremental": true,
1726
+ "plugins": [
1727
+ {
1728
+ "name": "next"
1729
+ }
1730
+ ],
1731
+ "baseUrl": ".",
1732
+ "paths": {
1733
+ "@/*": ["./*"]
1734
+ }
1735
+ },
1736
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
1737
+ "exclude": ["node_modules"]
1738
+ }`,
1739
+ '.eslintrc.json': `{
1740
+ "extends": ["next/core-web-vitals", "next/typescript"]
1741
+ }`
1742
+ };
1743
+
1744
+ // Create files
1745
+ Object.entries(appFiles).forEach(([filePath, content]) => {
1746
+ const fullPath = path.join(process.cwd(), filePath);
1747
+ if (!fs.existsSync(fullPath)) {
1748
+ fs.writeFileSync(fullPath, content);
1749
+ info(` → Created ${filePath}`);
1750
+ }
1751
+ });
1752
+
1753
+ // Create or update package.json for Next.js project
1754
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
1755
+ let packageJson = { dependencies: {}, devDependencies: {} };
1756
+
1757
+ if (fs.existsSync(packageJsonPath)) {
1758
+ packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
1759
+ }
1760
+
1761
+ // Update package.json with Next.js dependencies
1762
+ const nextDependencies = {
1763
+ "next": "^14.0.0",
1764
+ "react": "^18.0.0",
1765
+ "react-dom": "^18.0.0",
1766
+ "typescript": "^5.0.0",
1767
+ "@types/node": "^20.0.0",
1768
+ "@types/react": "^18.0.0",
1769
+ "@types/react-dom": "^18.0.0",
1770
+ "tailwindcss": "^3.3.0",
1771
+ "autoprefixer": "^10.0.0",
1772
+ "postcss": "^8.0.0",
1773
+ "tailwindcss-animate": "^1.0.7",
1774
+ "eslint": "^8.0.0",
1775
+ "eslint-config-next": "^14.0.0"
1776
+ };
1777
+
1778
+ packageJson.name = projectName;
1779
+ packageJson.version = "0.1.0";
1780
+ packageJson.private = true;
1781
+ packageJson.scripts = {
1782
+ "dev": "next dev",
1783
+ "build": "next build",
1784
+ "start": "next start",
1785
+ "lint": "next lint"
1786
+ };
1787
+
1788
+ // Merge dependencies
1789
+ Object.assign(packageJson.dependencies || {}, nextDependencies);
1790
+ Object.assign(packageJson.devDependencies || {}, {});
1791
+
1792
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
1793
+ info(` → Updated package.json`);
1794
+
1496
1795
  // Detect CSS path based on project type
1497
1796
  let cssPath = PATHS.APP_GLOBALS_CSS;
1498
1797
  if (isVite) {
@@ -1538,11 +1837,7 @@ async function initProject() {
1538
1837
  info(' → [:root]/components.json');
1539
1838
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
1540
1839
 
1541
- // Step 2: Update CSS variables
1542
- info(' → [:root]/app/globals.css (Updating css variables)');
1543
- await installCSSStyles(config, DEFAULT_REGISTRY_URL, false, false);
1544
-
1545
- // Step 3: Install dependencies
1840
+ // Step 2: Install dependencies
1546
1841
  info(' → Installing dependencies');
1547
1842
  const missingBaseDeps = BASE_DEPENDENCIES.filter(dep => !checkPackageInstalled(dep));
1548
1843
 
@@ -1550,12 +1845,25 @@ async function initProject() {
1550
1845
  await installPackages(missingBaseDeps);
1551
1846
  }
1552
1847
 
1848
+ // Install Next.js dependencies if not present
1849
+ const nextDeps = [
1850
+ "next", "react", "react-dom", "typescript",
1851
+ "@types/node", "@types/react", "@types/react-dom",
1852
+ "tailwindcss", "autoprefixer", "postcss",
1853
+ "tailwindcss-animate", "eslint", "eslint-config-next"
1854
+ ];
1855
+
1856
+ const missingNextDeps = nextDeps.filter(dep => !checkPackageInstalled(dep));
1857
+ if (missingNextDeps.length > 0) {
1858
+ await installPackages(missingNextDeps);
1859
+ }
1860
+
1553
1861
  // Install tw-animate-css for animations
1554
1862
  if (!checkPackageInstalled(PACKAGE_NAMES.TW_ANIMATE_CSS)) {
1555
1863
  await installPackages([PACKAGE_NAMES.TW_ANIMATE_CSS]);
1556
1864
  }
1557
1865
 
1558
- // Step 4: Create utils.ts file
1866
+ // Step 3: Create utils.ts file
1559
1867
  info(' → Create 1 files:');
1560
1868
  const utilsPath = path.join(process.cwd(), 'lib', 'utils.ts');
1561
1869
  createUtilsFile(utilsPath);