Skip to content

Commit f60808a

Browse files
committed
chore: format
1 parent 89a7330 commit f60808a

File tree

8 files changed

+305
-281
lines changed

8 files changed

+305
-281
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "The command line interface for Intent UI.",
66
"main": "dist/index.js",
77
"bin": {
8-
"intentui": "dist/index.js"
8+
"intentui": "src/index.ts"
99
},
1010
"files": ["dist", "src/resources", "LICENSE", "README.md", "package.json"],
1111
"repository": {

src/commands/add.command.ts

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,24 @@
1-
import { Args, Command, Options } from "@effect/cli";
2-
import { Effect } from "effect";
3-
import { REGISTRY_URL } from "~/consts";
1+
import { Args, Command, Options } from "@effect/cli"
2+
import { Effect } from "effect"
3+
import { REGISTRY_URL } from "~/consts"
44

5-
import { Command as RawCommand } from "@effect/platform";
5+
import { Command as RawCommand } from "@effect/platform"
66

7-
export const componentNames = Args.text({ name: "componentNames" }).pipe(
8-
Args.repeated,
9-
);
7+
export const componentNames = Args.text({ name: "componentNames" }).pipe(Args.repeated)
108

11-
export const componentType = Options.choice("type", ["ui", "block"]).pipe(
12-
Options.withDefault("ui"),
13-
);
9+
export const componentType = Options.choice("type", ["ui", "block"]).pipe(Options.withDefault("ui"))
1410

15-
export const addCommand = Command.make(
16-
"add",
17-
{ componentNames, componentType },
18-
(config) =>
19-
Effect.gen(function* () {
20-
const componentPaths = yield* Effect.forEach(
21-
config.componentNames,
22-
(name) =>
23-
Effect.succeed(
24-
`${REGISTRY_URL}/r/${config.componentType}-${name}.json`,
25-
),
26-
);
11+
export const addCommand = Command.make("add", { componentNames, componentType }, (config) =>
12+
Effect.gen(function* () {
13+
const componentPaths = yield* Effect.forEach(config.componentNames, (name) =>
14+
Effect.succeed(`${REGISTRY_URL}/r/${config.componentType}-${name}.json`),
15+
)
2716

28-
const exitCode = yield* RawCommand.make(
29-
"bunx",
30-
"shadcn",
31-
"add",
32-
...componentPaths,
33-
).pipe(
34-
RawCommand.stdin("inherit"),
35-
RawCommand.stdout("inherit"),
36-
RawCommand.stderr("inherit"),
37-
RawCommand.exitCode,
38-
);
39-
}),
40-
).pipe(Command.withDescription("Adds UI components or blocks to your project."));
17+
const exitCode = yield* RawCommand.make("bunx", "shadcn", "add", ...componentPaths).pipe(
18+
RawCommand.stdin("inherit"),
19+
RawCommand.stdout("inherit"),
20+
RawCommand.stderr("inherit"),
21+
RawCommand.exitCode,
22+
)
23+
}),
24+
).pipe(Command.withDescription("Adds UI components or blocks to your project."))

src/commands/diff.command.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import { Command } from "@effect/cli";
2-
import { Console, Effect } from "effect";
3-
import { componentNames, componentType } from "./add.command";
1+
import { Command } from "@effect/cli"
2+
import { Console, Effect } from "effect"
3+
import { componentNames, componentType } from "./add.command"
44

5-
export const diffCommand = Command.make(
6-
"diff",
7-
{ componentNames, componentType },
8-
(config) =>
9-
Effect.gen(function* () {
10-
yield* Console.log("Coming soon...");
11-
}),
12-
).pipe(Command.withDescription("Compares your local components with the registry versions."));
5+
export const diffCommand = Command.make("diff", { componentNames, componentType }, (config) =>
6+
Effect.gen(function* () {
7+
yield* Console.log("Coming soon...")
8+
}),
9+
).pipe(Command.withDescription("Compares your local components with the registry versions."))

src/commands/init.command.ts

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,30 @@
1-
import { Command } from "@effect/cli";
2-
import { Effect } from "effect";
1+
import { Command } from "@effect/cli"
2+
import { Effect } from "effect"
33

4-
import { Command as RawCommand } from "@effect/platform";
5-
import { REGISTRY_URL } from "~/consts";
4+
import { Command as RawCommand } from "@effect/platform"
5+
import { REGISTRY_URL } from "~/consts"
66

7-
import { BunCommandExecutor } from "@effect/platform-bun";
7+
import { BunCommandExecutor } from "@effect/platform-bun"
88

9-
const shadcnInit = RawCommand.make(
10-
"bunx",
11-
"shadcn",
12-
"init",
13-
`${REGISTRY_URL}/r/default.json`,
14-
).pipe(
15-
RawCommand.stdin("inherit"),
16-
RawCommand.stdout("inherit"),
17-
RawCommand.stderr("inherit"),
18-
);
9+
const shadcnInit = RawCommand.make("bunx", "shadcn", "init", `${REGISTRY_URL}/r/default.json`).pipe(
10+
RawCommand.stdin("inherit"),
11+
RawCommand.stdout("inherit"),
12+
RawCommand.stderr("inherit"),
13+
)
1914

2015
export const initCommand = Command.make("init", {}, () =>
21-
Effect.gen(function* () {
22-
const results = yield* RawCommand.exitCode(shadcnInit);
23-
// const test = yield* Effect.tryPromise(
24-
// async () =>
25-
// await execa(
26-
// "bunx",
27-
// ["shadcn", "init", `${REGISTRY_URL}/r/default.json`],
28-
// {
29-
// stdio: "inherit",
30-
// reject: false,
31-
// },
32-
// ),
33-
// );
34-
}).pipe(Effect.scoped, Effect.provide(BunCommandExecutor.layer)),
35-
).pipe(Command.withDescription("Initializes the project and sets up necessary configurations."));
16+
Effect.gen(function* () {
17+
const results = yield* RawCommand.exitCode(shadcnInit)
18+
// const test = yield* Effect.tryPromise(
19+
// async () =>
20+
// await execa(
21+
// "bunx",
22+
// ["shadcn", "init", `${REGISTRY_URL}/r/default.json`],
23+
// {
24+
// stdio: "inherit",
25+
// reject: false,
26+
// },
27+
// ),
28+
// );
29+
}).pipe(Effect.scoped, Effect.provide(BunCommandExecutor.layer)),
30+
).pipe(Command.withDescription("Initializes the project and sets up necessary configurations."))

0 commit comments

Comments
 (0)