Package Tansy UI as @openkhalix/tansy-ui in a monorepo (v0.4.0)
CI / check (push) Successful in 3m9s
Release / publish (push) Failing after 1m22s

Restructure the repo into npm workspaces so the component kit publishes as
its own package, like MUI and shadcn/ui:

- packages/ui: @openkhalix/tansy-ui (published), with components, stories,
  tests, tokens and the library build
- packages/brand: private logo and catalogue data shared by both apps
- apps/site: the landing page
- apps/docs: Storybook

The package:
- MIT licence (copyright OpenKhalix)
- per-component ES modules and type declarations
- "use client" on component modules so they import into Next.js Server
  Components; helpers stay server-safe
- tokens.css for Tailwind v4 apps, and a prebuilt styles.css for apps
  without Tailwind
- lucide-react 1.x, whose types compile against current React 19 types

The apps resolve the package through a "source" export condition, so they
hot-reload component edits, while outside users get dist/.

scripts/test-package.mjs packs the package and installs the tarball into
Vite + Tailwind (strict types), plain React and Next.js apps; each must
build and render correctly. Gitea workflows run CI on push and publish to
npm when a vX.Y.Z tag matching the package version is pushed.
This commit is contained in:
thekhalidsha committed 2026-09-29 09:24:03 +05:30
1 parent 23e67006d3
commit 9255b255a6
214 files changed
+1521 -389

No files matched your search

+12 -9
View File
@@ -37,6 +37,8 @@ REPO = Path(__file__).resolve().parent.parent
STAGE = Path("/tmp/tansy-stage")
ZIP = Path("/tmp/tansy-deploy.zip")
ENV_FILE = REPO / "scripts" / "deploy.env"
SITE_DIST = REPO / "apps" / "site" / "dist"
STORYBOOK = REPO / "apps" / "docs" / "storybook-static"
# The docroot must keep these regardless of what a build contains: cPanel
# writes them, and removing .htaccess would take the site offline.
@@ -157,10 +159,11 @@ def run(cmd: list[str], cwd: Path = REPO, timeout: int = 900) -> None:
def build() -> None:
run(["npm", "ci"])
run(["npm", "run", "lint"])
run(["npm", "test"])
# Builds the package, then the landing page and Storybook.
run(["npm", "run", "build"])
run(["npm", "run", "build-storybook"])
if not (REPO / "storybook-static" / "index.json").exists():
die("storybook-static/index.json missing after build-storybook")
if not (STORYBOOK / "index.json").exists():
die(f"{STORYBOOK}/index.json missing after the Storybook build")
def git(*args: str) -> str:
@@ -177,7 +180,7 @@ def require_clean_tree() -> None:
def build_stamp() -> dict:
version = json.loads((REPO / "package.json").read_text())["version"]
version = json.loads((REPO / "packages" / "ui" / "package.json").read_text())["version"]
return {
"version": version,
"commit": git("rev-parse", "--short", "HEAD"),
@@ -187,11 +190,11 @@ def build_stamp() -> dict:
def package() -> dict:
dist = REPO / "dist"
sb = REPO / "storybook-static"
dist = SITE_DIST
sb = STORYBOOK
for d in (dist, sb):
if not d.is_dir():
die(f"{d} does not exist - run: npm run build && npm run build-storybook")
die(f"{d} does not exist - run: npm run build")
if STAGE.exists():
shutil.rmtree(STAGE)
@@ -366,14 +369,14 @@ def verify(panel: Panel) -> None:
idx = panel.get_from_origin("/index.html")
live_sha = _h.sha256(idx.encode()).hexdigest()
local_sha = _h.sha256((REPO / "dist" / "index.html").read_bytes()).hexdigest()
local_sha = _h.sha256((SITE_DIST / "index.html").read_bytes()).hexdigest()
if live_sha != local_sha:
die(f"index.html mismatch\n live {live_sha[:32]}\n local {local_sha[:32]}")
log("index.html matches the local build")
sb = panel.get_from_origin("/docs/index.json")
sb_sha = _h.sha256(sb.encode()).hexdigest()
sb_local = _h.sha256((REPO / "storybook-static" / "index.json").read_bytes()).hexdigest()
sb_local = _h.sha256((STORYBOOK / "index.json").read_bytes()).hexdigest()
if sb_sha != sb_local:
die("docs/index.json mismatch")
log("docs/index.json matches")