@emberkit/cli 0.2.5 → 0.3.1
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/dist/commands/create.js +284 -1
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -574,7 +574,8 @@ export async function create(options) {
|
|
|
574
574
|
packageName: getNpmPackageName(name),
|
|
575
575
|
kebabName: toKebabCase(name),
|
|
576
576
|
};
|
|
577
|
-
|
|
577
|
+
const templateFiles = templateId === "with-ui" ? withUiTemplate : starterFiles;
|
|
578
|
+
for (const [filePath, content] of Object.entries(templateFiles)) {
|
|
578
579
|
const fullPath = join(targetDir, filePath);
|
|
579
580
|
const dir = join(targetDir, filePath.split("/").slice(0, -1).join("/"));
|
|
580
581
|
if (!existsSync(dir)) {
|
|
@@ -612,3 +613,285 @@ export async function create(options) {
|
|
|
612
613
|
console.log(` ${DIM}To preview the build:${RESET}`);
|
|
613
614
|
console.log(` ${BRIGHT_CYAN}emberkit preview${RESET}\n`);
|
|
614
615
|
}
|
|
616
|
+
const withUiTemplate = {
|
|
617
|
+
"package.json": `{
|
|
618
|
+
"name": "{{name}}",
|
|
619
|
+
"version": "0.1.0",
|
|
620
|
+
"private": true,
|
|
621
|
+
"type": "module",
|
|
622
|
+
"scripts": {
|
|
623
|
+
"dev": "emberkit dev",
|
|
624
|
+
"build": "emberkit build",
|
|
625
|
+
"preview": "emberkit preview",
|
|
626
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
627
|
+
"format": "prettier --write \\"src/**/*.{ts,tsx}\\""
|
|
628
|
+
},
|
|
629
|
+
"dependencies": {
|
|
630
|
+
"@emberkit/core": "^0.2.4",
|
|
631
|
+
"@emberkit/ui": "^0.2.3"
|
|
632
|
+
},
|
|
633
|
+
"devDependencies": {
|
|
634
|
+
"@emberkit/cli": "^0.2.4",
|
|
635
|
+
"typescript": "^5.7.0",
|
|
636
|
+
"vite": "^6.0.0",
|
|
637
|
+
"tailwindcss": "^4.0.0",
|
|
638
|
+
"@tailwindcss/vite": "^4.0.0"
|
|
639
|
+
}
|
|
640
|
+
}`,
|
|
641
|
+
"tsconfig.json": `{
|
|
642
|
+
"compilerOptions": {
|
|
643
|
+
"target": "ES2022",
|
|
644
|
+
"module": "ESNext",
|
|
645
|
+
"moduleResolution": "bundler",
|
|
646
|
+
"jsx": "react-jsx",
|
|
647
|
+
"jsxImportSource": "@emberkit/core",
|
|
648
|
+
"strict": true,
|
|
649
|
+
"esModuleInterop": true,
|
|
650
|
+
"skipLibCheck": true,
|
|
651
|
+
"forceConsistentCasingInFileNames": true,
|
|
652
|
+
"resolveJsonModule": true,
|
|
653
|
+
"isolatedModules": true,
|
|
654
|
+
"noEmit": true,
|
|
655
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
656
|
+
"paths": {
|
|
657
|
+
"@/*": ["./src/*"]
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
"include": ["src"],
|
|
661
|
+
"exclude": ["node_modules", "dist"]
|
|
662
|
+
}`,
|
|
663
|
+
"emberkit.config.ts": `import { defineConfig } from '@emberkit/core';
|
|
664
|
+
|
|
665
|
+
export default defineConfig({
|
|
666
|
+
mode: 'spa',
|
|
667
|
+
build: {
|
|
668
|
+
outDir: 'dist',
|
|
669
|
+
target: 'esnext',
|
|
670
|
+
},
|
|
671
|
+
});`,
|
|
672
|
+
"vite.config.ts": `import { defineConfig } from 'vite';
|
|
673
|
+
import { emberkitVitePlugin } from '@emberkit/core/vite-plugin';
|
|
674
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
675
|
+
|
|
676
|
+
export default defineConfig({
|
|
677
|
+
plugins: [emberkitVitePlugin(), tailwindcss()],
|
|
678
|
+
server: {
|
|
679
|
+
port: 3000,
|
|
680
|
+
host: 'localhost',
|
|
681
|
+
},
|
|
682
|
+
esbuild: {
|
|
683
|
+
jsxImportSource: '@emberkit/core',
|
|
684
|
+
},
|
|
685
|
+
});`,
|
|
686
|
+
"index.html": `<!DOCTYPE html>
|
|
687
|
+
<html lang="en">
|
|
688
|
+
<head>
|
|
689
|
+
<meta charset="UTF-8">
|
|
690
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
691
|
+
<title>{{name}}</title>
|
|
692
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
693
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
694
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
695
|
+
<link href="/styles.css" rel="stylesheet">
|
|
696
|
+
</head>
|
|
697
|
+
<body>
|
|
698
|
+
<div id="app"></div>
|
|
699
|
+
<script type="module" src="/src/index.tsx"></script>
|
|
700
|
+
</body>
|
|
701
|
+
</html>`,
|
|
702
|
+
"src/index.tsx": `import { render } from '@emberkit/core';
|
|
703
|
+
import App from './routes/_layout';
|
|
704
|
+
|
|
705
|
+
const root = document.getElementById('app');
|
|
706
|
+
|
|
707
|
+
if (root) {
|
|
708
|
+
render(App, root);
|
|
709
|
+
}`,
|
|
710
|
+
"src/styles.css": `@import "tailwindcss";
|
|
711
|
+
|
|
712
|
+
@theme {
|
|
713
|
+
--color-ember-50: #fff7ed;
|
|
714
|
+
--color-ember-100: #ffedd5;
|
|
715
|
+
--color-ember-200: #fed7aa;
|
|
716
|
+
--color-ember-300: #fdba74;
|
|
717
|
+
--color-ember-400: #fb923c;
|
|
718
|
+
--color-ember-500: #f97316;
|
|
719
|
+
--color-ember-600: #ea580c;
|
|
720
|
+
--color-ember-700: #c2410c;
|
|
721
|
+
--color-ember-800: #9a3412;
|
|
722
|
+
--color-ember-900: #7c2d12;
|
|
723
|
+
--font-family-sans: 'Inter', system-ui, sans-serif;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
body {
|
|
727
|
+
@apply bg-slate-900 text-slate-200 font-sans;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
a {
|
|
731
|
+
@apply text-inherit no-underline;
|
|
732
|
+
}`,
|
|
733
|
+
"src/routes/_layout.tsx": `import type { RouteComponent } from '@emberkit/core';
|
|
734
|
+
import { Head } from '@emberkit/core';
|
|
735
|
+
import { DefaultLayout } from '@emberkit/ui';
|
|
736
|
+
|
|
737
|
+
const Layout: RouteComponent = ({ children }) => {
|
|
738
|
+
return (
|
|
739
|
+
<>
|
|
740
|
+
<Head>
|
|
741
|
+
<title>{{name}}</title>
|
|
742
|
+
<meta name="description" content="Built with EmberKit UI" />
|
|
743
|
+
</Head>
|
|
744
|
+
<DefaultLayout
|
|
745
|
+
logo={<span className="text-ember-500 font-bold text-xl">🔥 {{name}}</span>}
|
|
746
|
+
navItems={[
|
|
747
|
+
{ label: 'Home', href: '/' },
|
|
748
|
+
{ label: 'About', href: '/about' },
|
|
749
|
+
{ label: 'Docs', href: 'https://emberkit.dev/docs', external: true },
|
|
750
|
+
]}
|
|
751
|
+
>
|
|
752
|
+
{children}
|
|
753
|
+
</DefaultLayout>
|
|
754
|
+
</>
|
|
755
|
+
);
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
export default Layout;`,
|
|
759
|
+
"src/routes/index.tsx": `import type { RouteComponent } from '@emberkit/core';
|
|
760
|
+
import { Button, Card, Heading, Text, Badge, Input } from '@emberkit/ui';
|
|
761
|
+
import { signal } from '@emberkit/core';
|
|
762
|
+
|
|
763
|
+
const HomePage: RouteComponent = () => {
|
|
764
|
+
const email = signal('');
|
|
765
|
+
|
|
766
|
+
return (
|
|
767
|
+
<div className="space-y-16">
|
|
768
|
+
<section className="text-center py-16">
|
|
769
|
+
<Heading level="h1" size="4xl" weight="bold" className="mb-4">
|
|
770
|
+
Welcome to <span className="text-ember-500">{{name}}</span>
|
|
771
|
+
</Heading>
|
|
772
|
+
<Text size="xl" color="muted" className="max-w-2xl mx-auto mb-8">
|
|
773
|
+
A modern starter template with EmberKit UI components and Tailwind CSS.
|
|
774
|
+
Build beautiful interfaces with our pre-built component library.
|
|
775
|
+
</Text>
|
|
776
|
+
<div className="flex gap-4 justify-center">
|
|
777
|
+
<Button variant="primary" size="lg">
|
|
778
|
+
Get Started
|
|
779
|
+
</Button>
|
|
780
|
+
<Button variant="secondary" size="lg">
|
|
781
|
+
View Docs
|
|
782
|
+
</Button>
|
|
783
|
+
</div>
|
|
784
|
+
</section>
|
|
785
|
+
|
|
786
|
+
<section>
|
|
787
|
+
<Heading level="h2" size="2xl" weight="semibold" className="mb-8 text-center">
|
|
788
|
+
UI Components
|
|
789
|
+
</Heading>
|
|
790
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
791
|
+
<Card padding="lg">
|
|
792
|
+
<Badge variant="primary" size="sm" className="mb-2">Button</Badge>
|
|
793
|
+
<Heading level="h3" size="lg" weight="semibold" className="mb-2">
|
|
794
|
+
Button Variants
|
|
795
|
+
</Heading>
|
|
796
|
+
<Text color="muted" className="mb-4">
|
|
797
|
+
Primary, secondary, ghost, and more button styles.
|
|
798
|
+
</Text>
|
|
799
|
+
<div className="flex gap-2 flex-wrap">
|
|
800
|
+
<Button variant="primary">Primary</Button>
|
|
801
|
+
<Button variant="secondary">Secondary</Button>
|
|
802
|
+
<Button variant="ghost">Ghost</Button>
|
|
803
|
+
</div>
|
|
804
|
+
</Card>
|
|
805
|
+
|
|
806
|
+
<Card padding="lg">
|
|
807
|
+
<Badge variant="success" size="sm" className="mb-2">Cards</Badge>
|
|
808
|
+
<Heading level="h3" size="lg" weight="semibold" className="mb-2">
|
|
809
|
+
Card Component
|
|
810
|
+
</Heading>
|
|
811
|
+
<Text color="muted" className="mb-4">
|
|
812
|
+
Flexible card layout with padding variants.
|
|
813
|
+
</Text>
|
|
814
|
+
<Card padding="md" className="bg-slate-800">
|
|
815
|
+
<Text>Card content here</Text>
|
|
816
|
+
</Card>
|
|
817
|
+
</Card>
|
|
818
|
+
|
|
819
|
+
<Card padding="lg">
|
|
820
|
+
<Badge variant="info" size="sm" className="mb-2">Forms</Badge>
|
|
821
|
+
<Heading level="h3" size="lg" weight="semibold" className="mb-2">
|
|
822
|
+
Form Inputs
|
|
823
|
+
</Heading>
|
|
824
|
+
<Text color="muted" className="mb-4">
|
|
825
|
+
Styled input with label support.
|
|
826
|
+
</Text>
|
|
827
|
+
<Input
|
|
828
|
+
label="Email"
|
|
829
|
+
placeholder="Enter your email"
|
|
830
|
+
value={email.value}
|
|
831
|
+
onChange={(e) => { email.value = e.currentTarget.value; }}
|
|
832
|
+
/>
|
|
833
|
+
</Card>
|
|
834
|
+
</div>
|
|
835
|
+
</section>
|
|
836
|
+
|
|
837
|
+
<section className="text-center py-16 bg-slate-800/50 rounded-xl">
|
|
838
|
+
<Heading level="h2" size="2xl" weight="semibold" className="mb-4">
|
|
839
|
+
Ready to get started?
|
|
840
|
+
</Heading>
|
|
841
|
+
<Text color="muted" className="max-w-xl mx-auto mb-6">
|
|
842
|
+
Install dependencies and start building your next project with EmberKit.
|
|
843
|
+
</Text>
|
|
844
|
+
<Button variant="primary" size="lg">
|
|
845
|
+
Create Project →
|
|
846
|
+
</Button>
|
|
847
|
+
</section>
|
|
848
|
+
</div>
|
|
849
|
+
);
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
export default HomePage;`,
|
|
853
|
+
"src/routes/about.tsx": `import type { RouteComponent } from '@emberkit/core';
|
|
854
|
+
import { Head } from '@emberkit/core';
|
|
855
|
+
import { Heading, Text, Button } from '@emberkit/ui';
|
|
856
|
+
|
|
857
|
+
const AboutPage: RouteComponent = () => {
|
|
858
|
+
return (
|
|
859
|
+
<div className="max-w-2xl mx-auto py-12">
|
|
860
|
+
<Head>
|
|
861
|
+
<title>About - {{name}}</title>
|
|
862
|
+
</Head>
|
|
863
|
+
<Heading level="h1" size="3xl" weight="bold" className="mb-6">
|
|
864
|
+
About {{name}}
|
|
865
|
+
</Heading>
|
|
866
|
+
<Text size="lg" color="muted" className="mb-8">
|
|
867
|
+
This project was created with EmberKit and the UI component library.
|
|
868
|
+
It demonstrates how to build modern, beautiful interfaces with our
|
|
869
|
+
pre-built components and Tailwind CSS.
|
|
870
|
+
</Text>
|
|
871
|
+
<div className="space-y-4">
|
|
872
|
+
<div className="flex items-center gap-3 p-4 bg-slate-800 rounded-lg">
|
|
873
|
+
<span className="text-ember-500 text-2xl">✓</span>
|
|
874
|
+
<Text>TypeScript-first development</Text>
|
|
875
|
+
</div>
|
|
876
|
+
<div className="flex items-center gap-3 p-4 bg-slate-800 rounded-lg">
|
|
877
|
+
<span className="text-ember-500 text-2xl">✓</span>
|
|
878
|
+
<Text>Pre-built UI components</Text>
|
|
879
|
+
</div>
|
|
880
|
+
<div className="flex items-center gap-3 p-4 bg-slate-800 rounded-lg">
|
|
881
|
+
<span className="text-ember-500 text-2xl">✓</span>
|
|
882
|
+
<Text>Tailwind CSS integration</Text>
|
|
883
|
+
</div>
|
|
884
|
+
<div className="flex items-center gap-3 p-4 bg-slate-800 rounded-lg">
|
|
885
|
+
<span className="text-ember-500 text-2xl">✓</span>
|
|
886
|
+
<Text>File-based routing</Text>
|
|
887
|
+
</div>
|
|
888
|
+
</div>
|
|
889
|
+
<div className="mt-8">
|
|
890
|
+
<Button variant="secondary">← Back to Home</Button>
|
|
891
|
+
</div>
|
|
892
|
+
</div>
|
|
893
|
+
);
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
export default AboutPage;`,
|
|
897
|
+
};
|