@revealui/cli 0.0.1-pre.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/LICENSE +202 -0
- package/dist/commands/add.d.ts +28 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +115 -0
- package/dist/commands/check.d.ts +7 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +34 -0
- package/dist/commands/doctor/checks/build.d.ts +10 -0
- package/dist/commands/doctor/checks/build.d.ts.map +1 -0
- package/dist/commands/doctor/checks/build.js +74 -0
- package/dist/commands/doctor/checks/config.d.ts +14 -0
- package/dist/commands/doctor/checks/config.d.ts.map +1 -0
- package/dist/commands/doctor/checks/config.js +116 -0
- package/dist/commands/doctor/checks/dependencies.d.ts +14 -0
- package/dist/commands/doctor/checks/dependencies.d.ts.map +1 -0
- package/dist/commands/doctor/checks/dependencies.js +126 -0
- package/dist/commands/doctor/checks/practices.d.ts +14 -0
- package/dist/commands/doctor/checks/practices.d.ts.map +1 -0
- package/dist/commands/doctor/checks/practices.js +142 -0
- package/dist/commands/doctor/checks/structure.d.ts +14 -0
- package/dist/commands/doctor/checks/structure.d.ts.map +1 -0
- package/dist/commands/doctor/checks/structure.js +107 -0
- package/dist/commands/doctor/fixes/index.d.ts +26 -0
- package/dist/commands/doctor/fixes/index.d.ts.map +1 -0
- package/dist/commands/doctor/fixes/index.js +108 -0
- package/dist/commands/doctor/index.d.ts +11 -0
- package/dist/commands/doctor/index.d.ts.map +1 -0
- package/dist/commands/doctor/index.js +37 -0
- package/dist/commands/doctor/print.d.ts +6 -0
- package/dist/commands/doctor/print.d.ts.map +1 -0
- package/dist/commands/doctor/print.js +31 -0
- package/dist/commands/doctor/types.d.ts +16 -0
- package/dist/commands/doctor/types.d.ts.map +1 -0
- package/dist/commands/doctor/types.js +1 -0
- package/dist/commands/fix.d.ts +5 -0
- package/dist/commands/fix.d.ts.map +1 -0
- package/dist/commands/fix.js +129 -0
- package/dist/commands/init.d.ts +35 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +104 -0
- package/dist/commands/upgrade.d.ts +9 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +85 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/onLoad.d.ts +3 -0
- package/dist/onLoad.d.ts.map +1 -0
- package/dist/onLoad.js +5 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +6 -0
- package/package.json +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../../src/commands/fix.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAoD5C"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import prompts from "prompts";
|
|
2
|
+
import pc from "@brillout/picocolors";
|
|
3
|
+
import { runDiagnostics } from "./doctor/index.js";
|
|
4
|
+
import { applyFixes } from "./doctor/fixes/index.js";
|
|
5
|
+
import * as fixes from "./doctor/fixes/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Auto-fix command that applies fixes for detected issues
|
|
8
|
+
*/
|
|
9
|
+
export async function runFix() {
|
|
10
|
+
console.log(pc.cyan("\nš§ RevealUI Auto-Fix\n"));
|
|
11
|
+
console.log(pc.gray("Running diagnostics...\n"));
|
|
12
|
+
// Run diagnostics first
|
|
13
|
+
const results = await runDiagnostics();
|
|
14
|
+
// Find fixable issues
|
|
15
|
+
const fixableResults = results.filter((r) => r.status === "fail" || r.status === "warn");
|
|
16
|
+
if (fixableResults.length === 0) {
|
|
17
|
+
console.log(pc.green("ā No issues found that need fixing!\n"));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Enhance results with fix functions
|
|
21
|
+
const enhancedResults = await enhanceResultsWithFixes(results);
|
|
22
|
+
// Show issues that can be fixed
|
|
23
|
+
console.log(pc.cyan("Issues found:\n"));
|
|
24
|
+
for (const result of fixableResults) {
|
|
25
|
+
const icon = result.status === "fail" ? pc.red("ā") : pc.yellow("ā ");
|
|
26
|
+
console.log(`${icon} ${result.check}`);
|
|
27
|
+
console.log(` ${result.message}`);
|
|
28
|
+
if (result.suggestion) {
|
|
29
|
+
console.log(pc.gray(` ā ${result.suggestion}`));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
console.log();
|
|
33
|
+
// Ask for confirmation
|
|
34
|
+
const response = await prompts({
|
|
35
|
+
type: "confirm",
|
|
36
|
+
name: "apply",
|
|
37
|
+
message: "Apply automatic fixes?",
|
|
38
|
+
initial: true,
|
|
39
|
+
});
|
|
40
|
+
if (!response.apply) {
|
|
41
|
+
console.log(pc.yellow("\nFix cancelled."));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Apply fixes
|
|
45
|
+
console.log(pc.cyan("\nApplying fixes...\n"));
|
|
46
|
+
await applyFixes(enhancedResults);
|
|
47
|
+
console.log(pc.green("\nā
Fix complete!\n"));
|
|
48
|
+
console.log(pc.cyan("Run 'reveal doctor' again to verify all issues are resolved.\n"));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Enhance diagnostic results with fix functions
|
|
52
|
+
*/
|
|
53
|
+
async function enhanceResultsWithFixes(results) {
|
|
54
|
+
const cwd = process.cwd();
|
|
55
|
+
return results.map((result) => {
|
|
56
|
+
// Add fix functions based on check type
|
|
57
|
+
if (result.check === "reveal.config.ts exists" && result.status === "fail") {
|
|
58
|
+
return {
|
|
59
|
+
...result,
|
|
60
|
+
fix: () => fixes.fixMissingRevealConfig(cwd),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (result.check === "required dependencies" && result.status === "fail") {
|
|
64
|
+
const missingDeps = extractMissingDependencies(result.message);
|
|
65
|
+
if (missingDeps.length > 0) {
|
|
66
|
+
return {
|
|
67
|
+
...result,
|
|
68
|
+
fix: () => fixes.fixMissingDependencies(cwd, missingDeps),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (result.check === "pages directory" && result.status === "fail") {
|
|
73
|
+
return {
|
|
74
|
+
...result,
|
|
75
|
+
fix: () => fixes.fixMissingDirectories(cwd, ["src/pages"]),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (result.check === "components directory" && result.status === "warn") {
|
|
79
|
+
return {
|
|
80
|
+
...result,
|
|
81
|
+
fix: () => fixes.fixMissingDirectories(cwd, ["src/components"]),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (result.check === "public directory" && result.status === "warn") {
|
|
85
|
+
return {
|
|
86
|
+
...result,
|
|
87
|
+
fix: () => fixes.fixMissingDirectories(cwd, ["public"]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (result.check === ".gitignore configuration" &&
|
|
91
|
+
result.status === "warn") {
|
|
92
|
+
const missingPatterns = extractMissingPatterns(result.message);
|
|
93
|
+
if (missingPatterns.length > 0) {
|
|
94
|
+
return {
|
|
95
|
+
...result,
|
|
96
|
+
fix: () => fixes.fixGitignore(cwd, missingPatterns),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (result.check === "Environment template" &&
|
|
101
|
+
result.status === "warn") {
|
|
102
|
+
return {
|
|
103
|
+
...result,
|
|
104
|
+
fix: () => fixes.fixMissingEnvTemplate(cwd),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Extract missing dependencies from diagnostic message
|
|
112
|
+
*/
|
|
113
|
+
function extractMissingDependencies(message) {
|
|
114
|
+
const match = message.match(/Missing dependencies: (.+)/);
|
|
115
|
+
if (match && match[1]) {
|
|
116
|
+
return match[1].split(", ").map((d) => d.trim());
|
|
117
|
+
}
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Extract missing patterns from diagnostic message
|
|
122
|
+
*/
|
|
123
|
+
function extractMissingPatterns(message) {
|
|
124
|
+
const match = message.match(/missing patterns: (.+)/i);
|
|
125
|
+
if (match && match[1]) {
|
|
126
|
+
return match[1].split(", ").map((p) => p.trim());
|
|
127
|
+
}
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reveal init command
|
|
3
|
+
* Interactive project setup for RevealUI Framework
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for project initialization
|
|
7
|
+
*/
|
|
8
|
+
export interface InitOptions {
|
|
9
|
+
/** Project name (defaults to current directory name) */
|
|
10
|
+
projectName?: string;
|
|
11
|
+
/** Project template to use */
|
|
12
|
+
template?: "basic" | "blog" | "e-commerce" | "portfolio";
|
|
13
|
+
/** Whether to use TypeScript */
|
|
14
|
+
useTypeScript?: boolean;
|
|
15
|
+
/** Whether to use Tailwind CSS */
|
|
16
|
+
useTailwind?: boolean;
|
|
17
|
+
/** Whether to include PayloadCMS */
|
|
18
|
+
usePayload?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Interactive project initialization
|
|
22
|
+
* Creates a new RevealUI project with the specified configuration
|
|
23
|
+
*
|
|
24
|
+
* @param options - Initialization options
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* await initProject({
|
|
28
|
+
* template: 'blog',
|
|
29
|
+
* useTypeScript: true,
|
|
30
|
+
* useTailwind: true,
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function initProject(options?: InitOptions): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,CAAC;IACzD,gCAAgC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyG1E"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reveal init command
|
|
3
|
+
* Interactive project setup for RevealUI Framework
|
|
4
|
+
*/
|
|
5
|
+
import pc from "@brillout/picocolors";
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
/**
|
|
9
|
+
* Interactive project initialization
|
|
10
|
+
* Creates a new RevealUI project with the specified configuration
|
|
11
|
+
*
|
|
12
|
+
* @param options - Initialization options
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* await initProject({
|
|
16
|
+
* template: 'blog',
|
|
17
|
+
* useTypeScript: true,
|
|
18
|
+
* useTailwind: true,
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export async function initProject(options = {}) {
|
|
23
|
+
console.log(pc.cyan("Welcome to RevealUI!"));
|
|
24
|
+
console.log("Let's set up your project.\n");
|
|
25
|
+
// Determine project name
|
|
26
|
+
const projectName = options.projectName || path.basename(process.cwd()) || "my-revealui-app";
|
|
27
|
+
// Create basic project structure
|
|
28
|
+
const projectDir = process.cwd();
|
|
29
|
+
// Create directories
|
|
30
|
+
const dirs = [
|
|
31
|
+
"src/pages",
|
|
32
|
+
"src/components",
|
|
33
|
+
"src/lib",
|
|
34
|
+
"src/styles",
|
|
35
|
+
"public",
|
|
36
|
+
];
|
|
37
|
+
for (const dir of dirs) {
|
|
38
|
+
await fs.mkdir(path.join(projectDir, dir), { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
// Create reveal.config.ts
|
|
41
|
+
const configContent = `import { defineConfig } from "@revealui/core/config";
|
|
42
|
+
import react from "@revealui/core/plugins/react";
|
|
43
|
+
${options.usePayload ? 'import payload from "@revealui/core/plugins/payload";' : ""}
|
|
44
|
+
import vercel from "@revealui/core/plugins/vercel";
|
|
45
|
+
|
|
46
|
+
export default defineConfig({
|
|
47
|
+
plugins: [
|
|
48
|
+
react(),
|
|
49
|
+
${options.usePayload ? "payload()," : ""}
|
|
50
|
+
vercel(),
|
|
51
|
+
],
|
|
52
|
+
vike: {
|
|
53
|
+
prerender: true,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
`;
|
|
57
|
+
await fs.writeFile(path.join(projectDir, "reveal.config.ts"), configContent, "utf-8");
|
|
58
|
+
// Create package.json if it doesn't exist
|
|
59
|
+
try {
|
|
60
|
+
await fs.access(path.join(projectDir, "package.json"));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
const packageJson = {
|
|
64
|
+
name: projectName,
|
|
65
|
+
version: "0.1.0",
|
|
66
|
+
type: "module",
|
|
67
|
+
scripts: {
|
|
68
|
+
dev: "vike dev",
|
|
69
|
+
build: "vike build",
|
|
70
|
+
preview: "vike preview",
|
|
71
|
+
},
|
|
72
|
+
dependencies: {
|
|
73
|
+
reveal: "latest",
|
|
74
|
+
react: "^19.0.0",
|
|
75
|
+
"react-dom": "^19.0.0",
|
|
76
|
+
vike: "latest",
|
|
77
|
+
"vike-react": "latest",
|
|
78
|
+
},
|
|
79
|
+
devDependencies: {
|
|
80
|
+
"@types/react": "^19.0.0",
|
|
81
|
+
"@types/react-dom": "^19.0.0",
|
|
82
|
+
typescript: "^5.7.0",
|
|
83
|
+
vite: "^6.0.0",
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
await fs.writeFile(path.join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8");
|
|
87
|
+
}
|
|
88
|
+
// Create basic page
|
|
89
|
+
const pageContent = `export default function Page() {
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
<h1>Welcome to RevealUI</h1>
|
|
93
|
+
<p>Your project is ready to go!</p>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
await fs.writeFile(path.join(projectDir, "src/pages/index.page.tsx"), pageContent, "utf-8");
|
|
99
|
+
console.log(pc.green("ā Project initialized successfully!"));
|
|
100
|
+
console.log("\nNext steps:");
|
|
101
|
+
console.log(` 1. Run ${pc.cyan("pnpm install")} to install dependencies`);
|
|
102
|
+
console.log(` 2. Run ${pc.cyan("pnpm dev")} to start the dev server`);
|
|
103
|
+
console.log(` 3. Visit ${pc.cyan("http://localhost:3000")} to see your app`);
|
|
104
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check for available updates for the reveal package
|
|
3
|
+
*/
|
|
4
|
+
export declare function runUpgrade(): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Check for dependency updates across the project
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkDependencyUpdates(): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAqFhD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc5D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import prompts from "prompts";
|
|
5
|
+
import pc from "@brillout/picocolors";
|
|
6
|
+
/**
|
|
7
|
+
* Check for available updates for the reveal package
|
|
8
|
+
*/
|
|
9
|
+
export async function runUpgrade() {
|
|
10
|
+
console.log(pc.cyan("\nš RevealUI Framework Upgrade\n"));
|
|
11
|
+
console.log(pc.gray("Checking for updates...\n"));
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
14
|
+
try {
|
|
15
|
+
const packageJsonContent = await fs.readFile(packageJsonPath, "utf-8");
|
|
16
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
17
|
+
const currentVersion = packageJson.dependencies?.reveal ||
|
|
18
|
+
packageJson.devDependencies?.reveal ||
|
|
19
|
+
"not found";
|
|
20
|
+
console.log(pc.cyan(`Current version: ${currentVersion}\n`));
|
|
21
|
+
// Check for latest version
|
|
22
|
+
try {
|
|
23
|
+
const latestVersion = execSync("npm view reveal version", {
|
|
24
|
+
encoding: "utf-8",
|
|
25
|
+
}).trim();
|
|
26
|
+
console.log(pc.cyan(`Latest version: ${latestVersion}\n`));
|
|
27
|
+
if (currentVersion === latestVersion || currentVersion.includes(latestVersion)) {
|
|
28
|
+
console.log(pc.green("ā You're already on the latest version!\n"));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Show changelog info
|
|
32
|
+
console.log(pc.yellow("New version available!\n"));
|
|
33
|
+
console.log(pc.gray("To see what's new, visit: https://github.com/RevealUIStudio/reveal/releases\n"));
|
|
34
|
+
// Ask for confirmation
|
|
35
|
+
const response = await prompts({
|
|
36
|
+
type: "confirm",
|
|
37
|
+
name: "upgrade",
|
|
38
|
+
message: `Upgrade from ${currentVersion} to ${latestVersion}?`,
|
|
39
|
+
initial: true,
|
|
40
|
+
});
|
|
41
|
+
if (!response.upgrade) {
|
|
42
|
+
console.log(pc.yellow("\nUpgrade cancelled."));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Perform upgrade
|
|
46
|
+
console.log(pc.cyan("\nUpgrading...\n"));
|
|
47
|
+
const isDevDependency = packageJson.devDependencies?.reveal;
|
|
48
|
+
const command = isDevDependency
|
|
49
|
+
? `pnpm add -D reveal@${latestVersion}`
|
|
50
|
+
: `pnpm add reveal@${latestVersion}`;
|
|
51
|
+
execSync(command, {
|
|
52
|
+
cwd,
|
|
53
|
+
stdio: "inherit",
|
|
54
|
+
});
|
|
55
|
+
console.log(pc.green("\nā
Upgrade complete!\n"));
|
|
56
|
+
console.log(pc.cyan("Next steps:"));
|
|
57
|
+
console.log(pc.gray(" 1. Review the changelog for breaking changes"));
|
|
58
|
+
console.log(pc.gray(" 2. Run 'reveal doctor' to check for any issues"));
|
|
59
|
+
console.log(pc.gray(" 3. Update your code if necessary\n"));
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.log(pc.yellow("\nā Could not check for latest version. Make sure you're connected to the internet."));
|
|
63
|
+
console.log(pc.gray("You can manually upgrade by running:\n"));
|
|
64
|
+
console.log(pc.cyan(" pnpm add reveal@latest\n"));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error(pc.red("Error reading package.json"), error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check for dependency updates across the project
|
|
74
|
+
*/
|
|
75
|
+
export async function checkDependencyUpdates() {
|
|
76
|
+
console.log(pc.cyan("\nš¦ Checking for dependency updates...\n"));
|
|
77
|
+
try {
|
|
78
|
+
execSync("pnpm outdated", {
|
|
79
|
+
stdio: "inherit",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
console.log(pc.yellow("Run 'pnpm outdated' manually to see all dependency updates."));
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import pc from "@brillout/picocolors";
|
|
2
|
+
import { assertUsage } from "@revealui/core/cli/assertions";
|
|
3
|
+
import { assertWarning } from "@revealui/core/cli/assertions/warning";
|
|
4
|
+
// Import from CLI-specific exports (these are properly configured)
|
|
5
|
+
import { runPrerender_forceExit, runPrerenderFromCLI, } from "@revealui/core/cli/prerender";
|
|
6
|
+
import { generateTypes, watchTypes } from "@revealui/core/cli/types";
|
|
7
|
+
import { cac } from "cac";
|
|
8
|
+
import { resolve } from "path";
|
|
9
|
+
import { addPlugin } from "./commands/add.js";
|
|
10
|
+
import { runCheck } from "./commands/check.js";
|
|
11
|
+
import { printDiagnostics, runDiagnostics } from "./commands/doctor/index.js";
|
|
12
|
+
import { runFix } from "./commands/fix.js";
|
|
13
|
+
import { initProject } from "./commands/init.js";
|
|
14
|
+
import { runUpgrade } from "./commands/upgrade.js";
|
|
15
|
+
import { projectInfo } from "./utils.js";
|
|
16
|
+
const cli = cac(projectInfo.projectName);
|
|
17
|
+
cli
|
|
18
|
+
.command("prerender", "Pre-render the HTML of your pages", {
|
|
19
|
+
allowUnknownOptions: true,
|
|
20
|
+
})
|
|
21
|
+
.option("--configFile <path>", "[string] Path to vite.config.js")
|
|
22
|
+
.action(async (options) => {
|
|
23
|
+
assertOptions();
|
|
24
|
+
const { partial, noExtraDir, base, parallel, outDir, configFile } = options;
|
|
25
|
+
const root = options.root && resolve(options.root);
|
|
26
|
+
await runPrerenderFromCLI({
|
|
27
|
+
partial,
|
|
28
|
+
noExtraDir,
|
|
29
|
+
base,
|
|
30
|
+
root,
|
|
31
|
+
parallel,
|
|
32
|
+
outDir,
|
|
33
|
+
configFile,
|
|
34
|
+
});
|
|
35
|
+
runPrerender_forceExit();
|
|
36
|
+
});
|
|
37
|
+
cli
|
|
38
|
+
.command("generate", "Generate types from routes and PayloadCMS collections")
|
|
39
|
+
.option("--watch", "[boolean] Watch for changes and regenerate types")
|
|
40
|
+
.option("--output <dir>", "[string] Output directory for generated types")
|
|
41
|
+
.action(async (options) => {
|
|
42
|
+
const outputDir = options.output
|
|
43
|
+
? resolve(options.output)
|
|
44
|
+
: resolve(process.cwd(), ".reveal", "types");
|
|
45
|
+
if (options.watch) {
|
|
46
|
+
console.log(pc.cyan("Watching for changes..."));
|
|
47
|
+
await watchTypes(outputDir, () => {
|
|
48
|
+
console.log(pc.green("Types regenerated"));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
await generateTypes(outputDir);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
cli
|
|
56
|
+
.command("init", "Initialize a new RevealUI project")
|
|
57
|
+
.option("--template <name>", "[string] Project template (basic, blog, e-commerce, portfolio)")
|
|
58
|
+
.option("--typescript", "[boolean] Use TypeScript")
|
|
59
|
+
.option("--tailwind", "[boolean] Use Tailwind CSS")
|
|
60
|
+
.option("--payload", "[boolean] Include PayloadCMS")
|
|
61
|
+
.action(async (options) => {
|
|
62
|
+
await initProject({
|
|
63
|
+
template: options.template,
|
|
64
|
+
useTypeScript: options.typescript,
|
|
65
|
+
useTailwind: options.tailwind,
|
|
66
|
+
usePayload: options.payload,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
cli
|
|
70
|
+
.command("add <plugin>", "Add a plugin to your project")
|
|
71
|
+
.action(async (pluginName) => {
|
|
72
|
+
if (!pluginName) {
|
|
73
|
+
console.error(pc.red("Error: Plugin name is required"));
|
|
74
|
+
console.log("Usage: reveal add <plugin-name>");
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
await addPlugin({ pluginName });
|
|
78
|
+
});
|
|
79
|
+
cli
|
|
80
|
+
.command("doctor", "Run health diagnostics on your project")
|
|
81
|
+
.action(async () => {
|
|
82
|
+
const results = await runDiagnostics();
|
|
83
|
+
printDiagnostics(results);
|
|
84
|
+
const hasFailures = results.some((r) => r.status === "fail");
|
|
85
|
+
if (hasFailures) {
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
cli.command("check", "Quick health check (for CI/CD)").action(async () => {
|
|
90
|
+
const exitCode = await runCheck();
|
|
91
|
+
process.exit(exitCode);
|
|
92
|
+
});
|
|
93
|
+
cli.command("fix", "Automatically fix common issues").action(async () => {
|
|
94
|
+
await runFix();
|
|
95
|
+
});
|
|
96
|
+
cli
|
|
97
|
+
.command("upgrade", "Upgrade RevealUI Framework to the latest version")
|
|
98
|
+
.action(async () => {
|
|
99
|
+
await runUpgrade();
|
|
100
|
+
});
|
|
101
|
+
function assertOptions() {
|
|
102
|
+
// Using process.argv because cac convert names to camelCase
|
|
103
|
+
const rawOptions = process.argv.slice(3);
|
|
104
|
+
Object.values(rawOptions).forEach((option) => {
|
|
105
|
+
assertUsage(!option.startsWith("--") ||
|
|
106
|
+
[
|
|
107
|
+
"--root",
|
|
108
|
+
"--partial",
|
|
109
|
+
"--noExtraDir",
|
|
110
|
+
"--clientRouter",
|
|
111
|
+
"--base",
|
|
112
|
+
"--parallel",
|
|
113
|
+
"--outDir",
|
|
114
|
+
"--configFile",
|
|
115
|
+
].includes(option), "Unknown option: " + option);
|
|
116
|
+
assertWarning(false, `You set ${pc.cyan(option)}, but passing options to ${pc.cyan("$ reveal prerender")} is deprecated: use the config file instead. See https://reveal.dev/command-prerender.`, { onlyOnce: true });
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
// Listen to unknown commands
|
|
120
|
+
cli.on("command:*", () => {
|
|
121
|
+
assertUsage(false, "Unknown command: " + cli.args.join(" "));
|
|
122
|
+
});
|
|
123
|
+
cli.help();
|
|
124
|
+
cli.version(projectInfo.projectVersion);
|
|
125
|
+
cli.parse(process.argv.length === 2 ? [...process.argv, "--help"] : process.argv);
|
|
126
|
+
process.on("unhandledRejection", (rejectValue) => {
|
|
127
|
+
throw rejectValue;
|
|
128
|
+
});
|
package/dist/onLoad.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onLoad.d.ts","sourceRoot":"","sources":["../src/onLoad.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,iBAAS,MAAM,SAEd"}
|
package/dist/onLoad.js
ADDED
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,cAAc,sCAAsC,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// We assume all runtime entries will load this utils.ts file
|
|
2
|
+
import { onLoad } from "./onLoad.js";
|
|
3
|
+
onLoad();
|
|
4
|
+
// Export from CLI-specific exports (these avoid directory import issues)
|
|
5
|
+
export * from "@revealui/core/cli/assertions/assert";
|
|
6
|
+
export { projectInfo } from "@revealui/core/cli/projectInfo";
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@revealui/cli",
|
|
3
|
+
"version": "0.0.1-pre.1",
|
|
4
|
+
"description": "Command-line interface for RevealUI Framework",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"revealui": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"cac": "^6.7.14",
|
|
18
|
+
"@brillout/picocolors": "^1.0.29",
|
|
19
|
+
"prompts": "^2.4.2",
|
|
20
|
+
"@revealui/core": "0.0.1-pre.4"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^24.10.1",
|
|
24
|
+
"@types/prompts": "^2.4.9",
|
|
25
|
+
"rimraf": "^6.1.2",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/RevealUIStudio/reveal.git",
|
|
34
|
+
"directory": "packages/cli"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://revealui.com",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/RevealUIStudio/reveal/issues"
|
|
39
|
+
},
|
|
40
|
+
"license": "Apache-2.0",
|
|
41
|
+
"author": "RevealUI Team",
|
|
42
|
+
"keywords": [
|
|
43
|
+
"revealui",
|
|
44
|
+
"cli",
|
|
45
|
+
"command-line",
|
|
46
|
+
"framework",
|
|
47
|
+
"tool"
|
|
48
|
+
],
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22.0.0"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "rimraf ./dist",
|
|
54
|
+
"build": "pnpm run clean && pnpm run build:ts",
|
|
55
|
+
"build:ts": "tsc -p tsconfig.json",
|
|
56
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
57
|
+
}
|
|
58
|
+
}
|