move stuff around until it feels right

This commit is contained in:
MapleLeaf
2021-12-26 12:06:06 -06:00
parent d10618e3c1
commit 894e6abb26
35 changed files with 30 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
import type { CommandInteraction, ComponentInteraction } from "./interaction" import type { CommandInteraction, ComponentInteraction } from "../interaction"
export type Adapter<InteractionInit> = { export type Adapter<InteractionInit> = {
addComponentInteractionListener( addComponentInteractionListener(

View File

@@ -1,9 +1,9 @@
import type * as Discord from "discord.js" 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 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<Discord.CommandInteraction> { export class DiscordJsAdapter implements Adapter<Discord.CommandInteraction> {
constructor(private client: Discord.Client) {} constructor(private client: Discord.Client) {}
@@ -18,6 +18,7 @@ export class DiscordJsAdapter implements Adapter<Discord.CommandInteraction> {
}) })
} }
// eslint-disable-next-line class-methods-use-this
createCommandInteraction( createCommandInteraction(
interaction: Discord.CommandInteraction, interaction: Discord.CommandInteraction,
): CommandInteraction { ): CommandInteraction {

View File

@@ -1,12 +1,12 @@
import { nanoid } from "nanoid" import { nanoid } from "nanoid"
import type { Adapter } from "./adapter" import { raise } from "../../helpers/raise"
import { raise } from "./helpers/raise"
import type { import type {
ButtonInteraction, ButtonInteraction,
CommandInteraction, CommandInteraction,
ComponentInteraction, ComponentInteraction,
} from "./interaction" } from "../interaction"
import type { Message, MessageButtonOptions, MessageOptions } from "./message" import type { Message, MessageButtonOptions, MessageOptions } from "../message"
import type { Adapter } from "./adapter"
export class TestAdapter implements Adapter<{}> { export class TestAdapter implements Adapter<{}> {
readonly messages: TestMessage[] = [] readonly messages: TestMessage[] = []

View File

@@ -1,7 +1,7 @@
import { nanoid } from "nanoid" import { nanoid } from "nanoid"
import React from "react" import React from "react"
import { last } from "../helpers/last.js"
import { ReacordElement } from "./element.js" import { ReacordElement } from "./element.js"
import { last } from "./helpers/last.js"
import type { ButtonInteraction, ComponentInteraction } from "./interaction" import type { ButtonInteraction, ComponentInteraction } from "./interaction"
import type { MessageOptions } from "./message" import type { MessageOptions } from "./message"
import { Node } from "./node.js" import { Node } from "./node.js"

View File

@@ -1,6 +1,6 @@
import React from "react" import React from "react"
import { omit } from "../../helpers/omit"
import { ReacordElement } from "../element.js" import { ReacordElement } from "../element.js"
import { omit } from "../helpers/omit"
import type { MessageOptions } from "../message" import type { MessageOptions } from "../message"
import { Node } from "../node.js" import { Node } from "../node.js"
import { EmbedChildNode } from "./embed-child.js" import { EmbedChildNode } from "./embed-child.js"

View File

@@ -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 "./button"
export * from "./discord-js-adapter"
export * from "./embed/embed" export * from "./embed/embed"
export * from "./embed/embed-field" export * from "./embed/embed-field"
export * from "./embed/embed-title" export * from "./embed/embed-title"

View File

@@ -1,5 +1,5 @@
import type { ReactNode } from "react" import type { ReactNode } from "react"
import type { Adapter } from "./adapter" import type { Adapter } from "./adapter/adapter"
import { reconciler } from "./reconciler.js" import { reconciler } from "./reconciler.js"
import { Renderer } from "./renderer.js" import { Renderer } from "./renderer.js"

View File

@@ -1,6 +1,6 @@
import type { HostConfig } from "react-reconciler" import type { HostConfig } from "react-reconciler"
import ReactReconciler 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 { Node } from "./node.js"
import type { Renderer } from "./renderer.js" import type { Renderer } from "./renderer.js"
import { TextNode } from "./text.js" import { TextNode } from "./text.js"

View File

@@ -12,7 +12,7 @@
"require": "./dist/main.cjs" "require": "./dist/main.cjs"
}, },
"scripts": { "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", "build-watch": "pnpm build -- --watch",
"lint": "eslint --ext js,ts,tsx .", "lint": "eslint --ext js,ts,tsx .",
"lint-fix": "pnpm lint -- --fix", "lint-fix": "pnpm lint -- --fix",

View File

@@ -1,5 +1,5 @@
import * as React from "react" 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 }) { export function Counter(props: { onDeactivate: () => void }) {
const [count, setCount] = React.useState(0) const [count, setCount] = React.useState(0)

View File

@@ -1,8 +1,7 @@
import { Client } from "discord.js" import { Client } from "discord.js"
import "dotenv/config" import "dotenv/config"
import React from "react" import React from "react"
import { DiscordJsAdapter } from "../src/discord-js-adapter" import { DiscordJsAdapter, Reacord } from "../library/main.js"
import { Reacord } from "../src/main.js"
import { createCommandHandler } from "./command-handler.js" import { createCommandHandler } from "./command-handler.js"
import { Counter } from "./counter.js" import { Counter } from "./counter.js"

View File

@@ -1,9 +1,16 @@
import { nextTick } from "node:process" import { nextTick } from "node:process"
import { promisify } from "node:util" import { promisify } from "node:util"
import * as React from "react" import * as React from "react"
import { omit } from "../src/helpers/omit" import { omit } from "../helpers/omit"
import { Button, Embed, EmbedField, EmbedTitle, Reacord } from "../src/main" import {
import { TestAdapter, TestCommandInteraction } from "../src/test-adapter" Button,
Embed,
EmbedField,
EmbedTitle,
Reacord,
TestAdapter,
TestCommandInteraction,
} from "../library/main"
const nextTickPromise = promisify(nextTick) const nextTickPromise = promisify(nextTick)