@beaket/ui 1.6.0 → 1.8.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/package.json +1 -1
- package/src/commands/init.ts +29 -20
- package/src/index.ts +5 -1
- package/src/utils/files.ts +1 -1
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -106,33 +106,42 @@ const CSS_VARIABLES = `
|
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
interface InitOptions {
|
|
110
|
+
yes?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export async function init(options: InitOptions) {
|
|
110
114
|
console.log();
|
|
111
115
|
console.log(pc.bold("Initializing Beaket UI..."));
|
|
112
116
|
console.log();
|
|
113
117
|
|
|
114
|
-
// Auto-detect defaults based on project structure
|
|
115
118
|
const detectedComponentsPath = await detectAliasPath();
|
|
116
119
|
const detectedCssPath = await detectCssPath();
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
121
|
+
let response: { components: string; css: string };
|
|
122
|
+
|
|
123
|
+
if (options.yes) {
|
|
124
|
+
response = { components: detectedComponentsPath, css: detectedCssPath };
|
|
125
|
+
} else {
|
|
126
|
+
response = await prompts([
|
|
127
|
+
{
|
|
128
|
+
type: "text",
|
|
129
|
+
name: "components",
|
|
130
|
+
message: "Where should components be installed?",
|
|
131
|
+
initial: detectedComponentsPath,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: "text",
|
|
135
|
+
name: "css",
|
|
136
|
+
message: "Where is your Tailwind CSS file?",
|
|
137
|
+
initial: detectedCssPath,
|
|
138
|
+
},
|
|
139
|
+
]);
|
|
140
|
+
|
|
141
|
+
if (!response.components) {
|
|
142
|
+
console.log(pc.red("Cancelled."));
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
136
145
|
}
|
|
137
146
|
|
|
138
147
|
// Write beaket.ui.json (only components path)
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,11 @@ program
|
|
|
15
15
|
.description("CLI for adding Beaket UI components to your project")
|
|
16
16
|
.version(version);
|
|
17
17
|
|
|
18
|
-
program
|
|
18
|
+
program
|
|
19
|
+
.command("init")
|
|
20
|
+
.description("Initialize Beaket UI in your project")
|
|
21
|
+
.option("-y, --yes", "Use defaults without prompting")
|
|
22
|
+
.action(init);
|
|
19
23
|
|
|
20
24
|
program
|
|
21
25
|
.command("add")
|
package/src/utils/files.ts
CHANGED
|
@@ -74,7 +74,7 @@ async function detectPackageManager(): Promise<"npm" | "pnpm" | "yarn" | "bun">
|
|
|
74
74
|
if (await fs.pathExists(path.join(cwd, "yarn.lock"))) {
|
|
75
75
|
return "yarn";
|
|
76
76
|
}
|
|
77
|
-
if (await fs.pathExists(path.join(cwd, "bun.
|
|
77
|
+
if (await fs.pathExists(path.join(cwd, "bun.lock"))) {
|
|
78
78
|
return "bun";
|
|
79
79
|
}
|
|
80
80
|
|