@uniweb/templates 0.1.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.
Files changed (39) hide show
  1. package/package.json +32 -0
  2. package/src/index.js +120 -0
  3. package/src/processor.js +184 -0
  4. package/src/validator.js +206 -0
  5. package/templates/marketing/template/README.md.hbs +56 -0
  6. package/templates/marketing/template/foundation/package.json.hbs +34 -0
  7. package/templates/marketing/template/foundation/postcss.config.js +6 -0
  8. package/templates/marketing/template/foundation/src/components/CTA/index.jsx +75 -0
  9. package/templates/marketing/template/foundation/src/components/CTA/meta.js +46 -0
  10. package/templates/marketing/template/foundation/src/components/Features/index.jsx +81 -0
  11. package/templates/marketing/template/foundation/src/components/Features/meta.js +46 -0
  12. package/templates/marketing/template/foundation/src/components/Hero/index.jsx +73 -0
  13. package/templates/marketing/template/foundation/src/components/Hero/meta.js +46 -0
  14. package/templates/marketing/template/foundation/src/components/Pricing/index.jsx +108 -0
  15. package/templates/marketing/template/foundation/src/components/Pricing/meta.js +36 -0
  16. package/templates/marketing/template/foundation/src/components/Testimonials/index.jsx +96 -0
  17. package/templates/marketing/template/foundation/src/components/Testimonials/meta.js +44 -0
  18. package/templates/marketing/template/foundation/src/entry-runtime.js +3 -0
  19. package/templates/marketing/template/foundation/src/index.js +37 -0
  20. package/templates/marketing/template/foundation/src/meta.js.hbs +28 -0
  21. package/templates/marketing/template/foundation/src/styles.css +3 -0
  22. package/templates/marketing/template/foundation/tailwind.config.js +17 -0
  23. package/templates/marketing/template/foundation/vite.config.js +23 -0
  24. package/templates/marketing/template/package.json.hbs +13 -0
  25. package/templates/marketing/template/pnpm-workspace.yaml +3 -0
  26. package/templates/marketing/template/site/index.html.hbs +18 -0
  27. package/templates/marketing/template/site/package.json.hbs +27 -0
  28. package/templates/marketing/template/site/pages/home/1-hero.md +12 -0
  29. package/templates/marketing/template/site/pages/home/2-features.md +33 -0
  30. package/templates/marketing/template/site/pages/home/3-pricing.md +43 -0
  31. package/templates/marketing/template/site/pages/home/4-testimonials.md +27 -0
  32. package/templates/marketing/template/site/pages/home/5-cta.md +12 -0
  33. package/templates/marketing/template/site/pages/home/page.yml +2 -0
  34. package/templates/marketing/template/site/postcss.config.js +6 -0
  35. package/templates/marketing/template/site/site.yml.hbs +5 -0
  36. package/templates/marketing/template/site/src/main.jsx +19 -0
  37. package/templates/marketing/template/site/tailwind.config.js +24 -0
  38. package/templates/marketing/template/site/vite.config.js +42 -0
  39. package/templates/marketing/template.json +8 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Marketing Foundation
