@revealui/cli 0.0.1-pre.1 → 0.3.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/LICENSE +22 -202
- package/README.md +194 -0
- package/bin/create-revealui.js +6 -0
- package/bin/revealui.js +6 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +1801 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1795 -124
- package/dist/index.js.map +1 -0
- package/package.json +49 -42
- package/templates/basic-blog/.env.example +36 -0
- package/templates/basic-blog/_gitignore +26 -0
- package/templates/basic-blog/next.config.mjs +10 -0
- package/templates/basic-blog/package.json +36 -0
- package/templates/basic-blog/postcss.config.mjs +5 -0
- package/templates/basic-blog/revealui.config.ts +19 -0
- package/templates/basic-blog/src/app/globals.css +6 -0
- package/templates/basic-blog/src/app/layout.tsx +15 -0
- package/templates/basic-blog/src/app/page.tsx +57 -0
- package/templates/basic-blog/src/app/posts/[slug]/page.tsx +66 -0
- package/templates/basic-blog/src/app/posts/page.tsx +61 -0
- package/templates/basic-blog/src/collections/Posts.ts +42 -0
- package/templates/basic-blog/src/seed.ts +73 -0
- package/templates/basic-blog/tsconfig.json +11 -0
- package/templates/e-commerce/.env.example +36 -0
- package/templates/e-commerce/_gitignore +26 -0
- package/templates/e-commerce/next.config.mjs +10 -0
- package/templates/e-commerce/package.json +36 -0
- package/templates/e-commerce/postcss.config.mjs +5 -0
- package/templates/e-commerce/revealui.config.ts +20 -0
- package/templates/e-commerce/src/app/globals.css +6 -0
- package/templates/e-commerce/src/app/layout.tsx +15 -0
- package/templates/e-commerce/src/app/page.tsx +82 -0
- package/templates/e-commerce/src/app/products/[slug]/page.tsx +80 -0
- package/templates/e-commerce/src/app/products/page.tsx +72 -0
- package/templates/e-commerce/src/collections/Orders.ts +63 -0
- package/templates/e-commerce/src/collections/Products.ts +50 -0
- package/templates/e-commerce/src/seed.ts +72 -0
- package/templates/e-commerce/tsconfig.json +11 -0
- package/templates/portfolio/.env.example +36 -0
- package/templates/portfolio/_gitignore +26 -0
- package/templates/portfolio/next.config.mjs +10 -0
- package/templates/portfolio/package.json +36 -0
- package/templates/portfolio/postcss.config.mjs +5 -0
- package/templates/portfolio/revealui.config.ts +19 -0
- package/templates/portfolio/src/app/globals.css +6 -0
- package/templates/portfolio/src/app/layout.tsx +15 -0
- package/templates/portfolio/src/app/page.tsx +60 -0
- package/templates/portfolio/src/app/projects/[slug]/page.tsx +95 -0
- package/templates/portfolio/src/app/projects/page.tsx +85 -0
- package/templates/portfolio/src/collections/Projects.ts +49 -0
- package/templates/portfolio/src/seed.ts +73 -0
- package/templates/portfolio/tsconfig.json +11 -0
- package/templates/starter/.env.example +36 -0
- package/templates/starter/_gitignore +26 -0
- package/templates/starter/next.config.mjs +10 -0
- package/templates/starter/package.json +36 -0
- package/templates/starter/postcss.config.mjs +5 -0
- package/templates/starter/revealui.config.ts +18 -0
- package/templates/starter/src/app/globals.css +6 -0
- package/templates/starter/src/app/layout.tsx +15 -0
- package/templates/starter/src/app/page.tsx +18 -0
- package/templates/starter/src/seed.ts +40 -0
- package/templates/starter/tsconfig.json +11 -0
- package/dist/commands/add.d.ts +0 -28
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js +0 -115
- package/dist/commands/check.d.ts +0 -7
- package/dist/commands/check.d.ts.map +0 -1
- package/dist/commands/check.js +0 -34
- package/dist/commands/doctor/checks/build.d.ts +0 -10
- package/dist/commands/doctor/checks/build.d.ts.map +0 -1
- package/dist/commands/doctor/checks/build.js +0 -74
- package/dist/commands/doctor/checks/config.d.ts +0 -14
- package/dist/commands/doctor/checks/config.d.ts.map +0 -1
- package/dist/commands/doctor/checks/config.js +0 -116
- package/dist/commands/doctor/checks/dependencies.d.ts +0 -14
- package/dist/commands/doctor/checks/dependencies.d.ts.map +0 -1
- package/dist/commands/doctor/checks/dependencies.js +0 -126
- package/dist/commands/doctor/checks/practices.d.ts +0 -14
- package/dist/commands/doctor/checks/practices.d.ts.map +0 -1
- package/dist/commands/doctor/checks/practices.js +0 -142
- package/dist/commands/doctor/checks/structure.d.ts +0 -14
- package/dist/commands/doctor/checks/structure.d.ts.map +0 -1
- package/dist/commands/doctor/checks/structure.js +0 -107
- package/dist/commands/doctor/fixes/index.d.ts +0 -26
- package/dist/commands/doctor/fixes/index.d.ts.map +0 -1
- package/dist/commands/doctor/fixes/index.js +0 -108
- package/dist/commands/doctor/index.d.ts +0 -11
- package/dist/commands/doctor/index.d.ts.map +0 -1
- package/dist/commands/doctor/index.js +0 -37
- package/dist/commands/doctor/print.d.ts +0 -6
- package/dist/commands/doctor/print.d.ts.map +0 -1
- package/dist/commands/doctor/print.js +0 -31
- package/dist/commands/doctor/types.d.ts +0 -16
- package/dist/commands/doctor/types.d.ts.map +0 -1
- package/dist/commands/doctor/types.js +0 -1
- package/dist/commands/fix.d.ts +0 -5
- package/dist/commands/fix.d.ts.map +0 -1
- package/dist/commands/fix.js +0 -129
- package/dist/commands/init.d.ts +0 -35
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -104
- package/dist/commands/upgrade.d.ts +0 -9
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/upgrade.js +0 -85
- package/dist/index.d.ts.map +0 -1
- package/dist/onLoad.d.ts +0 -3
- package/dist/onLoad.d.ts.map +0 -1
- package/dist/onLoad.js +0 -5
- package/dist/utils.d.ts +0 -3
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -6
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed script for the portfolio template.
|
|
3
|
+
* Creates 3 sample projects via the RevealUI REST API.
|
|
4
|
+
*
|
|
5
|
+
* Usage: pnpm db:seed (requires the dev server to be running)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const API_URL = process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:4000';
|
|
9
|
+
|
|
10
|
+
interface SeedProject {
|
|
11
|
+
title: string;
|
|
12
|
+
slug: string;
|
|
13
|
+
description: string;
|
|
14
|
+
tags: Array<{ tag: string }>;
|
|
15
|
+
link: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const projects: SeedProject[] = [
|
|
19
|
+
{
|
|
20
|
+
title: 'Weather Dashboard',
|
|
21
|
+
slug: 'weather-dashboard',
|
|
22
|
+
description:
|
|
23
|
+
'A real-time weather dashboard built with React and a public weather API. Displays forecasts, radar maps, and severe weather alerts.',
|
|
24
|
+
tags: [{ tag: 'React' }, { tag: 'TypeScript' }, { tag: 'API' }],
|
|
25
|
+
link: 'https://github.com/example/weather-dashboard',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: 'Task Manager CLI',
|
|
29
|
+
slug: 'task-manager-cli',
|
|
30
|
+
description:
|
|
31
|
+
'A command-line task manager written in TypeScript with SQLite storage, priority sorting, and due date reminders.',
|
|
32
|
+
tags: [{ tag: 'TypeScript' }, { tag: 'Node.js' }, { tag: 'CLI' }],
|
|
33
|
+
link: 'https://github.com/example/task-manager-cli',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Design System',
|
|
37
|
+
slug: 'design-system',
|
|
38
|
+
description:
|
|
39
|
+
'A component library with 30+ accessible UI primitives, built with Tailwind CSS and documented with Storybook.',
|
|
40
|
+
tags: [{ tag: 'React' }, { tag: 'Tailwind CSS' }, { tag: 'Storybook' }],
|
|
41
|
+
link: 'https://github.com/example/design-system',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
const log = (...args: unknown[]) => process.stdout.write(`${args.join(' ')}\n`);
|
|
46
|
+
const logErr = (...args: unknown[]) => process.stderr.write(`${args.join(' ')}\n`);
|
|
47
|
+
|
|
48
|
+
async function seed(): Promise<void> {
|
|
49
|
+
log(`Seeding projects to ${API_URL}...`);
|
|
50
|
+
|
|
51
|
+
for (const project of projects) {
|
|
52
|
+
try {
|
|
53
|
+
const res = await fetch(`${API_URL}/api/projects`, {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: { 'Content-Type': 'application/json' },
|
|
56
|
+
body: JSON.stringify(project),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (res.ok) {
|
|
60
|
+
log(` Created: ${project.title}`);
|
|
61
|
+
} else {
|
|
62
|
+
const error = await res.text();
|
|
63
|
+
logErr(` Failed to create "${project.title}": ${error}`);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
logErr(` Error creating "${project.title}":`, err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
log('Seeding complete.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
seed();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# RevealUI Environment Variables
|
|
2
|
+
# Copy this file to .env.local and fill in your values before running `pnpm dev`
|
|
3
|
+
|
|
4
|
+
# ─── Core ────────────────────────────────────────────────────────────────────
|
|
5
|
+
# 32+ character secret used for signing sessions and tokens
|
|
6
|
+
REVEALUI_SECRET=change-me-to-a-long-random-secret-at-least-32-chars
|
|
7
|
+
|
|
8
|
+
# Public URL of your CMS server (must match NEXT_PUBLIC_SERVER_URL)
|
|
9
|
+
REVEALUI_PUBLIC_SERVER_URL=http://localhost:4000
|
|
10
|
+
NEXT_PUBLIC_SERVER_URL=http://localhost:4000
|
|
11
|
+
|
|
12
|
+
# ─── Database ────────────────────────────────────────────────────────────────
|
|
13
|
+
# PostgreSQL connection string (NeonDB, Supabase, or local Postgres)
|
|
14
|
+
POSTGRES_URL=postgresql://postgres:postgres@localhost:5432/revealui
|
|
15
|
+
|
|
16
|
+
# ─── Storage ─────────────────────────────────────────────────────────────────
|
|
17
|
+
# Vercel Blob token for file uploads (optional — leave placeholder for local dev)
|
|
18
|
+
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_placeholder
|
|
19
|
+
|
|
20
|
+
# ─── Stripe (optional) ───────────────────────────────────────────────────────
|
|
21
|
+
# Use test keys during development: https://dashboard.stripe.com/test/apikeys
|
|
22
|
+
STRIPE_SECRET_KEY=sk_test_placeholder
|
|
23
|
+
STRIPE_WEBHOOK_SECRET=whsec_placeholder
|
|
24
|
+
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_placeholder
|
|
25
|
+
|
|
26
|
+
# ─── Admin Bootstrap ─────────────────────────────────────────────────────────
|
|
27
|
+
# Used on first run only to create the initial admin account
|
|
28
|
+
REVEALUI_ADMIN_EMAIL=admin@example.com
|
|
29
|
+
REVEALUI_ADMIN_PASSWORD=changeme-min-12-chars
|
|
30
|
+
|
|
31
|
+
# ─── Branding (Enterprise white-label) ───────────────────────────────────────
|
|
32
|
+
# Customize the admin UI for your brand. Enterprise license required for full white-label.
|
|
33
|
+
# REVEALUI_BRAND_NAME=My CMS
|
|
34
|
+
# REVEALUI_BRAND_LOGO_URL=https://example.com/logo.png
|
|
35
|
+
# REVEALUI_BRAND_PRIMARY_COLOR=#ea580c
|
|
36
|
+
# REVEALUI_SHOW_POWERED_BY=false
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Next.js
|
|
7
|
+
.next/
|
|
8
|
+
out/
|
|
9
|
+
build/
|
|
10
|
+
|
|
11
|
+
# Environment variables
|
|
12
|
+
.env
|
|
13
|
+
.env.local
|
|
14
|
+
.env.development.local
|
|
15
|
+
.env.test.local
|
|
16
|
+
.env.production.local
|
|
17
|
+
|
|
18
|
+
# Turbo
|
|
19
|
+
.turbo/
|
|
20
|
+
|
|
21
|
+
# Misc
|
|
22
|
+
.DS_Store
|
|
23
|
+
*.pem
|
|
24
|
+
npm-debug.log*
|
|
25
|
+
yarn-debug.log*
|
|
26
|
+
yarn-error.log*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "next dev --port 4000",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"start": "next start --port 4000",
|
|
10
|
+
"lint": "biome check .",
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"db:init": "revealui cms",
|
|
14
|
+
"db:migrate": "drizzle-kit migrate",
|
|
15
|
+
"db:seed": "tsx src/seed.ts"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@revealui/core": "^0.2.0",
|
|
19
|
+
"@revealui/config": "^0.2.0",
|
|
20
|
+
"@revealui/db": "^0.2.0",
|
|
21
|
+
"@revealui/auth": "^0.2.0",
|
|
22
|
+
"@revealui/contracts": "^1.1.0",
|
|
23
|
+
"next": "^16.0.0",
|
|
24
|
+
"react": "^19.0.0",
|
|
25
|
+
"react-dom": "^19.0.0",
|
|
26
|
+
"sharp": "^0.34.0",
|
|
27
|
+
"zod": "^4.0.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@revealui/dev": "^0.0.1",
|
|
31
|
+
"@tailwindcss/postcss": "^4.1.0",
|
|
32
|
+
"tailwindcss": "^4.1.0",
|
|
33
|
+
"typescript": "^5.9.0",
|
|
34
|
+
"vitest": "^4.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import config from '@revealui/config';
|
|
2
|
+
import { buildConfig, universalPostgresAdapter } from '@revealui/core';
|
|
3
|
+
import sharp from 'sharp';
|
|
4
|
+
|
|
5
|
+
export default buildConfig({
|
|
6
|
+
serverURL: config.reveal.publicServerURL || 'http://localhost:4000',
|
|
7
|
+
secret: config.reveal.secret,
|
|
8
|
+
db: config.database.url
|
|
9
|
+
? universalPostgresAdapter({ connectionString: config.database.url })
|
|
10
|
+
: universalPostgresAdapter({ provider: 'electric' }),
|
|
11
|
+
admin: {
|
|
12
|
+
user: 'users',
|
|
13
|
+
},
|
|
14
|
+
collections: [],
|
|
15
|
+
globals: [],
|
|
16
|
+
plugins: [],
|
|
17
|
+
sharp,
|
|
18
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import './globals.css';
|
|
3
|
+
|
|
4
|
+
export const metadata: Metadata = {
|
|
5
|
+
title: 'RevealUI App',
|
|
6
|
+
description: 'Built with RevealUI',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
10
|
+
return (
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<body>{children}</body>
|
|
13
|
+
</html>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default function HomePage() {
|
|
2
|
+
return (
|
|
3
|
+
<main className="mx-auto max-w-xl px-4 py-16">
|
|
4
|
+
<h1 className="text-3xl font-bold tracking-tight text-gray-900">RevealUI</h1>
|
|
5
|
+
<p className="mt-3 text-gray-600">
|
|
6
|
+
Your project is running. Visit{' '}
|
|
7
|
+
<a href="/admin" className="font-medium text-accent hover:text-accent-hover">
|
|
8
|
+
/admin
|
|
9
|
+
</a>{' '}
|
|
10
|
+
to manage content.
|
|
11
|
+
</p>
|
|
12
|
+
<p className="mt-6 text-sm text-gray-500">
|
|
13
|
+
Edit <code className="rounded bg-gray-100 px-1.5 py-0.5 text-xs">src/app/page.tsx</code> to
|
|
14
|
+
customize this page.
|
|
15
|
+
</p>
|
|
16
|
+
</main>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database seed script
|
|
3
|
+
*
|
|
4
|
+
* Run with: pnpm db:seed
|
|
5
|
+
*
|
|
6
|
+
* Customize this file to populate your database with initial data.
|
|
7
|
+
* The examples below show common patterns — uncomment and adapt as needed.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// import { getClient } from '@revealui/db/client';
|
|
11
|
+
// import { users, posts } from '@revealui/db/schema';
|
|
12
|
+
|
|
13
|
+
async function seed(): Promise<void> {
|
|
14
|
+
// const db = getClient();
|
|
15
|
+
|
|
16
|
+
// Example: create an admin user
|
|
17
|
+
// await db.insert(users).values({
|
|
18
|
+
// id: crypto.randomUUID(),
|
|
19
|
+
// email: 'admin@example.com',
|
|
20
|
+
// name: 'Admin',
|
|
21
|
+
// role: 'admin',
|
|
22
|
+
// status: 'active',
|
|
23
|
+
// emailVerified: true,
|
|
24
|
+
// });
|
|
25
|
+
|
|
26
|
+
// Example: create sample content
|
|
27
|
+
// await db.insert(posts).values({
|
|
28
|
+
// id: crypto.randomUUID(),
|
|
29
|
+
// title: 'Welcome to RevealUI',
|
|
30
|
+
// slug: 'welcome',
|
|
31
|
+
// status: 'published',
|
|
32
|
+
// });
|
|
33
|
+
|
|
34
|
+
process.stdout.write('Seed complete.\n');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
seed().catch((error: unknown) => {
|
|
38
|
+
process.stderr.write(`Seed failed: ${error}\n`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
package/dist/commands/add.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* reveal add <plugin> command
|
|
3
|
-
* Install and configure RevealUI plugins
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Options for adding a plugin
|
|
7
|
-
*/
|
|
8
|
-
export interface AddPluginOptions {
|
|
9
|
-
/** Name of the plugin to add */
|
|
10
|
-
pluginName: string;
|
|
11
|
-
/** Plugin-specific options */
|
|
12
|
-
options?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Adds a plugin to the project
|
|
16
|
-
* Installs the plugin package and updates reveal.config.ts
|
|
17
|
-
*
|
|
18
|
-
* @param options - Plugin addition options
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* await addPlugin({
|
|
22
|
-
* pluginName: 'react',
|
|
23
|
-
* options: {},
|
|
24
|
-
* })
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function addPlugin(options: AddPluginOptions): Promise<void>;
|
|
28
|
-
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AA8BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CA6Ff"}
|
package/dist/commands/add.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* reveal add <plugin> command
|
|
3
|
-
* Install and configure RevealUI plugins
|
|
4
|
-
*/
|
|
5
|
-
import { execSync } from "node:child_process";
|
|
6
|
-
import fs from "node:fs/promises";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import pc from "@brillout/picocolors";
|
|
9
|
-
/**
|
|
10
|
-
* Available plugins
|
|
11
|
-
*/
|
|
12
|
-
const AVAILABLE_PLUGINS = {
|
|
13
|
-
react: {
|
|
14
|
-
package: "reveal",
|
|
15
|
-
importPath: "reveal/plugins/react",
|
|
16
|
-
config: () => "react()",
|
|
17
|
-
},
|
|
18
|
-
payload: {
|
|
19
|
-
package: "reveal",
|
|
20
|
-
importPath: "reveal/plugins/payload",
|
|
21
|
-
config: () => "payload()",
|
|
22
|
-
},
|
|
23
|
-
vercel: {
|
|
24
|
-
package: "reveal",
|
|
25
|
-
importPath: "reveal/plugins/vercel",
|
|
26
|
-
config: () => "vercel()",
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Adds a plugin to the project
|
|
31
|
-
* Installs the plugin package and updates reveal.config.ts
|
|
32
|
-
*
|
|
33
|
-
* @param options - Plugin addition options
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* await addPlugin({
|
|
37
|
-
* pluginName: 'react',
|
|
38
|
-
* options: {},
|
|
39
|
-
* })
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export async function addPlugin(options) {
|
|
43
|
-
const { pluginName, options: pluginOptions = {} } = options;
|
|
44
|
-
if (!AVAILABLE_PLUGINS[pluginName]) {
|
|
45
|
-
throw new Error(`Unknown plugin: ${pluginName}. Available plugins: ${Object.keys(AVAILABLE_PLUGINS).join(", ")}`);
|
|
46
|
-
}
|
|
47
|
-
const plugin = AVAILABLE_PLUGINS[pluginName];
|
|
48
|
-
console.log(pc.cyan(`Adding plugin: ${pluginName}...`));
|
|
49
|
-
// Install package if needed (for future external plugins)
|
|
50
|
-
if (plugin.package !== "reveal") {
|
|
51
|
-
try {
|
|
52
|
-
execSync(`pnpm add ${plugin.package}`, { stdio: "inherit" });
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.warn(pc.yellow(`Failed to install ${plugin.package}, continuing anyway...`));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Update reveal.config.ts
|
|
59
|
-
const configPath = path.join(process.cwd(), "reveal.config.ts");
|
|
60
|
-
try {
|
|
61
|
-
let configContent = await fs.readFile(configPath, "utf-8");
|
|
62
|
-
// Check if plugin is already added
|
|
63
|
-
if (configContent.includes(plugin.importPath)) {
|
|
64
|
-
console.log(pc.yellow(`Plugin ${pluginName} is already configured`));
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
// Add import
|
|
68
|
-
const importLine = `import ${pluginName} from "${plugin.importPath}";`;
|
|
69
|
-
if (!configContent.includes(importLine)) {
|
|
70
|
-
// Find the last import statement
|
|
71
|
-
const importMatch = configContent.match(/^import .+ from .+;$/gm);
|
|
72
|
-
if (importMatch && importMatch.length > 0) {
|
|
73
|
-
const lastImport = importMatch[importMatch.length - 1];
|
|
74
|
-
if (lastImport) {
|
|
75
|
-
const lastImportIndex = configContent.lastIndexOf(lastImport);
|
|
76
|
-
const insertIndex = lastImportIndex + lastImport.length;
|
|
77
|
-
configContent =
|
|
78
|
-
configContent.slice(0, insertIndex) +
|
|
79
|
-
"\n" +
|
|
80
|
-
importLine +
|
|
81
|
-
configContent.slice(insertIndex);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
// No imports, add at the top
|
|
86
|
-
configContent = importLine + "\n" + configContent;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Add to plugins array
|
|
90
|
-
const pluginConfig = plugin.config
|
|
91
|
-
? plugin.config(pluginOptions)
|
|
92
|
-
: `${pluginName}()`;
|
|
93
|
-
// Find plugins array and add plugin
|
|
94
|
-
const pluginsMatch = configContent.match(/plugins:\s*\[([^\]]*)\]/);
|
|
95
|
-
if (pluginsMatch && pluginsMatch[1] !== undefined) {
|
|
96
|
-
const pluginsContent = pluginsMatch[1];
|
|
97
|
-
const newPluginsContent = pluginsContent.trim() === ""
|
|
98
|
-
? pluginConfig
|
|
99
|
-
: `${pluginsContent.trim()},\n ${pluginConfig}`;
|
|
100
|
-
configContent = configContent.replace(/plugins:\s*\[([^\]]*)\]/, `plugins: [\n ${newPluginsContent}\n ]`);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
// No plugins array, add it
|
|
104
|
-
configContent = configContent.replace(/defineConfig\(\{/, `defineConfig({\n plugins: [\n ${pluginConfig}\n ],`);
|
|
105
|
-
}
|
|
106
|
-
await fs.writeFile(configPath, configContent, "utf-8");
|
|
107
|
-
console.log(pc.green(`✓ Plugin ${pluginName} added successfully!`));
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
if (error.code === "ENOENT") {
|
|
111
|
-
throw new Error("reveal.config.ts not found. Run 'reveal init' first to create a project.");
|
|
112
|
-
}
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}
|
package/dist/commands/check.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAuBhD"}
|
package/dist/commands/check.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { runDiagnostics } from "./doctor/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Quick health check command (lightweight version of doctor)
|
|
4
|
-
* Returns exit code 0 if all critical checks pass, 1 otherwise
|
|
5
|
-
* Designed for CI/CD integration
|
|
6
|
-
*/
|
|
7
|
-
export async function runCheck() {
|
|
8
|
-
const results = await runDiagnostics();
|
|
9
|
-
// Filter to only critical failures
|
|
10
|
-
const criticalFailures = results.filter((r) => r.status === "fail" && isCriticalCheck(r.check));
|
|
11
|
-
if (criticalFailures.length === 0) {
|
|
12
|
-
// All critical checks passed
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
// At least one critical check failed
|
|
16
|
-
console.error(`\n✗ ${criticalFailures.length} critical check(s) failed:\n`);
|
|
17
|
-
for (const result of criticalFailures) {
|
|
18
|
-
console.error(` ✗ ${result.check}: ${result.message}`);
|
|
19
|
-
}
|
|
20
|
-
console.error();
|
|
21
|
-
return 1;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Determine if a check is critical (blocks development/deployment)
|
|
25
|
-
*/
|
|
26
|
-
function isCriticalCheck(check) {
|
|
27
|
-
const criticalChecks = [
|
|
28
|
-
"reveal.config.ts exists",
|
|
29
|
-
"reveal package installed",
|
|
30
|
-
"package.json exists",
|
|
31
|
-
"required dependencies",
|
|
32
|
-
];
|
|
33
|
-
return criticalChecks.some((critical) => check.includes(critical));
|
|
34
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DiagnosticResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Check TypeScript compilation
|
|
4
|
-
*/
|
|
5
|
-
export declare function checkTypeScriptCompilation(cwd: string): Promise<DiagnosticResult[]>;
|
|
6
|
-
/**
|
|
7
|
-
* Check if build process works
|
|
8
|
-
*/
|
|
9
|
-
export declare function checkBuildProcess(cwd: string): Promise<DiagnosticResult[]>;
|
|
10
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/commands/doctor/checks/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkC7B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAgC7B"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
|
-
/**
|
|
3
|
-
* Check TypeScript compilation
|
|
4
|
-
*/
|
|
5
|
-
export async function checkTypeScriptCompilation(cwd) {
|
|
6
|
-
const results = [];
|
|
7
|
-
try {
|
|
8
|
-
execSync("pnpm typecheck 2>&1", {
|
|
9
|
-
cwd,
|
|
10
|
-
stdio: "pipe",
|
|
11
|
-
timeout: 30000,
|
|
12
|
-
});
|
|
13
|
-
results.push({
|
|
14
|
-
check: "TypeScript compilation",
|
|
15
|
-
status: "pass",
|
|
16
|
-
message: "TypeScript compiles without errors",
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
const errorOutput = error instanceof Error ? error.message : String(error);
|
|
21
|
-
if (errorOutput.includes("command not found") || errorOutput.includes("Missing script")) {
|
|
22
|
-
results.push({
|
|
23
|
-
check: "TypeScript compilation",
|
|
24
|
-
status: "warn",
|
|
25
|
-
message: "TypeScript check script not found",
|
|
26
|
-
suggestion: "Add 'typecheck' script to package.json",
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
results.push({
|
|
31
|
-
check: "TypeScript compilation",
|
|
32
|
-
status: "fail",
|
|
33
|
-
message: "TypeScript compilation errors found",
|
|
34
|
-
suggestion: "Run 'pnpm typecheck' to see detailed errors",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return results;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if build process works
|
|
42
|
-
*/
|
|
43
|
-
export async function checkBuildProcess(cwd) {
|
|
44
|
-
const results = [];
|
|
45
|
-
// Just check if build script exists, don't actually run it
|
|
46
|
-
try {
|
|
47
|
-
const { readFileSync } = await import("fs");
|
|
48
|
-
const packageJsonPath = `${cwd}/package.json`;
|
|
49
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
50
|
-
if (packageJson.scripts?.build) {
|
|
51
|
-
results.push({
|
|
52
|
-
check: "build script",
|
|
53
|
-
status: "pass",
|
|
54
|
-
message: "Build script found in package.json",
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
results.push({
|
|
59
|
-
check: "build script",
|
|
60
|
-
status: "warn",
|
|
61
|
-
message: "Build script not found",
|
|
62
|
-
suggestion: "Add 'build' script to package.json",
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
results.push({
|
|
68
|
-
check: "build script",
|
|
69
|
-
status: "warn",
|
|
70
|
-
message: "Could not check build script",
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return results;
|
|
74
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { DiagnosticResult } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Check reveal.config.ts exists and is valid
|
|
4
|
-
*/
|
|
5
|
-
export declare function checkRevealConfig(cwd: string): Promise<DiagnosticResult[]>;
|
|
6
|
-
/**
|
|
7
|
-
* Check TypeScript configuration
|
|
8
|
-
*/
|
|
9
|
-
export declare function checkTypeScriptConfig(cwd: string): Promise<DiagnosticResult[]>;
|
|
10
|
-
/**
|
|
11
|
-
* Check environment variables
|
|
12
|
-
*/
|
|
13
|
-
export declare function checkEnvironmentVariables(cwd: string): Promise<DiagnosticResult[]>;
|
|
14
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/commands/doctor/checks/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAiC7B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAgC7B;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwC7B"}
|