Package Tansy UI as @openkhalix/tansy-ui in a monorepo (v0.4.0)
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:
1 parent
23e67006d3
commit
9255b255a6
214 files changed
+1521
-389
No files matched your search
@@ -0,0 +1,25 @@
|
||||
# Runs on every push and pull request. Gitea Actions uses GitHub Actions syntax.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
- run: npm run typecheck
|
||||
- run: npm test
|
||||
# Package, landing page and Storybook.
|
||||
- run: npm run build
|
||||
# What `npm publish` would upload.
|
||||
- run: npm pack -w @openkhalix/tansy-ui --dry-run
|
||||
@@ -0,0 +1,34 @@
|
||||
# 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 }}
|
||||
Reference in new issue
Block a user