monorepo
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ node_modules
|
|||||||
.vscode
|
.vscode
|
||||||
coverage
|
coverage
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
build
|
node_modules
|
||||||
dist
|
dist
|
||||||
.yarn
|
coverage
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
.next
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import { Embed } from "../src/components.js"
|
|
||||||
|
|
||||||
export function KitchenSink() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
content
|
|
||||||
<Embed color="BLUE"></Embed>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
69
package.json
69
package.json
@@ -1,44 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "reacord",
|
"private": true,
|
||||||
"type": "module",
|
|
||||||
"description": "send reactive discord messages using react components ⚛",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"exports": {
|
|
||||||
"import": "./dist/main.js",
|
|
||||||
"require": "./dist/main.cjs"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsup-node src/main.ts --clean --target node16 --format cjs,esm --dts",
|
"build": "pnpm build --recursive --stream",
|
||||||
"test": "c8 ava",
|
|
||||||
"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 .",
|
||||||
"typecheck": "tsc --noEmit"
|
"test": "c8 ava",
|
||||||
},
|
"typecheck": "tsc --project ./tsconfig.base.json --noEmit"
|
||||||
"keywords": [],
|
|
||||||
"author": "itsMapleLeaf",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "*",
|
|
||||||
"@types/react": "*",
|
|
||||||
"@types/react-reconciler": "^0.26.4",
|
|
||||||
"react-reconciler": "^0.26.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"discord.js": "^13.3",
|
|
||||||
"react": "^17.0.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@itsmapleleaf/configs": "^1.1.0",
|
"@itsmapleleaf/configs": "^1.1.0",
|
||||||
|
"@types/node": "*",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
||||||
"@typescript-eslint/parser": "^5.6.0",
|
"@typescript-eslint/parser": "^5.6.0",
|
||||||
"ava": "^4.0.0-rc.1",
|
"ava": "^4.0.0-rc.1",
|
||||||
"c8": "^7.10.0",
|
"c8": "^7.10.0",
|
||||||
"discord.js": "^13.3.1",
|
|
||||||
"dotenv": "^10.0.0",
|
|
||||||
"esbuild": "^0.14.2",
|
"esbuild": "^0.14.2",
|
||||||
"esbuild-node-loader": "^0.6.3",
|
"esbuild-node-loader": "^0.6.3",
|
||||||
"eslint": "^8.4.1",
|
"eslint": "^8.4.1",
|
||||||
@@ -49,32 +25,37 @@
|
|||||||
"eslint-plugin-react": "^7.27.1",
|
"eslint-plugin-react": "^7.27.1",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-unicorn": "^39.0.0",
|
"eslint-plugin-unicorn": "^39.0.0",
|
||||||
"nanoid": "^3.1.30",
|
|
||||||
"npm-run-all": "^4.1.5",
|
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"react": "^17.0.2",
|
"typescript": "^4.5.4"
|
||||||
"tsup": "^5.10.3",
|
|
||||||
"typescript": "^4.5.2"
|
|
||||||
},
|
},
|
||||||
"prettier": "@itsmapleleaf/configs/prettier",
|
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"./node_modules/@itsmapleleaf/configs/eslint"
|
"./node_modules/@itsmapleleaf/configs/eslint"
|
||||||
]
|
],
|
||||||
|
"ignorePatterns": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/coverage/**",
|
||||||
|
"**/dist/**",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./tsconfig.base.json"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
"prettier": "@itsmapleleaf/configs/prettier",
|
||||||
"ava": {
|
"ava": {
|
||||||
"extensions": {
|
"files": [
|
||||||
"ts": "module",
|
"**/*.test.{ts,tsx}",
|
||||||
"tsx": "module"
|
"!**/{node_modules,dist,coverage}/**"
|
||||||
},
|
],
|
||||||
"nodeArguments": [
|
"nodeArguments": [
|
||||||
"--loader=esbuild-node-loader",
|
"--loader=esbuild-node-loader",
|
||||||
"--experimental-specifier-resolution=node",
|
"--experimental-specifier-resolution=node",
|
||||||
"--no-warnings"
|
"--no-warnings"
|
||||||
],
|
],
|
||||||
"files": [
|
"extensions": {
|
||||||
"{src,test,integration}/**/*.test.{ts,tsx}"
|
"ts": "module",
|
||||||
],
|
"tsx": "module"
|
||||||
"serial": true
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
packages/helpers/package.json
Normal file
7
packages/helpers/package.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "reacord-helpers",
|
||||||
|
"private": true,
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.11.14"
|
||||||
|
}
|
||||||
|
}
|
||||||
3
packages/helpers/tsconfig.json
Normal file
3
packages/helpers/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json"
|
||||||
|
}
|
||||||
66
packages/integration-tests/package.json
Normal file
66
packages/integration-tests/package.json
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"name": "reacord-integration-tests",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --ext js,ts,tsx .",
|
||||||
|
"lint-fix": "pnpm lint -- --fix",
|
||||||
|
"format": "prettier --write .",
|
||||||
|
"test": "c8 ava",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@itsmapleleaf/configs": "^1.1.0",
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/react": "*",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
||||||
|
"@typescript-eslint/parser": "^5.6.0",
|
||||||
|
"ava": "^4.0.0-rc.1",
|
||||||
|
"c8": "^7.10.0",
|
||||||
|
"discord.js": "^13.3.1",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"esbuild": "^0.14.2",
|
||||||
|
"esbuild-node-loader": "^0.6.3",
|
||||||
|
"eslint": "^8.4.1",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"eslint-import-resolver-typescript": "^2.5.0",
|
||||||
|
"eslint-plugin-import": "^2.25.3",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
|
"eslint-plugin-react": "^7.27.1",
|
||||||
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
|
"eslint-plugin-unicorn": "^39.0.0",
|
||||||
|
"nanoid": "^3.1.30",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
|
"reacord": "workspace:*",
|
||||||
|
"reacord-helpers": "workspace:*",
|
||||||
|
"react": "^17.0.2",
|
||||||
|
"typescript": "^4.5.4"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"./node_modules/@itsmapleleaf/configs/eslint"
|
||||||
|
],
|
||||||
|
"ignorePatterns": [
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/coverage/**",
|
||||||
|
"**/.vscode/**"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prettier": "@itsmapleleaf/configs/prettier",
|
||||||
|
"ava": {
|
||||||
|
"files": [
|
||||||
|
"**/*.test.{ts,tsx}"
|
||||||
|
],
|
||||||
|
"nodeArguments": [
|
||||||
|
"--loader=esbuild-node-loader",
|
||||||
|
"--experimental-specifier-resolution=node",
|
||||||
|
"--no-warnings"
|
||||||
|
],
|
||||||
|
"extensions": {
|
||||||
|
"ts": "module",
|
||||||
|
"tsx": "module"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,9 @@ import type { ExecutionContext } from "ava"
|
|||||||
import test from "ava"
|
import test from "ava"
|
||||||
import { Client, TextChannel } from "discord.js"
|
import { Client, TextChannel } from "discord.js"
|
||||||
import { nanoid } from "nanoid"
|
import { nanoid } from "nanoid"
|
||||||
|
import { createRoot, Embed } from "reacord"
|
||||||
|
import { raise } from "reacord-helpers/raise.js"
|
||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
import { Embed } from "../src/components/embed.js"
|
|
||||||
import { raise } from "../src/helpers/raise.js"
|
|
||||||
import { createRoot } from "../src/root.js"
|
|
||||||
import { testBotToken, testChannelId } from "./test-environment.js"
|
import { testBotToken, testChannelId } from "./test-environment.js"
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import "dotenv/config.js"
|
import "dotenv/config.js"
|
||||||
import { raise } from "../src/helpers/raise.js"
|
import { raise } from "reacord-helpers/raise.js"
|
||||||
|
|
||||||
function getEnvironmentValue(name: string) {
|
function getEnvironmentValue(name: string) {
|
||||||
return process.env[name] ?? raise(`Missing environment variable: ${name}`)
|
return process.env[name] ?? raise(`Missing environment variable: ${name}`)
|
||||||
3
packages/integration-tests/tsconfig.json
Normal file
3
packages/integration-tests/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json"
|
||||||
|
}
|
||||||
39
packages/reacord/package.json
Normal file
39
packages/reacord/package.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "reacord",
|
||||||
|
"type": "module",
|
||||||
|
"description": "send reactive discord messages using react components ⚛",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"types": "./dist/main.d.ts",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
"import": "./dist/main.js",
|
||||||
|
"require": "./dist/main.cjs"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsup-node src/main.ts --clean --target node16 --format cjs,esm --dts"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "itsMapleLeaf",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/react": "*",
|
||||||
|
"@types/react-reconciler": "^0.26.4",
|
||||||
|
"react-reconciler": "^0.26.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"discord.js": "^13.3",
|
||||||
|
"react": "^17.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"discord.js": "^13.3.1",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"esbuild": "^0.14.2",
|
||||||
|
"nanoid": "^3.1.30",
|
||||||
|
"reacord-helpers": "workspace:*",
|
||||||
|
"react": "^17.0.2",
|
||||||
|
"tsup": "^5.10.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
2
packages/reacord/src/main.ts
Normal file
2
packages/reacord/src/main.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./components/embed.js"
|
||||||
|
export * from "./root.js"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable unicorn/no-null */
|
/* eslint-disable unicorn/no-null */
|
||||||
|
import { raise } from "reacord-helpers/raise.js"
|
||||||
import ReactReconciler from "react-reconciler"
|
import ReactReconciler from "react-reconciler"
|
||||||
import type { ReacordContainer } from "./container.js"
|
import type { ReacordContainer } from "./container.js"
|
||||||
import type { ReacordElement, ReacordElementJsxTag } from "./element.js"
|
import type { ReacordElement, ReacordElementJsxTag } from "./element.js"
|
||||||
import { raise } from "./helpers/raise.js"
|
|
||||||
|
|
||||||
export const reconciler = ReactReconciler<
|
export const reconciler = ReactReconciler<
|
||||||
ReacordElementJsxTag,
|
ReacordElementJsxTag,
|
||||||
3
packages/reacord/tsconfig.json
Normal file
3
packages/reacord/tsconfig.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json"
|
||||||
|
}
|
||||||
672
pnpm-lock.yaml
generated
672
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
1
pnpm-workspace.yaml
Normal file
1
pnpm-workspace.yaml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
workspaces: [packages/*]
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from "./root.js"
|
|
||||||
4
tsconfig.base.json
Normal file
4
tsconfig.base.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@itsmapleleaf/configs/tsconfig.base",
|
||||||
|
"exclude": ["**/node_modules/**", "**/coverage/**", "**/dist/**"]
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "@itsmapleleaf/configs/tsconfig.base",
|
|
||||||
"compilerOptions": {
|
|
||||||
"skipLibCheck": false
|
|
||||||
},
|
|
||||||
"exclude": ["node_modules", ".vscode", "dist", "coverage"]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user