diff --git a/src/helpers/get-environment-value.ts b/helpers/get-environment-value.ts similarity index 100% rename from src/helpers/get-environment-value.ts rename to helpers/get-environment-value.ts diff --git a/src/helpers/last.ts b/helpers/last.ts similarity index 100% rename from src/helpers/last.ts rename to helpers/last.ts diff --git a/src/helpers/log-pretty.ts b/helpers/log-pretty.ts similarity index 100% rename from src/helpers/log-pretty.ts rename to helpers/log-pretty.ts diff --git a/src/helpers/omit.ts b/helpers/omit.ts similarity index 100% rename from src/helpers/omit.ts rename to helpers/omit.ts diff --git a/src/helpers/pick.ts b/helpers/pick.ts similarity index 100% rename from src/helpers/pick.ts rename to helpers/pick.ts diff --git a/src/helpers/raise.ts b/helpers/raise.ts similarity index 100% rename from src/helpers/raise.ts rename to helpers/raise.ts diff --git a/src/helpers/reject-after.ts b/helpers/reject-after.ts similarity index 100% rename from src/helpers/reject-after.ts rename to helpers/reject-after.ts diff --git a/src/helpers/retry-with-timeout.ts b/helpers/retry-with-timeout.ts similarity index 100% rename from src/helpers/retry-with-timeout.ts rename to helpers/retry-with-timeout.ts diff --git a/src/helpers/to-error.ts b/helpers/to-error.ts similarity index 100% rename from src/helpers/to-error.ts rename to helpers/to-error.ts diff --git a/src/helpers/to-upper.ts b/helpers/to-upper.ts similarity index 100% rename from src/helpers/to-upper.ts rename to helpers/to-upper.ts diff --git a/src/helpers/types.ts b/helpers/types.ts similarity index 100% rename from src/helpers/types.ts rename to helpers/types.ts diff --git a/src/helpers/with-logged-method-calls.ts b/helpers/with-logged-method-calls.ts similarity index 100% rename from src/helpers/with-logged-method-calls.ts rename to helpers/with-logged-method-calls.ts diff --git a/src/adapter.ts b/library/adapter/adapter.ts similarity index 95% rename from src/adapter.ts rename to library/adapter/adapter.ts index beb40d3..48f0d4d 100644 --- a/src/adapter.ts +++ b/library/adapter/adapter.ts @@ -1,4 +1,4 @@ -import type { CommandInteraction, ComponentInteraction } from "./interaction" +import type { CommandInteraction, ComponentInteraction } from "../interaction" export type Adapter = { addComponentInteractionListener( diff --git a/src/discord-js-adapter.ts b/library/adapter/discord-js-adapter.ts similarity index 92% rename from src/discord-js-adapter.ts rename to library/adapter/discord-js-adapter.ts index 41ff42e..8c14d44 100644 --- a/src/discord-js-adapter.ts +++ b/library/adapter/discord-js-adapter.ts @@ -1,9 +1,9 @@ import type * as Discord from "discord.js" +import { raise } from "../../helpers/raise" +import { toUpper } from "../../helpers/to-upper" +import type { CommandInteraction, ComponentInteraction } from "../interaction" +import type { Message, MessageOptions } from "../message" import type { Adapter } from "./adapter" -import { raise } from "./helpers/raise" -import { toUpper } from "./helpers/to-upper" -import type { CommandInteraction, ComponentInteraction } from "./interaction" -import type { Message, MessageOptions } from "./message" export class DiscordJsAdapter implements Adapter { constructor(private client: Discord.Client) {} @@ -18,6 +18,7 @@ export class DiscordJsAdapter implements Adapter { }) } + // eslint-disable-next-line class-methods-use-this createCommandInteraction( interaction: Discord.CommandInteraction, ): CommandInteraction { diff --git a/src/test-adapter.ts b/library/adapter/test-adapter.ts similarity index 97% rename from src/test-adapter.ts rename to library/adapter/test-adapter.ts index 9434649..cfd2a7e 100644 --- a/src/test-adapter.ts +++ b/library/adapter/test-adapter.ts @@ -1,12 +1,12 @@ import { nanoid } from "nanoid" -import type { Adapter } from "./adapter" -import { raise } from "./helpers/raise" +import { raise } from "../../helpers/raise" import type { ButtonInteraction, CommandInteraction, ComponentInteraction, -} from "./interaction" -import type { Message, MessageButtonOptions, MessageOptions } from "./message" +} from "../interaction" +import type { Message, MessageButtonOptions, MessageOptions } from "../message" +import type { Adapter } from "./adapter" export class TestAdapter implements Adapter<{}> { readonly messages: TestMessage[] = [] diff --git a/src/button.tsx b/library/button.tsx similarity index 97% rename from src/button.tsx rename to library/button.tsx index 669eedc..049b323 100644 --- a/src/button.tsx +++ b/library/button.tsx @@ -1,7 +1,7 @@ import { nanoid } from "nanoid" import React from "react" +import { last } from "../helpers/last.js" import { ReacordElement } from "./element.js" -import { last } from "./helpers/last.js" import type { ButtonInteraction, ComponentInteraction } from "./interaction" import type { MessageOptions } from "./message" import { Node } from "./node.js" diff --git a/src/container.ts b/library/container.ts similarity index 100% rename from src/container.ts rename to library/container.ts diff --git a/src/element.ts b/library/element.ts similarity index 100% rename from src/element.ts rename to library/element.ts diff --git a/src/embed/embed-child.ts b/library/embed/embed-child.ts similarity index 100% rename from src/embed/embed-child.ts rename to library/embed/embed-child.ts diff --git a/src/embed/embed-field.tsx b/library/embed/embed-field.tsx similarity index 100% rename from src/embed/embed-field.tsx rename to library/embed/embed-field.tsx diff --git a/src/embed/embed-options.ts b/library/embed/embed-options.ts similarity index 100% rename from src/embed/embed-options.ts rename to library/embed/embed-options.ts diff --git a/src/embed/embed-title.tsx b/library/embed/embed-title.tsx similarity index 100% rename from src/embed/embed-title.tsx rename to library/embed/embed-title.tsx diff --git a/src/embed/embed.tsx b/library/embed/embed.tsx similarity index 96% rename from src/embed/embed.tsx rename to library/embed/embed.tsx index ec63782..c103f5e 100644 --- a/src/embed/embed.tsx +++ b/library/embed/embed.tsx @@ -1,6 +1,6 @@ import React from "react" +import { omit } from "../../helpers/omit" import { ReacordElement } from "../element.js" -import { omit } from "../helpers/omit" import type { MessageOptions } from "../message" import { Node } from "../node.js" import { EmbedChildNode } from "./embed-child.js" diff --git a/src/interaction.ts b/library/interaction.ts similarity index 100% rename from src/interaction.ts rename to library/interaction.ts diff --git a/src/main.ts b/library/main.ts similarity index 63% rename from src/main.ts rename to library/main.ts index f53b025..39de9dd 100644 --- a/src/main.ts +++ b/library/main.ts @@ -1,6 +1,7 @@ -export * from "./adapter" +export * from "./adapter/adapter" +export * from "./adapter/discord-js-adapter" +export * from "./adapter/test-adapter" export * from "./button" -export * from "./discord-js-adapter" export * from "./embed/embed" export * from "./embed/embed-field" export * from "./embed/embed-title" diff --git a/src/message.ts b/library/message.ts similarity index 100% rename from src/message.ts rename to library/message.ts diff --git a/src/node.ts b/library/node.ts similarity index 100% rename from src/node.ts rename to library/node.ts diff --git a/src/reacord.ts b/library/reacord.ts similarity index 97% rename from src/reacord.ts rename to library/reacord.ts index 3b8d572..3abf618 100644 --- a/src/reacord.ts +++ b/library/reacord.ts @@ -1,5 +1,5 @@ import type { ReactNode } from "react" -import type { Adapter } from "./adapter" +import type { Adapter } from "./adapter/adapter" import { reconciler } from "./reconciler.js" import { Renderer } from "./renderer.js" diff --git a/src/reconciler.ts b/library/reconciler.ts similarity index 98% rename from src/reconciler.ts rename to library/reconciler.ts index 3cb8f65..933c3d0 100644 --- a/src/reconciler.ts +++ b/library/reconciler.ts @@ -1,6 +1,6 @@ import type { HostConfig } from "react-reconciler" import ReactReconciler from "react-reconciler" -import { raise } from "./helpers/raise.js" +import { raise } from "../helpers/raise.js" import { Node } from "./node.js" import type { Renderer } from "./renderer.js" import { TextNode } from "./text.js" diff --git a/src/renderer.ts b/library/renderer.ts similarity index 100% rename from src/renderer.ts rename to library/renderer.ts diff --git a/src/text.ts b/library/text.ts similarity index 100% rename from src/text.ts rename to library/text.ts diff --git a/package.json b/package.json index 7f00a61..89524b1 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "require": "./dist/main.cjs" }, "scripts": { - "build": "tsup-node src/main.ts --target node16 --format cjs,esm --dts --sourcemap", + "build": "tsup-node library/main.ts --target node16 --format cjs,esm --dts --sourcemap", "build-watch": "pnpm build -- --watch", "lint": "eslint --ext js,ts,tsx .", "lint-fix": "pnpm lint -- --fix", diff --git a/playground/counter.tsx b/playground/counter.tsx index 6fe6c8b..875c82a 100644 --- a/playground/counter.tsx +++ b/playground/counter.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { Button, Embed, EmbedField, EmbedTitle } from "../src/main" +import { Button, Embed, EmbedField, EmbedTitle } from "../library/main" export function Counter(props: { onDeactivate: () => void }) { const [count, setCount] = React.useState(0) diff --git a/playground/main.tsx b/playground/main.tsx index 3fcdf9e..de0deeb 100644 --- a/playground/main.tsx +++ b/playground/main.tsx @@ -1,8 +1,7 @@ import { Client } from "discord.js" import "dotenv/config" import React from "react" -import { DiscordJsAdapter } from "../src/discord-js-adapter" -import { Reacord } from "../src/main.js" +import { DiscordJsAdapter, Reacord } from "../library/main.js" import { createCommandHandler } from "./command-handler.js" import { Counter } from "./counter.js" diff --git a/test/kitchen-sink.test.tsx b/test/kitchen-sink.test.tsx index f6bc823..eb4e08c 100644 --- a/test/kitchen-sink.test.tsx +++ b/test/kitchen-sink.test.tsx @@ -1,9 +1,16 @@ import { nextTick } from "node:process" import { promisify } from "node:util" import * as React from "react" -import { omit } from "../src/helpers/omit" -import { Button, Embed, EmbedField, EmbedTitle, Reacord } from "../src/main" -import { TestAdapter, TestCommandInteraction } from "../src/test-adapter" +import { omit } from "../helpers/omit" +import { + Button, + Embed, + EmbedField, + EmbedTitle, + Reacord, + TestAdapter, + TestCommandInteraction, +} from "../library/main" const nextTickPromise = promisify(nextTick)