Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96affac979 | ||
|
|
93b321dc36 | ||
|
|
e313399a5a | ||
|
|
90744ebe47 | ||
|
|
33bb2ee196 | ||
|
|
eb97b2d23d | ||
|
|
5aaaffbda9 | ||
|
|
43029019f4 | ||
|
|
8c481f18c6 | ||
|
|
87ecb20f7a | ||
|
|
2324f3c89f | ||
|
|
c35c32bddd | ||
|
|
6eb36b44f3 | ||
|
|
a1fc0287fc | ||
|
|
02dd763e63 | ||
|
|
a4024394e3 | ||
|
|
c72096058a | ||
|
|
672fcd5bc4 | ||
|
|
25f34b3715 | ||
|
|
8a7557f0eb | ||
|
|
fc3025baaf | ||
|
|
81f32794b4 | ||
|
|
dbf9640b16 | ||
|
|
a485ebaf74 | ||
|
|
7ef5a7ac9d | ||
|
|
6715756c2b | ||
|
|
6851c5419a | ||
|
|
1ba75492e5 | ||
|
|
aced338d72 | ||
|
|
512c0649d8 | ||
|
|
91b82ca41f | ||
|
|
752ccc080d | ||
|
|
3c2d3b4683 |
25
.eslintrc.cjs
Normal file
25
.eslintrc.cjs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
require("@rushstack/eslint-patch/modern-module-resolution")
|
||||||
|
|
||||||
|
/** @type {import('eslint').Linter.Config} */
|
||||||
|
module.exports = {
|
||||||
|
extends: [require.resolve("@itsmapleleaf/configs/eslint")],
|
||||||
|
ignorePatterns: [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/.cache/**",
|
||||||
|
"**/build/**",
|
||||||
|
"**/dist/**",
|
||||||
|
"**/coverage/**",
|
||||||
|
"**/public/**",
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
project: require.resolve("./tsconfig.base.json"),
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["packages/website/cypress/**"],
|
||||||
|
parserOptions: {
|
||||||
|
project: require.resolve("./packages/website/cypress/tsconfig.json"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["./node_modules/@itsmapleleaf/configs/eslint"],
|
|
||||||
"ignorePatterns": [
|
|
||||||
"**/node_modules/**",
|
|
||||||
"**/.cache/**",
|
|
||||||
"**/build/**",
|
|
||||||
"**/dist/**",
|
|
||||||
"**/coverage/**",
|
|
||||||
"**/public/**"
|
|
||||||
],
|
|
||||||
"parserOptions": {
|
|
||||||
"project": "./tsconfig.base.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"import/no-unused-modules": "off",
|
|
||||||
"unicorn/prevent-abbreviations": "off"
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["packages/website/cypress/**"],
|
|
||||||
"parserOptions": {
|
|
||||||
"project": "./packages/website/cypress/tsconfig.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
@@ -19,15 +19,15 @@ jobs:
|
|||||||
# if these run in the same process, it dies,
|
# if these run in the same process, it dies,
|
||||||
# so we test them separate
|
# so we test them separate
|
||||||
- name: test reacord
|
- name: test reacord
|
||||||
run: pnpm test -C packages/reacord
|
run: pnpm -C packages/reacord test
|
||||||
- name: test website
|
- name: test website
|
||||||
run: pnpm test -C packages/website
|
run: pnpm -C packages/website test
|
||||||
- name: build
|
- name: build
|
||||||
run: pnpm build --recursive
|
run: pnpm --recursive run build
|
||||||
- name: lint
|
- name: lint
|
||||||
run: pnpm lint
|
run: pnpm run lint
|
||||||
- name: typecheck
|
- name: typecheck
|
||||||
run: pnpm typecheck --parallel
|
run: pnpm --recursive run typecheck
|
||||||
name: ${{ matrix.command.name }}
|
name: ${{ matrix.command.name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -36,6 +36,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# https://github.com/actions/setup-node#supported-version-syntax
|
# https://github.com/actions/setup-node#supported-version-syntax
|
||||||
node-version: "16"
|
node-version: "16"
|
||||||
- run: npm i -g pnpm
|
- run: npm i -g pnpm@7.5.0
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
- run: ${{ matrix.command.run }}
|
- run: ${{ matrix.command.run }}
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -3,4 +3,8 @@ node_modules
|
|||||||
.vscode
|
.vscode
|
||||||
coverage
|
coverage
|
||||||
.env
|
.env
|
||||||
|
*.code-workspace
|
||||||
|
.pnpm-debug.log
|
||||||
|
|
||||||
|
build
|
||||||
|
.cache
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ coverage
|
|||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
build
|
build
|
||||||
.cache
|
.cache
|
||||||
|
packages/website/public/api
|
||||||
|
|||||||
15
Dockerfile
15
Dockerfile
@@ -1,15 +0,0 @@
|
|||||||
FROM node:lts-slim
|
|
||||||
|
|
||||||
ENV CYPRESS_INSTALL_BINARY=0
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY / ./
|
|
||||||
RUN ls -R
|
|
||||||
|
|
||||||
RUN npm install -g pnpm
|
|
||||||
RUN pnpm install --unsafe-perm --frozen-lockfile
|
|
||||||
RUN pnpm run build -C packages/website
|
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
CMD [ "pnpm", "-C", "packages/website", "start" ]
|
|
||||||
27
package.json
27
package.json
@@ -3,24 +3,19 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --ext js,ts,tsx .",
|
"lint": "eslint --ext js,ts,tsx .",
|
||||||
"lint-fix": "pnpm lint -- --fix",
|
"lint-fix": "pnpm lint -- --fix",
|
||||||
"format": "prettier --write ."
|
"format": "prettier --write .",
|
||||||
},
|
"release": "pnpm -C packages/reacord run release",
|
||||||
"dependencies": {
|
"build": "pnpm -C packages/website run build",
|
||||||
"@itsmapleleaf/configs": "^1.1.2"
|
"start": "pnpm -C packages/website run start"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
"@itsmapleleaf/configs": "^1.1.3",
|
||||||
"@typescript-eslint/parser": "^5.9.1",
|
"@rushstack/eslint-patch": "^1.1.3",
|
||||||
"eslint": "^8.6.0",
|
"@types/eslint": "^8.4.1",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint": "^8.14.0",
|
||||||
"eslint-import-resolver-typescript": "^2.5.0",
|
"prettier": "^2.6.2",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"typescript": "^4.6.3",
|
||||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
"node": "^16"
|
||||||
"eslint-plugin-react": "^7.28.0",
|
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
|
||||||
"eslint-plugin-unicorn": "^40.0.0",
|
|
||||||
"prettier": "^2.5.1",
|
|
||||||
"typescript": "^4.5.4"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"esbuild": "latest"
|
"esbuild": "latest"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { inspect } from "node:util"
|
import { inspect } from "node:util"
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unused-modules
|
|
||||||
export function logPretty(value: unknown) {
|
export function logPretty(value: unknown) {
|
||||||
console.info(
|
console.info(
|
||||||
inspect(value, {
|
inspect(value, {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line import/no-unused-modules
|
|
||||||
export function omit<Subject extends object, Key extends PropertyKey>(
|
export function omit<Subject extends object, Key extends PropertyKey>(
|
||||||
subject: Subject,
|
subject: Subject,
|
||||||
keys: Key[],
|
keys: Key[],
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { LoosePick, UnknownRecord } from "./types"
|
import type { LoosePick, UnknownRecord } from "./types"
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unused-modules
|
|
||||||
export function pick<T, K extends keyof T | PropertyKey>(
|
export function pick<T, K extends keyof T | PropertyKey>(
|
||||||
object: T,
|
object: T,
|
||||||
keys: K[],
|
keys: K[],
|
||||||
|
|||||||
35
packages/reacord/helpers/prune-nullish-values.test.ts
Normal file
35
packages/reacord/helpers/prune-nullish-values.test.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { expect, test } from "vitest"
|
||||||
|
import type { PruneNullishValues } from "./prune-nullish-values"
|
||||||
|
import { pruneNullishValues } from "./prune-nullish-values"
|
||||||
|
|
||||||
|
test("pruneNullishValues", () => {
|
||||||
|
type InputType = {
|
||||||
|
a: string
|
||||||
|
b: string | null | undefined
|
||||||
|
c?: string
|
||||||
|
d: {
|
||||||
|
a: string
|
||||||
|
b: string | undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const input: InputType = {
|
||||||
|
a: "a",
|
||||||
|
// eslint-disable-next-line unicorn/no-null
|
||||||
|
b: null,
|
||||||
|
c: undefined,
|
||||||
|
d: {
|
||||||
|
a: "a",
|
||||||
|
b: undefined,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const output: PruneNullishValues<InputType> = {
|
||||||
|
a: "a",
|
||||||
|
d: {
|
||||||
|
a: "a",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(pruneNullishValues(input)).toEqual(output)
|
||||||
|
})
|
||||||
@@ -18,10 +18,25 @@ export function pruneNullishValues<T>(input: T): PruneNullishValues<T> {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
type PruneNullishValues<Input> = Input extends ReadonlyArray<infer Value>
|
export type PruneNullishValues<Input> = Input extends object
|
||||||
? ReadonlyArray<NonNullable<Value>>
|
? OptionalKeys<
|
||||||
: Input extends object
|
{ [Key in keyof Input]: NonNullable<PruneNullishValues<Input[Key]>> },
|
||||||
? {
|
KeysWithNullishValues<Input>
|
||||||
[Key in keyof Input]: NonNullable<Input[Key]>
|
>
|
||||||
}
|
|
||||||
: Input
|
: Input
|
||||||
|
|
||||||
|
type OptionalKeys<Input, Keys extends keyof Input> = Omit<Input, Keys> & {
|
||||||
|
[Key in Keys]?: Input[Key]
|
||||||
|
}
|
||||||
|
|
||||||
|
type KeysWithNullishValues<Input> = NonNullable<
|
||||||
|
Values<{
|
||||||
|
[Key in keyof Input]: null extends Input[Key]
|
||||||
|
? Key
|
||||||
|
: undefined extends Input[Key]
|
||||||
|
? Key
|
||||||
|
: never
|
||||||
|
}>
|
||||||
|
>
|
||||||
|
|
||||||
|
type Values<Input> = Input[keyof Input]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable import/no-unused-modules */
|
|
||||||
export type MaybePromise<T> = T | Promise<T>
|
export type MaybePromise<T> = T | Promise<T>
|
||||||
|
|
||||||
export type ValueOf<Type> = Type extends ReadonlyArray<infer Value>
|
export type ValueOf<Type> = Type extends ReadonlyArray<infer Value>
|
||||||
|
|||||||
21
packages/reacord/helpers/wait-for.ts
Normal file
21
packages/reacord/helpers/wait-for.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { setTimeout } from "node:timers/promises"
|
||||||
|
|
||||||
|
const maxTime = 1000
|
||||||
|
|
||||||
|
export async function waitFor<Result>(
|
||||||
|
predicate: () => Result,
|
||||||
|
): Promise<Awaited<Result>> {
|
||||||
|
const startTime = Date.now()
|
||||||
|
let lastError: unknown
|
||||||
|
|
||||||
|
while (Date.now() - startTime < maxTime) {
|
||||||
|
try {
|
||||||
|
return await predicate()
|
||||||
|
} catch (error) {
|
||||||
|
lastError = error
|
||||||
|
await setTimeout(50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw lastError ?? new Error("Timeout")
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { inspect } from "node:util"
|
import { inspect } from "node:util"
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unused-modules
|
|
||||||
export function withLoggedMethodCalls<T extends object>(value: T) {
|
export function withLoggedMethodCalls<T extends object>(value: T) {
|
||||||
return new Proxy(value as Record<string | symbol, unknown>, {
|
return new Proxy(value as Record<string | symbol, unknown>, {
|
||||||
get(target, property) {
|
get(target, property) {
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ import type { Except } from "type-fest"
|
|||||||
import { pick } from "../../helpers/pick"
|
import { pick } from "../../helpers/pick"
|
||||||
import { pruneNullishValues } from "../../helpers/prune-nullish-values"
|
import { pruneNullishValues } from "../../helpers/prune-nullish-values"
|
||||||
import { raise } from "../../helpers/raise"
|
import { raise } from "../../helpers/raise"
|
||||||
import { toUpper } from "../../helpers/to-upper"
|
|
||||||
import type { ComponentInteraction } from "../internal/interaction"
|
import type { ComponentInteraction } from "../internal/interaction"
|
||||||
import type { Message, MessageOptions } from "../internal/message"
|
import type {
|
||||||
|
Message,
|
||||||
|
MessageButtonOptions,
|
||||||
|
MessageOptions,
|
||||||
|
} from "../internal/message"
|
||||||
import { ChannelMessageRenderer } from "../internal/renderers/channel-message-renderer"
|
import { ChannelMessageRenderer } from "../internal/renderers/channel-message-renderer"
|
||||||
import { InteractionReplyRenderer } from "../internal/renderers/interaction-reply-renderer"
|
import { InteractionReplyRenderer } from "../internal/renderers/interaction-reply-renderer"
|
||||||
import type {
|
import type {
|
||||||
@@ -30,7 +33,7 @@ export class ReacordDiscordJs extends Reacord {
|
|||||||
super(config)
|
super(config)
|
||||||
|
|
||||||
client.on("interactionCreate", (interaction) => {
|
client.on("interactionCreate", (interaction) => {
|
||||||
if (interaction.isMessageComponent()) {
|
if (interaction.isButton() || interaction.isSelectMenu()) {
|
||||||
this.handleComponentInteraction(
|
this.handleComponentInteraction(
|
||||||
this.createReacordComponentInteraction(interaction),
|
this.createReacordComponentInteraction(interaction),
|
||||||
)
|
)
|
||||||
@@ -88,7 +91,7 @@ export class ReacordDiscordJs extends Reacord {
|
|||||||
(await this.client.channels.fetch(channelId)) ??
|
(await this.client.channels.fetch(channelId)) ??
|
||||||
raise(`Channel ${channelId} not found`)
|
raise(`Channel ${channelId} not found`)
|
||||||
|
|
||||||
if (!channel.isText()) {
|
if (!channel.isTextBased()) {
|
||||||
raise(`Channel ${channelId} is not a text channel`)
|
raise(`Channel ${channelId} is not a text channel`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,17 +301,6 @@ function createReacordMessage(message: Discord.Message): Message {
|
|||||||
edit: async (options) => {
|
edit: async (options) => {
|
||||||
await message.edit(getDiscordMessageOptions(options))
|
await message.edit(getDiscordMessageOptions(options))
|
||||||
},
|
},
|
||||||
disableComponents: async () => {
|
|
||||||
for (const actionRow of message.components) {
|
|
||||||
for (const component of actionRow.components) {
|
|
||||||
component.setDisabled(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await message.edit({
|
|
||||||
components: message.components,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
delete: async () => {
|
delete: async () => {
|
||||||
await message.delete()
|
await message.delete()
|
||||||
},
|
},
|
||||||
@@ -321,10 +313,6 @@ function createEphemeralReacordMessage(): Message {
|
|||||||
console.warn("Ephemeral messages can't be edited")
|
console.warn("Ephemeral messages can't be edited")
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
},
|
},
|
||||||
disableComponents: () => {
|
|
||||||
console.warn("Ephemeral messages can't be edited")
|
|
||||||
return Promise.resolve()
|
|
||||||
},
|
|
||||||
delete: () => {
|
delete: () => {
|
||||||
console.warn("Ephemeral messages can't be deleted")
|
console.warn("Ephemeral messages can't be deleted")
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
@@ -332,25 +320,34 @@ function createEphemeralReacordMessage(): Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertButtonStyleToEnum(style: MessageButtonOptions["style"]) {
|
||||||
|
const styleMap = {
|
||||||
|
primary: Discord.ButtonStyle.Primary,
|
||||||
|
secondary: Discord.ButtonStyle.Secondary,
|
||||||
|
success: Discord.ButtonStyle.Success,
|
||||||
|
danger: Discord.ButtonStyle.Danger,
|
||||||
|
} as const
|
||||||
|
|
||||||
|
return styleMap[style ?? "secondary"]
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: this could be a part of the core library,
|
// TODO: this could be a part of the core library,
|
||||||
// and also handle some edge cases, e.g. empty messages
|
// and also handle some edge cases, e.g. empty messages
|
||||||
function getDiscordMessageOptions(
|
function getDiscordMessageOptions(reacordOptions: MessageOptions) {
|
||||||
reacordOptions: MessageOptions,
|
const options = {
|
||||||
): Discord.MessageOptions {
|
|
||||||
const options: Discord.MessageOptions = {
|
|
||||||
// eslint-disable-next-line unicorn/no-null
|
// eslint-disable-next-line unicorn/no-null
|
||||||
content: reacordOptions.content || null,
|
content: reacordOptions.content || null,
|
||||||
embeds: reacordOptions.embeds,
|
embeds: reacordOptions.embeds,
|
||||||
components: reacordOptions.actionRows.map((row) => ({
|
components: reacordOptions.actionRows.map((row) => ({
|
||||||
type: "ACTION_ROW",
|
type: Discord.ComponentType.ActionRow,
|
||||||
components: row.map(
|
components: row.map(
|
||||||
(component): Discord.MessageActionRowComponentOptions => {
|
(component): Discord.MessageActionRowComponentData => {
|
||||||
if (component.type === "button") {
|
if (component.type === "button") {
|
||||||
return {
|
return {
|
||||||
type: "BUTTON",
|
type: Discord.ComponentType.Button,
|
||||||
customId: component.customId,
|
customId: component.customId,
|
||||||
label: component.label ?? "",
|
label: component.label ?? "",
|
||||||
style: toUpper(component.style ?? "secondary"),
|
style: convertButtonStyleToEnum(component.style),
|
||||||
disabled: component.disabled,
|
disabled: component.disabled,
|
||||||
emoji: component.emoji,
|
emoji: component.emoji,
|
||||||
}
|
}
|
||||||
@@ -359,7 +356,7 @@ function getDiscordMessageOptions(
|
|||||||
if (component.type === "select") {
|
if (component.type === "select") {
|
||||||
return {
|
return {
|
||||||
...component,
|
...component,
|
||||||
type: "SELECT_MENU",
|
type: Discord.ComponentType.SelectMenu,
|
||||||
options: component.options.map((option) => ({
|
options: component.options.map((option) => ({
|
||||||
...option,
|
...option,
|
||||||
default: component.values?.includes(option.value),
|
default: component.values?.includes(option.value),
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ export type MessageSelectOptionOptions = {
|
|||||||
export type Message = {
|
export type Message = {
|
||||||
edit(options: MessageOptions): Promise<void>
|
edit(options: MessageOptions): Promise<void>
|
||||||
delete(): Promise<void>
|
delete(): Promise<void>
|
||||||
disableComponents(): Promise<void>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNextActionRow(options: MessageOptions): ActionRow {
|
export function getNextActionRow(options: MessageOptions): ActionRow {
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ const config: HostConfig<
|
|||||||
},
|
},
|
||||||
createTextInstance: (text) => new TextNode(text),
|
createTextInstance: (text) => new TextNode(text),
|
||||||
shouldSetTextContent: () => false,
|
shouldSetTextContent: () => false,
|
||||||
|
// @ts-expect-error
|
||||||
|
detachDeletedInstance: (instance) => {},
|
||||||
|
|
||||||
clearContainer: (renderer) => {
|
clearContainer: (renderer) => {
|
||||||
renderer.nodes.clear()
|
renderer.nodes.clear()
|
||||||
|
|||||||
@@ -83,7 +83,17 @@ export abstract class Renderer {
|
|||||||
|
|
||||||
if (payload.action === "deactivate") {
|
if (payload.action === "deactivate") {
|
||||||
this.updateSubscription.unsubscribe()
|
this.updateSubscription.unsubscribe()
|
||||||
await this.message?.disableComponents()
|
|
||||||
|
await this.message?.edit({
|
||||||
|
...payload.options,
|
||||||
|
actionRows: payload.options.actionRows.map((row) =>
|
||||||
|
row.map((component) => ({
|
||||||
|
...component,
|
||||||
|
disabled: true,
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "reacord",
|
"name": "reacord",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Create interactive Discord messages using React.",
|
"description": "Create interactive Discord messages using React.",
|
||||||
"version": "0.3.5",
|
"version": "0.4.0",
|
||||||
"types": "./dist/main.d.ts",
|
"types": "./dist/main.d.ts",
|
||||||
"homepage": "https://reacord.mapleleaf.dev",
|
"homepage": "https://reacord.mapleleaf.dev",
|
||||||
"repository": "https://github.com/itsMapleLeaf/reacord.git",
|
"repository": "https://github.com/itsMapleLeaf/reacord.git",
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup-node library/main.ts --target node16 --format cjs,esm --dts --sourcemap",
|
"build": "tsup library/main.ts --target node16 --format cjs,esm --dts --sourcemap",
|
||||||
"build-watch": "pnpm build -- --watch",
|
"build-watch": "pnpm build -- --watch",
|
||||||
"test": "vitest --coverage --no-watch",
|
"test": "vitest --coverage --no-watch",
|
||||||
"test-dev": "vitest",
|
"test-dev": "vitest",
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react": "*",
|
"@types/react": "*",
|
||||||
"@types/react-reconciler": "^0.26.4",
|
"@types/react-reconciler": "^0.26.6",
|
||||||
"nanoid": "^3.1.31",
|
"nanoid": "^3.3.3",
|
||||||
"react-reconciler": "^0.26.2",
|
"react-reconciler": "^0.27.0",
|
||||||
"rxjs": "^7.5.2"
|
"rxjs": "^7.5.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"discord.js": "^13.3",
|
"discord.js": "^14",
|
||||||
"react": ">=17"
|
"react": ">=17"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
@@ -61,24 +61,24 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/lodash-es": "^4.17.5",
|
"@types/lodash-es": "^4.17.6",
|
||||||
"c8": "^7.11.0",
|
"c8": "^7.11.2",
|
||||||
"discord.js": "^13.5.1",
|
"discord.js": "^14.0.3",
|
||||||
"dotenv": "^11.0.0",
|
"dotenv": "^16.0.0",
|
||||||
"esbuild": "latest",
|
"esbuild": "latest",
|
||||||
"esbuild-jest": "^0.5.0",
|
"esbuild-jest": "^0.5.0",
|
||||||
"esmo": "^0.13.0",
|
"esmo": "^0.14.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nodemon": "^2.0.15",
|
"nodemon": "^2.0.15",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.6.2",
|
||||||
"pretty-ms": "^7.0.1",
|
"pretty-ms": "^7.0.1",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"release-it": "^14.12.1",
|
"release-it": "^14.14.2",
|
||||||
"tsup": "^5.11.11",
|
"tsup": "^5.12.6",
|
||||||
"type-fest": "^2.9.0",
|
"type-fest": "^2.12.2",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.6.3",
|
||||||
"vite": "^2.7.10",
|
"vite": "^2.9.5",
|
||||||
"vitest": "^0.0.141"
|
"vitest": "^0.10.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"esbuild": "latest"
|
"esbuild": "latest"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function createCommandHandler(client: Client, commands: Command[]) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
client.on("interactionCreate", async (interaction) => {
|
client.on("interactionCreate", async (interaction) => {
|
||||||
if (!interaction.isCommand()) return
|
if (!interaction.isChatInputCommand()) return
|
||||||
|
|
||||||
const command = commands.find(
|
const command = commands.find(
|
||||||
(command) => command.name === interaction.commandName,
|
(command) => command.name === interaction.commandName,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Client } from "discord.js"
|
import { Client, IntentsBitField } from "discord.js"
|
||||||
import "dotenv/config"
|
import "dotenv/config"
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { Button, ReacordDiscordJs, useInstance } from "../library/main"
|
import { Button, ReacordDiscordJs, useInstance } from "../library/main"
|
||||||
@@ -7,7 +7,7 @@ import { Counter } from "./counter"
|
|||||||
import { FruitSelect } from "./fruit-select"
|
import { FruitSelect } from "./fruit-select"
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
intents: ["GUILDS"],
|
intents: IntentsBitField.Flags.Guilds,
|
||||||
})
|
})
|
||||||
|
|
||||||
const reacord = new ReacordDiscordJs(client)
|
const reacord = new ReacordDiscordJs(client)
|
||||||
|
|||||||
12
packages/reacord/test/commonjs-require.test.ts
Normal file
12
packages/reacord/test/commonjs-require.test.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { spawnSync } from "node:child_process"
|
||||||
|
import { createRequire } from "node:module"
|
||||||
|
import { beforeAll, expect, test } from "vitest"
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
spawnSync("pnpm", ["run", "build"])
|
||||||
|
})
|
||||||
|
|
||||||
|
test("can require commonjs", () => {
|
||||||
|
const require = createRequire(import.meta.url)
|
||||||
|
expect(() => require("../dist/main.cjs")).not.toThrow()
|
||||||
|
})
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
import { expect, fn, test } from "vitest"
|
import { expect, test, vi } from "vitest"
|
||||||
import { Button, Option, Select } from "../library/main"
|
import { Button, Option, Select } from "../library/main"
|
||||||
import { ReacordTester } from "./test-adapter"
|
import { ReacordTester } from "./test-adapter"
|
||||||
|
|
||||||
test("single select", async () => {
|
test("single select", async () => {
|
||||||
const tester = new ReacordTester()
|
const tester = new ReacordTester()
|
||||||
const onSelect = fn()
|
const onSelect = vi.fn()
|
||||||
|
|
||||||
function TestSelect() {
|
function TestSelect() {
|
||||||
const [value, setValue] = useState<string>()
|
const [value, setValue] = useState<string>()
|
||||||
@@ -75,7 +75,7 @@ test("single select", async () => {
|
|||||||
|
|
||||||
test("multiple select", async () => {
|
test("multiple select", async () => {
|
||||||
const tester = new ReacordTester()
|
const tester = new ReacordTester()
|
||||||
const onSelect = fn()
|
const onSelect = vi.fn()
|
||||||
|
|
||||||
function TestSelect() {
|
function TestSelect() {
|
||||||
const [values, setValues] = useState<string[]>([])
|
const [values, setValues] = useState<string[]>([])
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* eslint-disable class-methods-use-this */
|
/* eslint-disable class-methods-use-this */
|
||||||
/* eslint-disable require-await */
|
/* eslint-disable require-await */
|
||||||
import { nanoid } from "nanoid"
|
import { nanoid } from "nanoid"
|
||||||
import { nextTick } from "node:process"
|
import { setTimeout } from "node:timers/promises"
|
||||||
import { promisify } from "node:util"
|
|
||||||
import type { ReactNode } from "react"
|
import type { ReactNode } from "react"
|
||||||
import { expect } from "vitest"
|
import { expect } from "vitest"
|
||||||
import { logPretty } from "../helpers/log-pretty"
|
import { logPretty } from "../helpers/log-pretty"
|
||||||
import { omit } from "../helpers/omit"
|
import { omit } from "../helpers/omit"
|
||||||
import { pruneNullishValues } from "../helpers/prune-nullish-values"
|
import { pruneNullishValues } from "../helpers/prune-nullish-values"
|
||||||
import { raise } from "../helpers/raise"
|
import { raise } from "../helpers/raise"
|
||||||
|
import { waitFor } from "../helpers/wait-for"
|
||||||
import type {
|
import type {
|
||||||
ChannelInfo,
|
ChannelInfo,
|
||||||
GuildInfo,
|
GuildInfo,
|
||||||
@@ -26,17 +26,10 @@ import type {
|
|||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
SelectInteraction,
|
SelectInteraction,
|
||||||
} from "../library/internal/interaction"
|
} from "../library/internal/interaction"
|
||||||
import type {
|
import type { Message, MessageOptions } from "../library/internal/message"
|
||||||
Message,
|
|
||||||
MessageButtonOptions,
|
|
||||||
MessageOptions,
|
|
||||||
MessageSelectOptions,
|
|
||||||
} from "../library/internal/message"
|
|
||||||
import { ChannelMessageRenderer } from "../library/internal/renderers/channel-message-renderer"
|
import { ChannelMessageRenderer } from "../library/internal/renderers/channel-message-renderer"
|
||||||
import { InteractionReplyRenderer } from "../library/internal/renderers/interaction-reply-renderer"
|
import { InteractionReplyRenderer } from "../library/internal/renderers/interaction-reply-renderer"
|
||||||
|
|
||||||
const nextTickPromise = promisify(nextTick)
|
|
||||||
|
|
||||||
export type MessageSample = ReturnType<ReacordTester["sampleMessages"]>[0]
|
export type MessageSample = ReturnType<ReacordTester["sampleMessages"]>[0]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,9 +66,10 @@ export class ReacordTester extends Reacord {
|
|||||||
return this.reply(initialContent)
|
return this.reply(initialContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
async assertMessages(expected: MessageSample[]) {
|
assertMessages(expected: MessageSample[]) {
|
||||||
await nextTickPromise()
|
return waitFor(() => {
|
||||||
expect(this.sampleMessages()).toEqual(expected)
|
expect(this.sampleMessages()).toEqual(expected)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async assertRender(content: ReactNode, expected: MessageSample[]) {
|
async assertRender(content: ReactNode, expected: MessageSample[]) {
|
||||||
@@ -108,57 +102,58 @@ export class ReacordTester extends Reacord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findButtonByLabel(label: string) {
|
findButtonByLabel(label: string) {
|
||||||
for (const message of this.messageContainer) {
|
return {
|
||||||
for (const component of message.options.actionRows.flat()) {
|
click: () => {
|
||||||
if (component.type === "button" && component.label === label) {
|
return waitFor(() => {
|
||||||
return this.createButtonActions(component, message)
|
for (const [component, message] of this.eachComponent()) {
|
||||||
}
|
if (component.type === "button" && component.label === label) {
|
||||||
}
|
this.handleComponentInteraction(
|
||||||
|
new TestButtonInteraction(component.customId, message, this),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
raise(`Couldn't find button with label "${label}"`)
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
raise(`Couldn't find button with label "${label}"`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
findSelectByPlaceholder(placeholder: string) {
|
findSelectByPlaceholder(placeholder: string) {
|
||||||
for (const message of this.messageContainer) {
|
return {
|
||||||
for (const component of message.options.actionRows.flat()) {
|
select: (...values: string[]) => {
|
||||||
if (
|
return waitFor(() => {
|
||||||
component.type === "select" &&
|
for (const [component, message] of this.eachComponent()) {
|
||||||
component.placeholder === placeholder
|
if (
|
||||||
) {
|
component.type === "select" &&
|
||||||
return this.createSelectActions(component, message)
|
component.placeholder === placeholder
|
||||||
}
|
) {
|
||||||
}
|
this.handleComponentInteraction(
|
||||||
|
new TestSelectInteraction(
|
||||||
|
component.customId,
|
||||||
|
message,
|
||||||
|
values,
|
||||||
|
this,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
raise(`Couldn't find select with placeholder "${placeholder}"`)
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
raise(`Couldn't find select with placeholder "${placeholder}"`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createMessage(options: MessageOptions) {
|
createMessage(options: MessageOptions) {
|
||||||
return new TestMessage(options, this.messageContainer)
|
return new TestMessage(options, this.messageContainer)
|
||||||
}
|
}
|
||||||
|
|
||||||
private createButtonActions(
|
private *eachComponent() {
|
||||||
button: MessageButtonOptions,
|
for (const message of this.messageContainer) {
|
||||||
message: TestMessage,
|
for (const component of message.options.actionRows.flat()) {
|
||||||
) {
|
yield [component, message] as const
|
||||||
return {
|
}
|
||||||
click: () => {
|
|
||||||
this.handleComponentInteraction(
|
|
||||||
new TestButtonInteraction(button.customId, message, this),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private createSelectActions(
|
|
||||||
component: MessageSelectOptions,
|
|
||||||
message: TestMessage,
|
|
||||||
) {
|
|
||||||
return {
|
|
||||||
select: (...values: string[]) => {
|
|
||||||
this.handleComponentInteraction(
|
|
||||||
new TestSelectInteraction(component.customId, message, values, this),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,16 +170,6 @@ class TestMessage implements Message {
|
|||||||
this.options = options
|
this.options = options
|
||||||
}
|
}
|
||||||
|
|
||||||
async disableComponents(): Promise<void> {
|
|
||||||
for (const row of this.options.actionRows) {
|
|
||||||
for (const action of row) {
|
|
||||||
if (action.type === "button") {
|
|
||||||
action.disabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async delete(): Promise<void> {
|
async delete(): Promise<void> {
|
||||||
this.container.remove(this)
|
this.container.remove(this)
|
||||||
}
|
}
|
||||||
@@ -197,16 +182,14 @@ class TestCommandInteraction implements CommandInteraction {
|
|||||||
|
|
||||||
constructor(private messageContainer: Container<TestMessage>) {}
|
constructor(private messageContainer: Container<TestMessage>) {}
|
||||||
|
|
||||||
reply(messageOptions: MessageOptions): Promise<Message> {
|
async reply(messageOptions: MessageOptions): Promise<Message> {
|
||||||
return Promise.resolve(
|
await setTimeout()
|
||||||
new TestMessage(messageOptions, this.messageContainer),
|
return new TestMessage(messageOptions, this.messageContainer)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
followUp(messageOptions: MessageOptions): Promise<Message> {
|
async followUp(messageOptions: MessageOptions): Promise<Message> {
|
||||||
return Promise.resolve(
|
await setTimeout()
|
||||||
new TestMessage(messageOptions, this.messageContainer),
|
return new TestMessage(messageOptions, this.messageContainer)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ describe("useInstance", () => {
|
|||||||
await tester.assertMessages([messageOutput("parent")])
|
await tester.assertMessages([messageOutput("parent")])
|
||||||
expect(instanceFromHook).toBe(instance)
|
expect(instanceFromHook).toBe(instance)
|
||||||
|
|
||||||
tester.findButtonByLabel("create parent").click()
|
await tester.findButtonByLabel("create parent").click()
|
||||||
await tester.assertMessages([
|
await tester.assertMessages([
|
||||||
messageOutput("parent"),
|
messageOutput("parent"),
|
||||||
messageOutput("child"),
|
messageOutput("child"),
|
||||||
@@ -63,10 +63,10 @@ describe("useInstance", () => {
|
|||||||
|
|
||||||
// this test ensures that the only the child instance is destroyed,
|
// this test ensures that the only the child instance is destroyed,
|
||||||
// and not the parent instance
|
// and not the parent instance
|
||||||
tester.findButtonByLabel("destroy child").click()
|
await tester.findButtonByLabel("destroy child").click()
|
||||||
await tester.assertMessages([messageOutput("parent")])
|
await tester.assertMessages([messageOutput("parent")])
|
||||||
|
|
||||||
tester.findButtonByLabel("destroy parent").click()
|
await tester.findButtonByLabel("destroy parent").click()
|
||||||
await tester.assertMessages([])
|
await tester.assertMessages([])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { hydrate } from "react-dom";
|
import { hydrate } from "react-dom"
|
||||||
import { RemixBrowser } from "remix";
|
import { RemixBrowser } from "@remix-run/react"
|
||||||
|
|
||||||
hydrate(<RemixBrowser />, document);
|
hydrate(<RemixBrowser />, document)
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { renderToString } from "react-dom/server";
|
import { renderToString } from "react-dom/server"
|
||||||
import { RemixServer } from "remix";
|
import type { EntryContext } from "@remix-run/node"
|
||||||
import type { EntryContext } from "remix";
|
import { RemixServer } from "@remix-run/react"
|
||||||
|
|
||||||
export default function handleRequest(
|
export default function handleRequest(
|
||||||
request: Request,
|
request: Request,
|
||||||
responseStatusCode: number,
|
responseStatusCode: number,
|
||||||
responseHeaders: Headers,
|
responseHeaders: Headers,
|
||||||
remixContext: EntryContext
|
remixContext: EntryContext,
|
||||||
) {
|
) {
|
||||||
const markup = renderToString(
|
const markup = renderToString(
|
||||||
<RemixServer context={remixContext} url={request.url} />
|
<RemixServer context={remixContext} url={request.url} />,
|
||||||
);
|
)
|
||||||
|
|
||||||
responseHeaders.set("Content-Type", "text/html");
|
responseHeaders.set("Content-Type", "text/html")
|
||||||
|
|
||||||
return new Response("<!DOCTYPE html>" + markup, {
|
return new Response("<!DOCTYPE html>" + markup, {
|
||||||
status: responseStatusCode,
|
status: responseStatusCode,
|
||||||
headers: responseHeaders
|
headers: responseHeaders,
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ComponentPropsWithoutRef } from "react"
|
import type { ComponentPropsWithoutRef } from "react"
|
||||||
import { Link } from "remix"
|
import { Link } from "@remix-run/react"
|
||||||
import { ExternalLink } from "~/modules/dom/external-link"
|
import { ExternalLink } from "~/modules/dom/external-link"
|
||||||
|
|
||||||
export type AppLinkProps = ComponentPropsWithoutRef<"a"> & {
|
export type AppLinkProps = ComponentPropsWithoutRef<"a"> & {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import packageJson from "reacord/package.json"
|
import type {
|
||||||
import type { LinksFunction, LoaderFunction, MetaFunction } from "remix"
|
LinksFunction,
|
||||||
|
LoaderFunction,
|
||||||
|
MetaFunction,
|
||||||
|
} from "@remix-run/node"
|
||||||
import {
|
import {
|
||||||
Links,
|
Links,
|
||||||
LiveReload,
|
LiveReload,
|
||||||
@@ -8,7 +11,8 @@ import {
|
|||||||
Scripts,
|
Scripts,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
useLoaderData,
|
useLoaderData,
|
||||||
} from "remix"
|
} from "@remix-run/react"
|
||||||
|
import packageJson from "reacord/package.json"
|
||||||
import bannerUrl from "~/assets/banner.png"
|
import bannerUrl from "~/assets/banner.png"
|
||||||
import faviconUrl from "~/assets/favicon.png"
|
import faviconUrl from "~/assets/favicon.png"
|
||||||
import { GuideLinksProvider } from "~/modules/navigation/guide-links-context"
|
import { GuideLinksProvider } from "~/modules/navigation/guide-links-context"
|
||||||
@@ -73,6 +77,7 @@ export default function App() {
|
|||||||
return (
|
return (
|
||||||
<html lang="en" className="bg-slate-900 text-slate-100">
|
<html lang="en" className="bg-slate-900 text-slate-100">
|
||||||
<head>
|
<head>
|
||||||
|
{/* eslint-disable-next-line unicorn/text-encoding-identifier-case */}
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||||
<Meta />
|
<Meta />
|
||||||
@@ -80,9 +85,10 @@ export default function App() {
|
|||||||
{process.env.NODE_ENV === "production" && (
|
{process.env.NODE_ENV === "production" && (
|
||||||
<script
|
<script
|
||||||
async
|
async
|
||||||
data-website-id="49c69ade-5593-4853-9686-c9ca9d519a18"
|
defer
|
||||||
src="https://umami-production-265f.up.railway.app/umami.js"
|
data-website-id="e3ce3a50-720e-4489-be37-cc091c1b7029"
|
||||||
/>
|
src="https://umami-production-72bc.up.railway.app/umami.js"
|
||||||
|
></script>
|
||||||
)}
|
)}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
import { Outlet } from "remix"
|
import { Outlet } from "@remix-run/react"
|
||||||
import { ActiveLink } from "~/modules/navigation/active-link"
|
import { ActiveLink } from "~/modules/navigation/active-link"
|
||||||
import { AppLink } from "~/modules/navigation/app-link"
|
import { AppLink } from "~/modules/navigation/app-link"
|
||||||
import { useGuideLinksContext } from "~/modules/navigation/guide-links-context"
|
import { useGuideLinksContext } from "~/modules/navigation/guide-links-context"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands'
|
import "./commands"
|
||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
// Alternatively you can use CommonJS syntax:
|
||||||
// require('./commands')
|
// require('./commands')
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"name": "website",
|
"name": "website",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "remix setup node",
|
|
||||||
"dev": "concurrently 'typedoc --watch' 'pnpm tailwind -- --watch' 'remix dev'",
|
"dev": "concurrently 'typedoc --watch' 'pnpm tailwind -- --watch' 'remix dev'",
|
||||||
"test": "node ./scripts/test.js",
|
"test": "node ./scripts/test.js",
|
||||||
"test-dev": "pnpm dev & wait-on http-get://localhost:3000 && cypress open",
|
"test-dev": "pnpm dev & wait-on http-get://localhost:3000 && cypress open",
|
||||||
@@ -12,45 +11,42 @@
|
|||||||
"typecheck": "tsc --noEmit && tsc --project cypress/tsconfig.json --noEmit"
|
"typecheck": "tsc --noEmit && tsc --project cypress/tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@headlessui/react": "^1.4.2",
|
"@headlessui/react": "^1.6.0",
|
||||||
"@heroicons/react": "^1.0.5",
|
"@heroicons/react": "^1.0.6",
|
||||||
"@reach/rect": "^0.16.0",
|
"@reach/rect": "^0.17.0",
|
||||||
"@remix-run/react": "^1.1.1",
|
"@remix-run/node": "^1.4.1",
|
||||||
"@remix-run/serve": "^1.1.1",
|
"@remix-run/react": "^1.4.1",
|
||||||
"@tailwindcss/typography": "^0.5.0",
|
"@remix-run/serve": "^1.4.1",
|
||||||
|
"@tailwindcss/typography": "^0.5.2",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.1.1",
|
||||||
"fast-glob": "^3.2.10",
|
"fast-glob": "^3.2.11",
|
||||||
"gray-matter": "^4.0.3",
|
"gray-matter": "^4.0.3",
|
||||||
"reacord": "workspace:*",
|
"reacord": "workspace:*",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^18.0.0",
|
||||||
"react-focus-on": "^3.5.4",
|
"react-focus-on": "^3.5.4",
|
||||||
"react-router": "^6.2.1",
|
"react-router": "^6.3.0",
|
||||||
"react-router-dom": "^6.2.1",
|
"react-router-dom": "^6.3.0"
|
||||||
"remix": "^1.1.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@remix-run/dev": "^1.1.1",
|
"@remix-run/dev": "^1.4.1",
|
||||||
"@remix-run/node": "^1.1.1",
|
"@remix-run/node": "^1.4.1",
|
||||||
"@testing-library/cypress": "^8.0.2",
|
"@testing-library/cypress": "^8.0.2",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/react": "^17.0.38",
|
"@types/react": "^18.0.7",
|
||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^18.0.2",
|
||||||
"@types/tailwindcss": "^3.0.2",
|
"@types/tailwindcss": "^3.0.10",
|
||||||
"@types/wait-on": "^5.3.1",
|
"@types/wait-on": "^5.3.1",
|
||||||
"autoprefixer": "^10.4.2",
|
"autoprefixer": "^10.4.5",
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.1.0",
|
||||||
"cypress": "^9.2.1",
|
"cypress": "^9.6.0",
|
||||||
"execa": "^6.0.0",
|
"execa": "^6.1.0",
|
||||||
"postcss": "^8.4.5",
|
"postcss": "^8.4.12",
|
||||||
"rehype-prism-plus": "^1.3.1",
|
"rehype-prism-plus": "^1.3.2",
|
||||||
"tailwindcss": "^3.0.13",
|
"tailwindcss": "^3.0.24",
|
||||||
"typedoc": "^0.22.10",
|
"typedoc": "^0.22.15",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.6.3",
|
||||||
"wait-on": "^6.0.0"
|
"wait-on": "^6.0.1"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
},
|
},
|
||||||
"sideEffects": false
|
"sideEffects": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./app/*"]
|
"~/*": ["./app/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
4716
pnpm-lock.yaml
generated
4716
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user