Skip to content

Commit

Permalink
feat: @assistant-ui/tsbuildutils, improve ESM compat, update deps (#1101
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Yonom authored Oct 27, 2024
1 parent 32e1b5e commit ff5b86c
Show file tree
Hide file tree
Showing 36 changed files with 750 additions and 753 deletions.
7 changes: 7 additions & 0 deletions .changeset/big-pugs-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@assistant-ui/react-markdown": patch
"@assistant-ui/react-trieve": patch
"@assistant-ui/react": patch
---

build: refactor build script into @assistant-ui/tsbuildutils
8 changes: 8 additions & 0 deletions .changeset/silver-kiwis-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@assistant-ui/react-playground": patch
"@assistant-ui/react-markdown": patch
"@assistant-ui/react-trieve": patch
"@assistant-ui/react": patch
---

fix: better ESM compatibility
15 changes: 15 additions & 0 deletions .changeset/violet-beds-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@assistant-ui/react-syntax-highlighter": patch
"assistant-stream": patch
"@assistant-ui/react-playground": patch
"@assistant-ui/react-hook-form": patch
"@assistant-ui/react-langgraph": patch
"@tool-ui/weather": patch
"@assistant-ui/react-markdown": patch
"@assistant-ui/react-ai-sdk": patch
"@assistant-ui/react-trieve": patch
"@assistant-ui/react": patch
"assistant-ui": patch
---

chore: update deps
16 changes: 8 additions & 8 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/provider": "^0.0.24",
"@ai-sdk/openai": "^0.0.70",
"@ai-sdk/provider": "^0.0.26",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-ai-sdk": "workspace:*",
"@assistant-ui/react-langgraph": "workspace:*",
"@assistant-ui/react-markdown": "workspace:*",
"@assistant-ui/react-syntax-highlighter": "workspace:*",
"@assistant-ui/tsconfig": "workspace:*",
"@langchain/core": "^0.3.13",
"@langchain/langgraph-sdk": "^0.0.17",
"@langchain/core": "^0.3.15",
"@langchain/langgraph-sdk": "^0.0.18",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@radix-ui/themes": "^3.1.4",
"@shikijs/transformers": "^1.22.0",
"ai": "^3.4.18",
"@shikijs/transformers": "^1.22.1",
"ai": "^3.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"fumadocs-core": "14.0.2",
Expand All @@ -46,12 +46,12 @@
"remark-gfm": "^4.0.0",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"trieve-ts-sdk": "^0.0.13",
"trieve-ts-sdk": "^0.0.14",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"@types/node": "^22.8.0",
"@types/node": "^22.8.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"autoprefixer": "^10.4.20",
Expand Down
4 changes: 2 additions & 2 deletions apps/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"type": "module",
"devDependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-markdown": "workspace:*",
"@assistant-ui/react-syntax-highlighter": "workspace:*",
Expand All @@ -15,7 +15,7 @@
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@types/node": "^22.7.9",
"@types/node": "^22.8.1",
"@types/react": "^18",
"@types/react-syntax-highlighter": "^15.5.13",
"class-variance-authority": "^0.7.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/search-agent-for-e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-ai-sdk": "workspace:*",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"ai": "^3.4.18",
"ai": "^3.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"embla-carousel-autoplay": "^8.3.0",
Expand All @@ -32,7 +32,7 @@
},
"devDependencies": {
"@assistant-ui/tsconfig": "workspace:*",
"@types/node": "^22.7.9",
"@types/node": "^22.8.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"eslint": "^9",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-external-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "^0.5",
"next": "15.0.1",
"react": "19.0.0-rc-69d4b800-20241021",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-ffmpeg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-hook-form": "workspace:*",
"@ffmpeg/ffmpeg": "^0.12.10",
Expand All @@ -34,7 +34,7 @@
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.3",
"zod-to-json-schema": "^3.23.5",
"zustand": "^5.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/with-inline-suggestions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-ai-sdk": "workspace:*",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"ai": "^3.4.18",
"ai": "^3.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.453.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-langgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-langgraph": "workspace:*",
"@assistant-ui/react-markdown": "workspace:*",
"@langchain/langgraph-sdk": "^0.0.17",
"@langchain/langgraph-sdk": "^0.0.18",
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-openai-assistants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-ai-sdk": "workspace:*",
"@radix-ui/react-avatar": "^1.1.1",
"ai": "^3.4.18",
"ai": "^3.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.453.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-playground": "workspace:*",
"@tailwindcss/forms": "^0.5.9",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-react-hook-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-hook-form": "workspace:*",
"@hookform/resolvers": "^3.9.0",
Expand All @@ -32,7 +32,7 @@
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.3",
"zod-to-json-schema": "^3.23.5",
"zustand": "^5.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-trieve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-dom": "19.0.0-rc-69d4b800-20241021",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"trieve-ts-sdk": "^0.0.13"
"trieve-ts-sdk": "^0.0.14"
},
"devDependencies": {
"@assistant-ui/tsconfig": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-vercel-ai-rsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.68",
"@ai-sdk/openai": "^0.0.70",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-ai-sdk": "workspace:*",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"ai": "3.4.18",
"ai": "3.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.453.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/assistant-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
},
"devDependencies": {
"@assistant-ui/tsconfig": "workspace:*",
"ai": "^3.4.18",
"ai": "^3.4.20",
"eslint": "^9",
"eslint-config-next": "15.0.1",
"tsup": "8.3.0",
"tsup": "8.3.5",
"tsx": "^4.19.1"
},
"publishConfig": {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"license": "MIT",
"type": "module",
"dependencies": {
"@types/cross-spawn": "^6.0.6",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"cosmiconfig": "^9.0.0",
Expand All @@ -15,8 +14,9 @@
},
"devDependencies": {
"@assistant-ui/tsconfig": "workspace:*",
"@types/node": "^22.7.9",
"tsup": "8.3.0"
"@types/cross-spawn": "^6.0.6",
"@types/node": "^22.8.1",
"tsup": "8.3.5"
},
"files": [
"dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ai-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@assistant-ui/react": "workspace:*",
"@assistant-ui/tsconfig": "workspace:*",
"eslint-config-next": "15.0.1",
"tsup": "8.3.0"
"tsup": "8.3.5"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-hook-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@assistant-ui/react": "workspace:*",
"@assistant-ui/tsconfig": "workspace:*",
"eslint-config-next": "15.0.1",
"tsup": "8.3.0"
"tsup": "8.3.5"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-langgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@assistant-ui/react": "workspace:*",
"@assistant-ui/tsconfig": "workspace:*",
"eslint-config-next": "15.0.1",
"tsup": "8.3.0"
"tsup": "8.3.5"
},
"publishConfig": {
"access": "public",
Expand Down
8 changes: 4 additions & 4 deletions packages/react-markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
],
"sideEffects": false,
"scripts": {
"build": "tsx scripts/build.mts && pnpm run build:declarations",
"build:declarations": "tsc -p tsconfig.declarations.json"
"build": "tsx scripts/build.mts"
},
"dependencies": {
"@radix-ui/react-primitive": "^2.0.0",
Expand All @@ -57,8 +56,9 @@
"devDependencies": {
"@assistant-ui/react": "workspace:*",
"@assistant-ui/tailwindcss-transformer": "workspace:*",
"@assistant-ui/tsbuildutils": "workspace:^",
"@assistant-ui/tsconfig": "workspace:*",
"@types/node": "^22.7.9",
"@types/node": "^22.8.1",
"autoprefixer": "^10.4.20",
"eslint": "^9",
"eslint-config-next": "15.0.1",
Expand All @@ -68,7 +68,7 @@
"react-dom": "19.0.0-rc-69d4b800-20241021",
"tailwindcss": "^3.4.14",
"tailwindcss-animate": "^1.0.7",
"tsup": "8.3.0",
"tsup": "8.3.5",
"tsx": "^4.19.1"
},
"publishConfig": {
Expand Down
59 changes: 6 additions & 53 deletions packages/react-markdown/scripts/build.mts
Original file line number Diff line number Diff line change
@@ -1,54 +1,7 @@
import { build } from "tsup";
import fs from "node:fs";
import postcss from "postcss";
import postcssJs from "postcss-js";
import { Build } from "@assistant-ui/tsbuildutils";

// tailwind-plugin-resources

const files = ["./src/styles/tailwindcss/markdown.css"];

const replaceNullWithObject = (obj: object) => {
return Object.fromEntries(
Object.entries(obj).map(([key, value]) => {
if (value === true) return [key, {}];
if (typeof value === "object" && value !== null)
return [key, replaceNullWithObject(value)];
return [key, value];
}),
);
};

fs.mkdirSync("./generated", { recursive: true });
for (const file of files) {
const cssContent = fs.readFileSync(file, "utf8");
const root = postcss.parse(cssContent);
const formattedComponents = replaceNullWithObject(postcssJs.objectify(root));

const outputFile = "./generated/" + file.split("/").pop() + ".json";
const outputContent = JSON.stringify(formattedComponents, null, 2);
fs.writeFileSync(outputFile, outputContent);
}

// JS
await build({
entry: ["./src/**/*.{ts,tsx,js,jsx}", "!./src/**/*.test.{ts,tsx}"],
format: ["cjs", "esm"],
bundle: false,
minify: false,
sourcemap: true,
clean: true,
});

// css

await build({
entry: ["src/styles/tailwindcss/markdown.css"],
outDir: "dist/styles",
sourcemap: true,
});

fs.mkdirSync("dist/styles/tailwindcss", { recursive: true });
fs.copyFileSync(
"src/styles/tailwindcss/markdown.css",
"dist/styles/tailwindcss/markdown.css",
);
await Build.start()
.transpileCSS({
tailwindEntrypoints: ["src/styles/tailwindcss/markdown.css"],
})
.transpileTypescript();
Loading

0 comments on commit ff5b86c

Please sign in to comment.