inai-react-components 0.1.0 → 0.1.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/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const AVAILABLE_THEMES: readonly ["monday", "linear", "notion", "vercel"];
|
|
1
|
+
declare const AVAILABLE_THEMES: readonly ["monday", "linear", "notion", "vercel", "inai", "anthropic", "shadcn-default", "shadcn-blue", "shadcn-green", "shadcn-orange", "shadcn-red", "shadcn-rose", "shadcn-violet", "shadcn-yellow"];
|
|
2
2
|
type Theme = (typeof AVAILABLE_THEMES)[number];
|
|
3
3
|
export interface InitConfig {
|
|
4
4
|
componentPath: string;
|
|
@@ -32,7 +32,7 @@ export interface ComponentsJson {
|
|
|
32
32
|
table: boolean;
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
export declare function promptInitConfig(): Promise<InitConfig | null>;
|
|
35
|
+
export declare function promptInitConfig(registryDir?: string): Promise<InitConfig | null>;
|
|
36
36
|
export declare function buildComponentsJson(config: InitConfig, repoUrl?: string): ComponentsJson;
|
|
37
37
|
export declare function getCnTemplate(): string;
|
|
38
38
|
export declare function getLocalTailwindCssTemplate(theme: Theme): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,gBAAgB,yMAeZ,CAAC;AACX,KAAK,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EA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,CAAC,CA4CvD;AAED,wBAAsB,WAAW,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0DjE"}
|
package/dist/commands/init.js
CHANGED
|
@@ -4,8 +4,37 @@ import chalk from "chalk";
|
|
|
4
4
|
import ora from "ora";
|
|
5
5
|
import prompts from "prompts";
|
|
6
6
|
import { cloneRegistry, getCacheDir } from "../utils/registry-resolver.js";
|
|
7
|
-
const AVAILABLE_THEMES = [
|
|
8
|
-
|
|
7
|
+
const AVAILABLE_THEMES = [
|
|
8
|
+
"monday",
|
|
9
|
+
"linear",
|
|
10
|
+
"notion",
|
|
11
|
+
"vercel",
|
|
12
|
+
"inai",
|
|
13
|
+
"anthropic",
|
|
14
|
+
"shadcn-default",
|
|
15
|
+
"shadcn-blue",
|
|
16
|
+
"shadcn-green",
|
|
17
|
+
"shadcn-orange",
|
|
18
|
+
"shadcn-red",
|
|
19
|
+
"shadcn-rose",
|
|
20
|
+
"shadcn-violet",
|
|
21
|
+
"shadcn-yellow",
|
|
22
|
+
];
|
|
23
|
+
function discoverThemes(registryDir) {
|
|
24
|
+
if (registryDir) {
|
|
25
|
+
const themesDir = path.join(registryDir, "packages", "tokens", "src", "themes");
|
|
26
|
+
if (fs.existsSync(themesDir)) {
|
|
27
|
+
return fs
|
|
28
|
+
.readdirSync(themesDir)
|
|
29
|
+
.filter((f) => f.endsWith(".css"))
|
|
30
|
+
.map((f) => f.replace(/\.css$/, ""))
|
|
31
|
+
.sort();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [...AVAILABLE_THEMES];
|
|
35
|
+
}
|
|
36
|
+
export async function promptInitConfig(registryDir) {
|
|
37
|
+
const themes = discoverThemes(registryDir);
|
|
9
38
|
const response = await prompts([
|
|
10
39
|
{
|
|
11
40
|
type: "text",
|
|
@@ -23,7 +52,7 @@ export async function promptInitConfig() {
|
|
|
23
52
|
type: "select",
|
|
24
53
|
name: "theme",
|
|
25
54
|
message: "Which base theme would you like to use?",
|
|
26
|
-
choices:
|
|
55
|
+
choices: themes.map((t) => ({ title: t, value: t })),
|
|
27
56
|
initial: 0,
|
|
28
57
|
},
|
|
29
58
|
{
|
|
@@ -237,7 +266,8 @@ export async function initCommand(repoUrl) {
|
|
|
237
266
|
process.exit(1);
|
|
238
267
|
}
|
|
239
268
|
}
|
|
240
|
-
const
|
|
269
|
+
const registryDir = repoUrl ? getCacheDir() : undefined;
|
|
270
|
+
const config = await promptInitConfig(registryDir);
|
|
241
271
|
if (!config) {
|
|
242
272
|
console.log(chalk.yellow("\nInitialization cancelled."));
|
|
243
273
|
process.exit(0);
|
package/package.json
CHANGED