diff --git a/doc/PUBLISHING.md b/doc/PUBLISHING.md index 50a1930e..32e4b131 100644 --- a/doc/PUBLISHING.md +++ b/doc/PUBLISHING.md @@ -51,10 +51,9 @@ Public packages are discovered from: - `packages/` - `server/` +- `ui/` - `cli/` -`ui/` is ignored because it is private. - The version rewrite step now uses [`scripts/release-package-map.mjs`](../scripts/release-package-map.mjs), which: - finds all public packages @@ -65,6 +64,18 @@ The version rewrite step now uses [`scripts/release-package-map.mjs`](../scripts Those rewrites are temporary. The working tree is restored after publish or dry-run. +## `@paperclipai/ui` packaging + +The UI package publishes prebuilt static assets, not the source workspace. + +The `ui` package uses [`scripts/generate-ui-package-json.mjs`](../scripts/generate-ui-package-json.mjs) during `prepack` to swap in a lean publish manifest that: + +- keeps the release-managed `name` and `version` +- publishes only `dist/` +- omits the source-only dependency graph from downstream installs + +After packing or publishing, `postpack` restores the development manifest automatically. + ## Version formats Paperclip uses calendar versions: @@ -135,6 +146,7 @@ This is the fastest way to restore the default install path if a stable release - [`scripts/build-npm.sh`](../scripts/build-npm.sh) - [`scripts/generate-npm-package-json.mjs`](../scripts/generate-npm-package-json.mjs) +- [`scripts/generate-ui-package-json.mjs`](../scripts/generate-ui-package-json.mjs) - [`scripts/release-package-map.mjs`](../scripts/release-package-map.mjs) - [`cli/esbuild.config.mjs`](../cli/esbuild.config.mjs) - [`doc/RELEASING.md`](RELEASING.md) diff --git a/doc/RELEASE-AUTOMATION-SETUP.md b/doc/RELEASE-AUTOMATION-SETUP.md index d987a316..25982892 100644 --- a/doc/RELEASE-AUTOMATION-SETUP.md +++ b/doc/RELEASE-AUTOMATION-SETUP.md @@ -35,6 +35,7 @@ At minimum that includes: - `paperclipai` - `@paperclipai/server` +- `@paperclipai/ui` - public packages under `packages/` ### 2.1. In npm, open each package settings page diff --git a/scripts/generate-ui-package-json.mjs b/scripts/generate-ui-package-json.mjs new file mode 100644 index 00000000..e8eac306 --- /dev/null +++ b/scripts/generate-ui-package-json.mjs @@ -0,0 +1,31 @@ +#!/usr/bin/env node + +import { readFileSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const repoRoot = resolve(__dirname, ".."); +const uiDir = join(repoRoot, "ui"); +const packageJsonPath = join(uiDir, "package.json"); + +const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); + +const publishPackageJson = { + name: packageJson.name, + version: packageJson.version, + description: packageJson.description, + license: packageJson.license, + homepage: packageJson.homepage, + bugs: packageJson.bugs, + repository: packageJson.repository, + type: packageJson.type, + files: ["dist"], + publishConfig: { + access: "public", + }, +}; + +writeFileSync(packageJsonPath, `${JSON.stringify(publishPackageJson, null, 2)}\n`); + +console.log(" ✓ Generated publishable UI package.json"); diff --git a/ui/README.md b/ui/README.md new file mode 100644 index 00000000..0e688669 --- /dev/null +++ b/ui/README.md @@ -0,0 +1,11 @@ +# @paperclipai/ui + +Published static assets for the Paperclip board UI. + +## What gets published + +The npm package contains the production build under `dist/`. It does not ship the UI source tree or workspace-only dependencies. + +## Typical use + +Install the package, then serve or copy the built files from `node_modules/@paperclipai/ui/dist`. diff --git a/ui/package.json b/ui/package.json index a02ddb12..c2471b4b 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,13 +1,29 @@ { "name": "@paperclipai/ui", - "version": "0.0.1", - "private": true, + "version": "0.3.1", + "description": "Prebuilt Paperclip board UI assets.", + "license": "MIT", + "homepage": "https://github.com/paperclipai/paperclip", + "bugs": { + "url": "https://github.com/paperclipai/paperclip/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/paperclipai/paperclip", + "directory": "ui" + }, "type": "module", "scripts": { "dev": "vite", "build": "tsc -b && vite build", "preview": "vite preview", - "typecheck": "tsc -b" + "typecheck": "tsc -b", + "clean": "rm -rf dist tsconfig.tsbuildinfo", + "prepack": "rm -f package.dev.json && cp package.json package.dev.json && node ../scripts/generate-ui-package-json.mjs", + "postpack": "if [ -f package.dev.json ]; then mv package.dev.json package.json; fi" + }, + "publishConfig": { + "access": "public" }, "dependencies": { "@dnd-kit/core": "^6.3.1",