mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
Match the layout convention used elsewhere in the Hanzo / Liquidity stack
(pkgs/* for libraries, apps/* for consumer apps, templates/* for starters).
Layout changes:
pkgs/ ← code/{compiler,core,packages,ui,ui-admin}/
apps/ ← code/{admin-base,admin-tasks,demos,gui.hanzo.ai,
kitchen-sink*,sandbox,tests}/
templates/ ← code/starters/* (flattened — no more starters/ subdir)
Updated:
- package.json workspaces glob.
- All scripts/* path references (postinstall, format, repair, release,
sync-gui-versions, ci-serve, check-references, etc).
- ../../tasks/scripts/sync-admin-ui.sh — DEFAULT_SRC now points at
../gui/apps/admin-tasks (and scrubbed Tamagui mentions in comments).
- ~/work/hanzo/HANZO_BINARY.md doctrine doc.
- ~/work/hanzo/ui/pkg/ui/BASES.md framework-bases doc.
- gui CLAUDE.md, CONTRIBUTING.md.
- Memory entries.
Side-effect fix: ui-admin/src/primitives/index.ts now re-exports
PageShell from ../shell/PageShell. Several IAM identity pages
(GroupEdit, OrgEdit, GroupTree, UserEdit, RoleEdit) imported PageShell
from ./primitives — pre-existing barrel mismatch the test suite missed
because the smoke tests don't full-render. The rename surfaced it via
production build; back-compat re-export keeps both barrels working.
Verification:
- bun install: clean.
- ui-admin tests: 127/127 green.
- admin-tasks vite build: 721 KB JS / 213 KB gzip + 10 KB CSS, clean.
83 lines
3.2 KiB
TypeScript
83 lines
3.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { insertCssImport } from '../src/build'
|
|
|
|
describe('insertCssImport', () => {
|
|
const cssImport = 'import "./styles.css"'
|
|
|
|
it('should prepend CSS import when no directive is present', () => {
|
|
const js = `import { useState } from 'react'\n\nexport function Component() {}`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`import "./styles.css"\nimport { useState } from 'react'\n\nexport function Component() {}`
|
|
)
|
|
})
|
|
|
|
it('should insert CSS import after "use client" directive with double quotes', () => {
|
|
const js = `"use client"\nimport { useState } from 'react'\n\nexport function Component() {}`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`"use client"\nimport "./styles.css"\nimport { useState } from 'react'\n\nexport function Component() {}`
|
|
)
|
|
})
|
|
|
|
it('should insert CSS import after "use client" directive with single quotes', () => {
|
|
const js = `'use client'\nimport { useState } from 'react'\n\nexport function Component() {}`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`'use client'\nimport "./styles.css"\nimport { useState } from 'react'\n\nexport function Component() {}`
|
|
)
|
|
})
|
|
|
|
it('should insert CSS import after "use server" directive', () => {
|
|
const js = `"use server"\nimport { db } from './db'\n\nexport async function action() {}`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`"use server"\nimport "./styles.css"\nimport { db } from './db'\n\nexport async function action() {}`
|
|
)
|
|
})
|
|
|
|
it('should handle directive with semicolon', () => {
|
|
const js = `"use client";\nimport { useState } from 'react'`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`"use client";\nimport "./styles.css"\nimport { useState } from 'react'`
|
|
)
|
|
})
|
|
|
|
it('should handle directive without newline after it', () => {
|
|
const js = `"use client"import { useState } from 'react'`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`"use client"import "./styles.css"\nimport { useState } from 'react'`
|
|
)
|
|
})
|
|
|
|
it('should not match "use client" that appears later in the file', () => {
|
|
const js = `import { useState } from 'react'\nconst x = "use client"\nexport function Component() {}`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`import "./styles.css"\nimport { useState } from 'react'\nconst x = "use client"\nexport function Component() {}`
|
|
)
|
|
})
|
|
|
|
it('should handle empty file', () => {
|
|
const js = ''
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(`import "./styles.css"\n`)
|
|
})
|
|
|
|
it('should handle file with only directive', () => {
|
|
const js = `"use client"`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(`"use client"import "./styles.css"\n`)
|
|
})
|
|
|
|
it('should preserve multiple newlines after directive', () => {
|
|
const js = `"use client"\n\n\nimport { useState } from 'react'`
|
|
const result = insertCssImport(js, cssImport)
|
|
expect(result).toBe(
|
|
`"use client"\nimport "./styles.css"\n\n\nimport { useState } from 'react'`
|
|
)
|
|
})
|
|
})
|