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.
35 lines
1.1 KiB
YAML
35 lines
1.1 KiB
YAML
# Publishes @openkhalix/tansy-ui when a version tag (v0.4.0, v1.0.0 …) is pushed.
|
|
#
|
|
# Needs a repository secret NPM_TOKEN: an npm "Automation" (or granular
|
|
# publish) token for an account that belongs to the openkhalix npm org.
|
|
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
registry-url: https://registry.npmjs.org
|
|
- run: npm ci
|
|
- name: Tag must match the package version
|
|
run: |
|
|
version=$(node -p "require('./packages/ui/package.json').version")
|
|
if [ "${GITHUB_REF_NAME}" != "v${version}" ]; then
|
|
echo "Tag ${GITHUB_REF_NAME} does not match package version v${version}" >&2
|
|
exit 1
|
|
fi
|
|
- run: npm run lint
|
|
- run: npm test
|
|
# prepublishOnly re-runs typecheck, tests and the library build.
|
|
- run: npm publish -w @openkhalix/tansy-ui --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|