Skip to content

Commit 5e94185

Browse files
committed
make aliases
1 parent 80a6375 commit 5e94185

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build": "bun build ./src/index.ts --outdir ./dist --target=node --minify",
2121
"format": "biome lint --fix && biome check --write",
2222
"test": "bun run build && bun link",
23-
"preview": "bun run clean && bun run build && bun link",
23+
"preview": "bun run build && bun link",
2424
"pr": "bun run build && git commit -a",
2525
"pre": "chmod a+x dist/index.js",
2626
"release": "export GITHUB_TOKEN=$(cat .github_token) && release-it",

src/commands/add.command.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,31 @@ import { REGISTRY_URL } from "~/consts"
55
import { Command as RawCommand } from "@effect/platform"
66

77
export const componentNames = Args.text({ name: "componentNames" }).pipe(Args.repeated)
8-
8+
export const isBlock = Options.boolean("b")
9+
export const isStyle = Options.boolean("s")
910
export const componentType = Options.choice("type", ["ui", "block", "style"]).pipe(
11+
Options.withAlias("t"),
1012
Options.withDefault("ui"),
1113
)
1214

13-
export const addCommand = Command.make("add", { componentNames, componentType }, (config) =>
14-
Effect.gen(function* () {
15-
const componentPaths = yield* Effect.forEach(config.componentNames, (name) =>
16-
Effect.succeed(`${REGISTRY_URL}/r/${config.componentType}-${name}.json`),
17-
)
18-
19-
const exitCode = yield* RawCommand.make("bunx", "shadcn", "add", ...componentPaths).pipe(
20-
RawCommand.stdin("inherit"),
21-
RawCommand.stdout("inherit"),
22-
RawCommand.stderr("inherit"),
23-
RawCommand.exitCode,
24-
)
25-
}),
15+
export const addCommand = Command.make(
16+
"add",
17+
{ componentNames, isBlock, isStyle, componentType },
18+
({ componentNames, isBlock, isStyle, componentType }) =>
19+
Effect.gen(function* ($) {
20+
const type = isBlock ? "block" : isStyle ? "style" : componentType
21+
const componentPaths = yield* $(
22+
Effect.forEach(componentNames, (name) =>
23+
Effect.succeed(`${REGISTRY_URL}/r/${type}-${name}.json`),
24+
),
25+
)
26+
return yield* $(
27+
RawCommand.make("bunx", "shadcn", "add", ...componentPaths).pipe(
28+
RawCommand.stdin("inherit"),
29+
RawCommand.stdout("inherit"),
30+
RawCommand.stderr("inherit"),
31+
RawCommand.exitCode,
32+
),
33+
)
34+
}),
2635
).pipe(Command.withDescription("Adds UI components or blocks to your project."))

src/commands/login.command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const saveApiKey = (apiKey: string) =>
7878

7979
export const loginCommand = Command.make("login", {}, () =>
8080
Effect.gen(function* () {
81-
yield* Console.log("Attempting to log in to IntentUI Blocks...")
81+
yield* Console.log("Attempting to log in to Intent UI Blocks...")
8282

8383
const domain = yield* DOMAIN_CONFIG
8484

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const rootCommand = Command.make("root", {}, () =>
5656
}
5757

5858
yield* Console.log("")
59-
yield* Console.log(chalk.bold.yellow("IntentUI CLI is ready to use!"))
59+
yield* Console.log(chalk.bold.yellow("Intent UI CLI is ready to use!"))
6060
yield* Console.log(chalk.cyan("Run 'intentui --help' to see all available commands."))
6161
yield* Console.log("")
6262
}),
@@ -67,8 +67,8 @@ const command = rootCommand.pipe(
6767
)
6868

6969
const cli = Command.run(command, {
70-
name: "IntentUI Cli",
71-
version: "v0.0.1",
70+
name: "Intent UI CLI",
71+
version: "v2.9.0",
7272
})
7373

7474
cli(process.argv).pipe(Effect.scoped, Effect.provide(BunContext.layer), BunRuntime.runMain)

0 commit comments

Comments
 (0)