Преглед изворни кода

feat(ui): publish ui package (#33681)

Victor Navarro пре 1 месец
родитељ
комит
f4103f5c3a

+ 6 - 3
bun.lock

@@ -958,8 +958,6 @@
         "@solid-primitives/event-listener": "2.4.5",
         "@solid-primitives/media": "2.3.3",
         "@solid-primitives/resize-observer": "2.1.3",
-        "@solidjs/meta": "catalog:",
-        "@solidjs/router": "catalog:",
         "diff": "catalog:",
         "dompurify": "3.3.1",
         "fuzzysort": "catalog:",
@@ -975,23 +973,28 @@
         "remeda": "catalog:",
         "remend": "catalog:",
         "shiki": "catalog:",
-        "solid-js": "catalog:",
         "solid-list": "catalog:",
         "strip-ansi": "7.1.2",
       },
       "devDependencies": {
+        "@solidjs/meta": "catalog:",
         "@tailwindcss/vite": "catalog:",
         "@tsconfig/node22": "catalog:",
         "@types/bun": "catalog:",
         "@types/katex": "0.16.7",
         "@types/luxon": "catalog:",
         "@typescript/native-preview": "catalog:",
+        "solid-js": "catalog:",
         "tailwindcss": "catalog:",
         "typescript": "catalog:",
         "vite": "catalog:",
         "vite-plugin-icons-spritesheet": "3.0.1",
         "vite-plugin-solid": "catalog:",
       },
+      "peerDependencies": {
+        "@solidjs/meta": "^0.29.0",
+        "solid-js": "^1.9.0",
+      },
     },
     "packages/web": {
       "name": "@opencode-ai/web",

+ 21 - 0
packages/ui/LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 opencode
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 34 - 3
packages/ui/package.json

@@ -3,6 +3,34 @@
   "version": "1.17.10",
   "type": "module",
   "license": "MIT",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/anomalyco/opencode.git",
+    "directory": "packages/ui"
+  },
+  "publishConfig": {
+    "access": "public"
+  },
+  "sideEffects": [
+    "**/*.css"
+  ],
+  "files": [
+    "src/**/*.ts",
+    "src/**/*.tsx",
+    "!src/**/*.test.ts",
+    "!src/**/*.test.tsx",
+    "!src/**/*.stories.ts",
+    "!src/**/*.stories.tsx",
+    "src/**/*.css",
+    "src/theme/themes/*.json",
+    "src/components/app-icons/sprite.svg",
+    "src/components/file-icons/sprite.svg",
+    "src/components/provider-icons/sprite.svg",
+    "src/assets/icons/app/*",
+    "src/assets/fonts/*",
+    "src/assets/audio/*",
+    "LICENSE"
+  ],
   "exports": {
     "./package.json": "./package.json",
     "./*": "./src/components/*.tsx",
@@ -40,6 +68,8 @@
     "@types/katex": "0.16.7",
     "@types/luxon": "catalog:",
     "@typescript/native-preview": "catalog:",
+    "@solidjs/meta": "catalog:",
+    "solid-js": "catalog:",
     "tailwindcss": "catalog:",
     "typescript": "catalog:",
     "vite": "catalog:",
@@ -54,8 +84,6 @@
     "@solid-primitives/event-listener": "2.4.5",
     "@solid-primitives/media": "2.3.3",
     "@solid-primitives/resize-observer": "2.1.3",
-    "@solidjs/meta": "catalog:",
-    "@solidjs/router": "catalog:",
     "@shikijs/stream": "catalog:",
     "diff": "catalog:",
     "dompurify": "3.3.1",
@@ -72,8 +100,11 @@
     "remeda": "catalog:",
     "remend": "catalog:",
     "shiki": "catalog:",
-    "solid-js": "catalog:",
     "solid-list": "catalog:",
     "strip-ansi": "7.1.2"
+  },
+  "peerDependencies": {
+    "@solidjs/meta": "^0.29.0",
+    "solid-js": "^1.9.0"
   }
 }

+ 26 - 0
packages/ui/script/publish.ts

@@ -0,0 +1,26 @@
+#!/usr/bin/env bun
+
+import { Script } from "@opencode-ai/script"
+import { $ } from "bun"
+import { rm } from "node:fs/promises"
+import { fileURLToPath } from "node:url"
+
+process.chdir(fileURLToPath(new URL("..", import.meta.url)))
+
+const pkg = (await Bun.file("package.json").json()) as { name: string; version: string }
+const tarball = `${pkg.name.replace("@", "").replace("/", "-")}-${pkg.version}.tgz`
+
+if ((await $`npm view ${pkg.name}@${pkg.version} version`.nothrow()).exitCode === 0) {
+  console.log(`already published ${pkg.name}@${pkg.version}`)
+  process.exit(0)
+}
+
+try {
+  await $`bun run typecheck`
+  await $`bun run test`
+  await rm(tarball, { force: true })
+  await $`bun pm pack`
+  await $`npm publish ${tarball} --access public --tag ${Script.channel}`
+} finally {
+  await rm(tarball, { force: true })
+}

BIN
packages/ui/src/assets/fonts/Inter.ttf


BIN
packages/ui/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2


+ 3 - 0
script/publish.ts

@@ -47,6 +47,9 @@ await $`bun ./packages/sdk/js/script/publish.ts`
 console.log("\n=== plugin ===\n")
 await $`bun ./packages/plugin/script/publish.ts`
 
+console.log("\n=== ui ===\n")
+await $`bun ./packages/ui/script/publish.ts`
+
 if (Script.release) {
   await $`bun ./packages/desktop/scripts/finalize-latest-json.ts`
   await $`bun ./packages/desktop/scripts/finalize-latest-yml.ts`