3
+ *
4
+ * This is the manual entry point for development.
5
+ * During build, _entry.generated.js is created automatically.
6
+ */
7
+
8
+ import Hero from './components/Hero/index.jsx'
9
+ import Features from './components/Features/index.jsx'
10
+ import Pricing from './components/Pricing/index.jsx'
11
+ import Testimonials from './components/Testimonials/index.jsx'
12
+ import CTA from './components/CTA/index.jsx'
13
+
14
+ const components = { Hero, Features, Pricing, Testimonials, CTA }
15
+
16
+ export function getComponent(name) {
17
+ return components[name]
18
+ }
19
+
20
+ export function listComponents() {
21
+ return Object.keys(components)
22
+ }
23
+
24
+ export function getSchema(name) {
25
+ return components[name]?.schema
26
+ }
27
+
28
+ export function getAllSchemas() {
29
+ const schemas = {}
30
+ for (const [name, component] of Object.entries(components)) {
31
+ if (component.schema) schemas[name] = component.schema
32
+ }
33
+ return schemas
34
+ }
35
+
36
+ export { Hero, Features, Pricing, Testimonials, CTA }
37
+ export default { getComponent, listComponents, getSchema, getAllSchemas, components }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * {{projectName}} Foundation Metadata
3
+ */
4
+ export default {
5
+ name: '{{projectName}}',
6
+ description: 'A marketing-focused Uniweb foundation',
7
+
8
+ // Runtime props (available at render time)
9
+ props: {
10
+ themeToggleEnabled: true,
11
+ },
12
+
13
+ // Style configuration for the editor
14
+ styleFields: [
15
+ {
16
+ id: 'primary-color',
17
+ type: 'color',
18
+ label: 'Primary Color',
19
+ default: '#3b82f6',
20
+ },
21
+ {
22
+ id: 'secondary-color',
23
+ type: 'color',
24
+ label: 'Secondary Color',
25
+ default: '#64748b',
26
+ },
27
+ ],
28
+ }
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,17 @@
1
+ import { fileURLToPath } from 'url'
2
+ import { dirname, join } from 'path'
3
+
4
+ const __dirname = dirname(fileURLToPath(import.meta.url))
5
+
6
+ export default {
7
+ content: [join(__dirname, './src/**/*.{js,jsx,ts,tsx}')],
8
+ theme: {
9
+ extend: {
10
+ colors: {
11
+ primary: '#3b82f6',
12
+ secondary: '#64748b',
13
+ },
14
+ },
15
+ },
16
+ plugins: [],
17
+ }
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import svgr from 'vite-plugin-svgr'
4
+ import { resolve } from 'path'
5
+
6
+ export default defineConfig({
7
+ plugins: [react(), svgr()],
8
+ build: {
9
+ lib: {
10
+ entry: resolve(__dirname, 'src/entry-runtime.js'),
11
+ formats: ['es'],
12
+ fileName: 'foundation',
13
+ },
14
+ rollupOptions: {
15
+ external: ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
16
+ output: {
17
+ assetFileNames: 'assets/[name][extname]',
18
+ },
19
+ },
20
+ sourcemap: true,
21
+ cssCodeSplit: false,
22
+ },
23
+ })
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "pnpm --filter site dev",
7
+ "dev:runtime": "pnpm --filter site dev:runtime",
8
+ "build": "pnpm --filter foundation build && pnpm --filter site build",
9
+ "build:foundation": "pnpm --filter foundation build",
10
+ "build:site": "pnpm --filter site build",
11
+ "preview": "pnpm --filter site preview"
12
+ }
13
+ }
@@ -0,0 +1,3 @@
1
+ packages:
2
+ - 'site'
3
+ - 'foundation'
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ <style>
8
+ body { margin: 0; font-family: system-ui, sans-serif; }
9
+ .loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; color: #64748b; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <div id="root">
14
+ <div class="loading">Loading...</div>
15
+ </div>
16
+ <script type="module" src="/src/main.jsx"></script>
17
+ </body>
18
+ </html>
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "{{projectName}}-site",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "dev:runtime": "VITE_FOUNDATION_MODE=runtime vite",
9
+ "build": "vite build",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@uniweb/runtime": "^0.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "@vitejs/plugin-react": "^4.2.1",
17
+ "autoprefixer": "^10.4.18",
18
+ "js-yaml": "^4.1.0",
19
+ "postcss": "^8.4.35",
20
+ "react": "^18.2.0",
21
+ "react-dom": "^18.2.0",
22
+ "react-router-dom": "^6.22.0",
23
+ "tailwindcss": "^3.4.1",
24
+ "vite": "^5.1.0",
25
+ "vite-plugin-svgr": "^4.2.0"
26
+ }
27
+ }
@@ -0,0 +1,12 @@
1
+ ---
2
+ component: Hero
3
+ theme: gradient
4
+ alignment: center
5
+ ---
6
+
7
+ # Build Beautiful Websites Without the Complexity
8
+
9
+ Create stunning, content-driven websites using simple markdown files and reusable components. No complex CMS required.
10
+
11
+ [Get Started Free](#pricing)
12
+ [View Demo](#features)
@@ -0,0 +1,33 @@
1
+ ---
2
+ component: Features
3
+ theme: light
4
+ columns: 3
5
+ ---
6
+
7
+ ## Everything You Need
8
+
9
+ Our platform provides all the tools to create professional websites quickly.
10
+
11
+ ### Lightning Fast
12
+
13
+ Built on modern web technologies for blazing fast performance. Your pages load in milliseconds, not seconds.
14
+
15
+ ### Content First
16
+
17
+ Write in markdown, see results instantly. Focus on your content while we handle the presentation.
18
+
19
+ ### Fully Customizable
20
+
21
+ Every component is designed to be extended. Create your own foundation or customize existing ones.
22
+
23
+ ### Mobile Ready
24
+
25
+ Responsive by default. Your site looks great on every device, from phones to desktops.
26
+
27
+ ### SEO Optimized
28
+
29
+ Built-in SEO best practices. Your content gets discovered by search engines automatically.
30
+
31
+ ### Easy to Deploy
32
+
33
+ One command deploys to any static host. Works with Vercel, Netlify, GitHub Pages, and more.
@@ -0,0 +1,43 @@
1
+ ---
2
+ component: Pricing
3
+ theme: light
4
+ ---
5
+
6
+ ## Simple, Transparent Pricing
7
+
8
+ Choose the plan that works for you. All plans include core features.
9
+
10
+ ### Starter
11
+
12
+ Perfect for personal projects and small sites.
13
+
14
+ - Up to 5 pages
15
+ - 1 custom domain
16
+ - Basic analytics
17
+ - Community support
18
+
19
+ [Start Free](#)
20
+
21
+ ### Professional
22
+
23
+ For growing businesses and teams.
24
+
25
+ - Unlimited pages
26
+ - 3 custom domains
27
+ - Advanced analytics
28
+ - Priority support
29
+ - Custom components
30
+
31
+ [Start Trial](#)
32
+
33
+ ### Enterprise
34
+
35
+ For large organizations with custom needs.
36
+
37
+ - Everything in Pro
38
+ - Unlimited domains
39
+ - Dedicated support
40
+ - Custom integrations
41
+ - SLA guarantee
42
+
43
+ [Contact Sales](#)
@@ -0,0 +1,27 @@
1
+ ---
2
+ component: Testimonials
3
+ theme: gray
4
+ columns: 3
5
+ ---
6
+
7
+ ## Loved by Developers
8
+
9
+ See what our users have to say about their experience.
10
+
11
+ ### Sarah Chen
12
+
13
+ Finally, a tool that lets me focus on content instead of wrestling with CMSes. My blog went from idea to launch in an afternoon.
14
+
15
+ Engineering Manager at TechCorp
16
+
17
+ ### Marcus Johnson
18
+
19
+ The component system is brilliant. We built our entire marketing site using reusable blocks. Updates are a breeze now.
20
+
21
+ Founder at StartupXYZ
22
+
23
+ ### Elena Rodriguez
24
+
25
+ As a designer, I appreciate how easy it is to customize the look and feel. The Tailwind integration is seamless.
26
+
27
+ Lead Designer at CreativeStudio
@@ -0,0 +1,12 @@
1
+ ---
2
+ component: CTA
3
+ theme: gradient
4
+ alignment: center
5
+ ---
6
+
7
+ ## Ready to Get Started?
8
+
9
+ Join thousands of developers building better websites. Start for free, no credit card required.
10
+
11
+ [Create Your First Site](#)
12
+ [Read the Docs](#)
@@ -0,0 +1,2 @@
1
+ title: Home
2
+ order: 1
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -0,0 +1,5 @@
1
+ name: {{projectName}}
2
+ defaultLanguage: en
3
+
4
+ # Foundation to use for this site
5
+ foundation: foundation
@@ -0,0 +1,19 @@
1
+ import { initRuntime } from '@uniweb/runtime'
2
+
3
+ const useRuntimeLoading = import.meta.env.VITE_FOUNDATION_MODE === 'runtime'
4
+
5
+ async function start() {
6
+ if (useRuntimeLoading) {
7
+ initRuntime({
8
+ url: '/foundation/foundation.js',
9
+ cssUrl: '/foundation/assets/style.css'
10
+ })
11
+ } else {
12
+ // #foundation alias is resolved by Vite based on site.yml config
13
+ const foundation = await import('#foundation')
14
+ await import('#foundation/styles')
15
+ initRuntime(foundation)
16
+ }
17
+ }
18
+
19
+ start().catch(console.error)
@@ -0,0 +1,24 @@
1
+ import { readFileSync, existsSync } from 'fs'
2
+ import yaml from 'js-yaml'
3
+
4
+ // Read foundation from site.yml
5
+ const siteConfig = yaml.load(readFileSync('./site.yml', 'utf8'))
6
+ const foundation = siteConfig.foundation || 'foundation'
7
+
8
+ // Resolve foundation path (workspace sibling or node_modules)
9
+ const workspacePath = `../${foundation}/src/**/*.{js,jsx,ts,tsx}`
10
+ const npmPath = `./node_modules/${foundation}/src/**/*.{js,jsx,ts,tsx}`
11
+ const contentPath = existsSync(`../${foundation}`) ? workspacePath : npmPath
12
+
13
+ export default {
14
+ content: [contentPath],
15
+ theme: {
16
+ extend: {
17
+ colors: {
18
+ primary: '#3b82f6',
19
+ secondary: '#64748b',
20
+ },
21
+ },
22
+ },
23
+ plugins: [],
24
+ }
@@ -0,0 +1,42 @@
1
+ import { defineConfig } from 'vite'
2
+ import { readFileSync, existsSync } from 'fs'
3
+ import yaml from 'js-yaml'
4
+ import react from '@vitejs/plugin-react'
5
+ import svgr from 'vite-plugin-svgr'
6
+ import { siteContentPlugin, foundationPlugin } from '@uniweb/runtime/vite'
7
+
8
+ // Read foundation from site.yml
9
+ const siteConfig = yaml.load(readFileSync('./site.yml', 'utf8'))
10
+ const foundation = siteConfig.foundation || 'foundation'
11
+
12
+ // Check if foundation is a workspace sibling or npm package
13
+ const isWorkspaceFoundation = existsSync(`../${foundation}`)
14
+ const foundationPath = isWorkspaceFoundation ? `../${foundation}` : `./node_modules/${foundation}`
15
+
16
+ const useRuntimeLoading = process.env.VITE_FOUNDATION_MODE === 'runtime'
17
+
18
+ export default defineConfig({
19
+ resolve: {
20
+ alias: {
21
+ '#foundation': foundation,
22
+ },
23
+ },
24
+ plugins: [
25
+ react(),
26
+ svgr(),
27
+ siteContentPlugin({
28
+ sitePath: './',
29
+ inject: true,
30
+ }),
31
+ useRuntimeLoading && foundationPlugin({
32
+ name: foundation,
33
+ path: foundationPath,
34
+ serve: '/foundation',
35
+ watch: true,
36
+ }),
37
+ ].filter(Boolean),
38
+ server: {
39
+ fs: { allow: ['..'] },
40
+ port: 3000,
41
+ },
42
+ })
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Marketing Starter",
3
+ "description": "A complete marketing site with landing page, features showcase, pricing tables, and testimonials. Perfect for product launches, SaaS websites, and business landing pages.",
4
+ "uniweb": ">=0.2.0",
5
+ "preview": "preview.png",
6
+ "tags": ["marketing", "landing-page", "saas", "business"],
7
+ "components": ["Hero", "Features", "Pricing", "Testimonials", "CTA"]
8
+ }