Files
zeekayandHanzo Dev 6370fee218 Converge on Hanzo 8.x: @hanzo/gui, no Tailwind, one compiler
The 8.x refactor happened upstream; this package was still pinned to the
102.0.0-rc line and importing the pre-rename `hanzogui`. Two of its barrels
exported names that no longer existed (`createHanzoguiConfig`,
`HanzoguiConfigOptions`) and `src/tg/index.ts` re-exported files that were not
in its directory, so `tsc` could not have passed on `main`.

Packages
  [email protected] → @hanzo/gui@^8.0.1, and the four @hanzogui/* peers to
  ^8.0.0. Dropped @hanzogui/config-default and @hanzogui/animations-react-native
  entirely: the config package was consulted for exactly three static maps
  (tokens.radius, tokens.zIndex, media) and dragged react-native into a web
  theming package to get them. Those maps now live beside the size and space
  scales they belong with, in src/gui/defaults/. Verified against @hanzo/gui
  8.0.1 that the produced config is unchanged — radius $4 = 9, zIndex $3 = 300,
  all fourteen media keys, 280 themes.

Tailwind, shadcn, Radix
  The generated stylesheets emitted `@theme` and `@theme inline` blocks to
  register colors as Tailwind utilities. Those blocks are gone; what remains is
  `:root` / `.dark` custom properties, the same shape and the same dark selector
  as @hanzo/ui/theme.css. The semantic token map had drifted into two homes — a
  hand-edited shadcn-semantic-colors.css and a TS map that disagreed with it
  about `--primary` (step 9 vs step 10) — so the CSS file is deleted and
  dist/css/semantic.css is emitted from the map at build time. The dark block
  now carries only the roles whose step actually changes.

TypeScript 7
  tsgo for both typecheck and emit (~0.5s). It needs types: ["node", "react"]
  spelled out in tsconfig or it fails to find @types/node. tsup is gone with it:
  it and tsc were both writing dist/css/generate-palettes.js, and tsc's own ESM
  output is a perfectly good bin. One compiler, one output format — the package
  is now "type": "module" with explicit .js extensions, so Node resolves it
  rather than relying on a bundler to forgive extensionless ESM.

Also
  Export paths follow the rename (/gui, /gui/components, /gui/defaults, /css,
  /semantic.css) and a new root export carries the dependency-free color math.
  LLM.md was a tracked symlink to a gitignored file, dangling in every clone;
  it is a real file now. README described a differently-named package with
  export paths that did not exist.

Verified: pnpm build green, tsgo and tsc 5.9 both clean, CLI exercised on a real
brand.json, all six export subpaths resolved and imported from a linked dist.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-03 17:55:59 -07:00

48 lines
1.8 KiB
JavaScript
Executable File

#!/usr/bin/env node
// Prepares dist/ for publish: renders the semantic stylesheet, marks the CLI
// executable, and writes a cleaned package.json plus README + LICENSE, so that
// `pnpm publish` (with publishConfig.directory: "dist") finds a complete
// package root inside dist/.
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
const dist = path.join(root, 'dist')
if (!fs.existsSync(dist)) {
console.error('dist/ does not exist — run the rest of the build first')
process.exit(1)
}
// semantic.css is emitted from the same map the generator exports, so the
// shipped stylesheet and the programmatic API can never drift apart.
const { generateSemanticCss } = await import(pathToFileURL(path.join(dist, 'css/semantic.js')))
fs.writeFileSync(path.join(dist, 'css/semantic.css'), generateSemanticCss())
fs.chmodSync(path.join(dist, 'css/generate-palettes.js'), 0o755)
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
// Fields that don't belong in the published package
delete pkg.scripts
delete pkg.devDependencies
// directory only matters at publish time; strip from the dist/ copy
if (pkg.publishConfig?.directory) delete pkg.publishConfig.directory
// `files` is interpreted relative to the package root — and here, dist/ IS the root,
// so `files: ["dist"]` would point at a non-existent dist/dist/. Drop entirely;
// pnpm publishes everything under the root by default.
delete pkg.files
fs.writeFileSync(path.join(dist, 'package.json'), JSON.stringify(pkg, null, 2) + '\n')
for (const f of ['README.md', 'LICENSE']) {
const src = path.join(root, f)
if (fs.existsSync(src)) fs.copyFileSync(src, path.join(dist, f))
}
console.log('prepared dist/ for publish')