Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Maakt een GitHub-release zodra er naar main gemerged wordt.
# Maakt een GitHub-release zodra er naar main gemerged wordt, en zet de CLI
# `projectx-ui` (met de registry erin) op npm.
# Het versienummer komt uit package.json (root). Bestaat de tag vX.Y.Z al,
# dan wordt er niets gereleased: verhoog eerst de versie op developer
# met `npm run version:patch` (of :minor / :major).
Expand All @@ -15,6 +16,8 @@ concurrency:

permissions:
contents: write
# Voor npm: trusted publishing (OIDC) en de provenance-vermelding op npmjs.com.
id-token: write

jobs:
release:
Expand Down Expand Up @@ -61,6 +64,8 @@ jobs:
tar -czf "projectx-ui-registry-$TAG.tar.gz" registry
cp -r registry packages/cli/registry
(cd packages/cli && npm pack --pack-destination ../..)
# Docs-site voor eigen hosting (zie README, "Docs-site zelf hosten").
node scripts/pack-docs.mjs --uit "projectx-ui-docs-site-$TAG"

- name: GitHub-release maken
if: steps.version.outputs.exists == 'false'
Expand All @@ -73,4 +78,30 @@ jobs:
--title "ProjectX UI $TAG" \
--generate-notes \
projectx-ui-registry-$TAG.tar.gz \
projectx-ui-*.tgz
projectx-ui-*.tgz \
projectx-ui-docs-site-$TAG.zip

# npm: de eerste keer met het geheim NPM_TOKEN, daarna via trusted publishing
# (npmjs.com → pakket projectx-ui → Settings → Trusted Publisher: GitHub Actions,
# DafkeDD / ProjectX-UI / release.yml). Dan mag NPM_TOKEN weg. Zie README.
- name: CLI op npm publiceren
if: steps.version.outputs.exists == 'false'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG_VERSION: ${{ steps.version.outputs.tag }}
run: |
VERSION=${TAG_VERSION#v}
PAKKET="projectx-ui-$VERSION.tgz"
if npm view "projectx-ui@$VERSION" version >/dev/null 2>&1; then
echo "projectx-ui@$VERSION staat al op npm — overgeslagen."
exit 0
fi
# Trusted publishing heeft npm 11.5.1 of nieuwer nodig.
npm install -g npm@11 --no-fund --no-audit
if [ -n "$NPM_TOKEN" ]; then
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > "$HOME/.npmrc"
elif ! npm view projectx-ui name >/dev/null 2>&1; then
echo "::warning::projectx-ui staat nog niet op npm en het geheim NPM_TOKEN ontbreekt — niet gepubliceerd. Zie README, 'De CLI op npm zetten'."
exit 0
fi
npm publish "$PAKKET" --access public --provenance
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ apps/docs/public/projectx-ui.css
apps/docs/lib/ui-tailwind-motion.ts
playwright-report
test-results
deploy

# registry-kopie die de release-workflow in het npm-pakket van de CLI legt
packages/cli/registry
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Instructies voor Claude (en andere AI-assistenten) die in deze repo werken.
Dit verhoogt de versie in alle package.json's, package-lock.json en registry/index.json.
2. `git commit -am "chore: release vX.Y.Z"` en `git push` (naar developer).
3. Pull request `developer → main` openen en mergen (`gh pr create --base main --head developer --fill`).
4. De workflow maakt tag `vX.Y.Z` + release. Bestaat de tag al, dan wordt er niets gereleased.
4. De workflow maakt tag `vX.Y.Z` + release en zet de CLI `projectx-ui` op npm (zie README, "De CLI op npm").
Bestaat de tag al, dan wordt er niets gereleased.
5. Daarna `developer` gelijkzetten met `main` (fast-forward, geen extra merge-commit):
`git switch developer && git pull --ff-only origin main && git push`.
De GitHub-melding "main had recent pushes → Compare & pull request" negeren:
Expand Down
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ projectx-ui/

## Using it in another project

As long as the CLI isn't published on npm, link it once from this repo:
The CLI is published on npm as [`projectx-ui`](https://www.npmjs.com/package/projectx-ui), with the registry inside
the package. To work against the latest `developer` instead, link it once from this repo:

```bash
cd packages/cli && npm link # after this, `projectx-ui` works anywhere on your machine
Expand Down Expand Up @@ -311,6 +312,30 @@ On every release: first remove all flags, then label only the components of that

---

## Hosting the docs site

The docs site is a normal Next.js app and runs on any host with Node.js 20 or newer
(for example DirectAdmin or cPanel "Setup Node.js App"). `next.config.mjs` builds a
standalone version, so the host needs no `npm install`.

```bash
npm run deploy:pack # build + deploy/projectx-docs/ and deploy/projectx-docs.zip
npm run deploy:start # try the package locally on http://localhost:3000
```

The package contains `app.js` (the startup file), `LEESMIJ.txt` and `site/` (server, `node_modules`,
static files). On the host:

1. Upload the zip to the application root (e.g. `/home/<user>/projectx-docs`) and extract it there.
2. In the Node.js panel: Node.js version 20 or higher, mode **Production**, startup file **`app.js`**,
application URL e.g. `docs.example.com` (a subdomain or the root of a domain, not a subfolder).
3. Do not click "Run NPM Install": everything is already in `site/`.
4. Restart the app. After an update: upload and extract the new zip, then restart.

Every GitHub release also carries the package as `projectx-ui-docs-site-vX.Y.Z.zip`.

---

## Tests

| Where | What |
Expand Down Expand Up @@ -349,6 +374,17 @@ auto-generated release notes, the registry (`projectx-ui-registry-vX.Y.Z.tar.gz`
and the CLI package (`projectx-ui-X.Y.Z.tgz`). If the tag already exists because you forgot to bump
the version, the workflow skips the release with a warning.

### The CLI on npm

The same workflow publishes that `projectx-ui-X.Y.Z.tgz` to npm (with provenance), unless that version is already there.

- **First time:** on npmjs.com create a *granular access token* (Read and write, all packages, *bypass 2FA*,
short expiry) and store it in GitHub under *Settings → Secrets and variables → Actions* as `NPM_TOKEN`.
Without that secret and as long as the package doesn't exist yet, the workflow skips npm with a warning.
- **After the first publish:** on npmjs.com open the package → *Settings → Trusted Publisher* → GitHub Actions,
with `DafkeDD`, `ProjectX-UI` and `release.yml`. Then delete the token on npmjs.com and the `NPM_TOKEN` secret:
from then on the workflow publishes via OIDC, without a token.

After the release, bring `developer` level with `main` (fast-forward, no extra merge commit):

```bash
Expand Down
38 changes: 37 additions & 1 deletion README.nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ projectx-ui/

## In een ander project gebruiken

Zolang de CLI niet op npm staat, koppel je hem eenmalig vanuit deze repo:
De CLI staat op npm als [`projectx-ui`](https://www.npmjs.com/package/projectx-ui), met de registry in het pakket.
Wil je tegen de nieuwste `developer` werken, koppel hem dan eenmalig vanuit deze repo:

```bash
cd packages/cli && npm link # daarna werkt `projectx-ui` overal op je machine
Expand Down Expand Up @@ -312,6 +313,30 @@ Bij elke release: eerst alle vlaggen weghalen, daarna alleen de componenten van

---

## Docs-site zelf hosten

De docs-site is een gewone Next.js-app en draait op elke hosting met Node.js 20 of nieuwer
(bijvoorbeeld DirectAdmin of cPanel "Setup Node.js App"). `next.config.mjs` bouwt een
zelfstandige (standalone) versie, dus op de hosting is geen `npm install` nodig.

```bash
npm run deploy:pack # build + deploy/projectx-docs/ en deploy/projectx-docs.zip
npm run deploy:start # het pakket lokaal proberen op http://localhost:3000
```

Het pakket bevat `app.js` (het opstartbestand), `LEESMIJ.txt` en `site/` (server, `node_modules`,
statische bestanden). Op de hosting:

1. Upload de zip naar de toepassingsroot (bv. `/home/<gebruiker>/projectx-docs`) en pak hem daar uit.
2. In het Node.js-paneel: Node.js-versie 20 of hoger, modus **Productie**, opstartbestand **`app.js`**,
toepassings-URL bv. `docs.voorbeeld.be` (een subdomein of de hoofdmap van een domein, geen submap).
3. Klik niet op "Run NPM Install": alles zit al in `site/`.
4. Herstart de app. Bij een update: nieuwe zip uploaden en uitpakken, dan herstarten.

Elke GitHub-release bevat het pakket ook als `projectx-ui-docs-site-vX.Y.Z.zip`.

---

## Tests

| Waar | Wat |
Expand Down Expand Up @@ -350,6 +375,17 @@ automatisch gegenereerde release notes, de registry (`projectx-ui-registry-vX.Y.
en het CLI-pakket (`projectx-ui-X.Y.Z.tgz`). Bestaat de tag al omdat je vergat de versie
te verhogen, dan slaat de workflow de release over met een waarschuwing.

### De CLI op npm

Dezelfde workflow zet dat `projectx-ui-X.Y.Z.tgz` op npm (met provenance), tenzij die versie er al staat.

- **De eerste keer:** maak op npmjs.com een *granular access token* (Read and write, alle pakketten, *bypass 2FA*,
korte geldigheid) en bewaar het in GitHub onder *Settings → Secrets and variables → Actions* als `NPM_TOKEN`.
Zonder dat geheim, en zolang het pakket nog niet bestaat, slaat de workflow npm over met een waarschuwing.
- **Na de eerste publicatie:** open op npmjs.com het pakket → *Settings → Trusted Publisher* → GitHub Actions,
met `DafkeDD`, `ProjectX-UI` en `release.yml`. Verwijder daarna het token op npmjs.com en het geheim `NPM_TOKEN`:
vanaf dan publiceert de workflow via OIDC, zonder token.

Na de release zet je `developer` gelijk met `main` (fast-forward, geen extra merge-commit):

```bash
Expand Down
10 changes: 10 additions & 0 deletions apps/docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import createNextIntlPlugin from "next-intl/plugin";
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@projectx/ui"],
// Zelfstandige productiebuild voor eigen hosting: .next/standalone bevat een
// server.js met alleen de node_modules die de site echt nodig heeft.
// `npm run deploy:pack` zet daar static/ en public/ bij (zie README).
output: "standalone",
// De site gebruikt geen next/image; zonder beeldoptimalisatie hoeft sharp
// (± 40 MB) niet mee in het pakket. TypeScript is alleen nodig tijdens de build.
images: { unoptimized: true },
outputFileTracingExcludes: {
"*": ["**/node_modules/@img/**", "**/node_modules/sharp/**", "**/node_modules/typescript/**"],
},
outputFileTracingRoot: new URL("../../", import.meta.url).pathname,
webpack: (config) => {
// De plugin van next-intl laadt zijn codec met een dynamische import
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@projectx/docs",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"scripts": {
"dev": "node scripts/dev.mjs dev",
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "projectx-ui-monorepo",
"private": true,
"version": "0.2.0",
"version": "0.2.1",
"workspaces": [
"packages/*",
"apps/*"
Expand All @@ -20,6 +20,8 @@
"version:major": "node scripts/bump-version.mjs major",
"themes": "node scripts/build-themes.mjs",
"html": "node scripts/build-html.mjs",
"deploy:pack": "npm run build && node scripts/pack-docs.mjs",
"deploy:start": "node deploy/projectx-docs/app.js",
"test:e2e": "npm run build && playwright test",
"test:e2e:snel": "playwright test",
"test:e2e:install": "playwright install chromium"
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# projectx-ui

CLI for [ProjectX UI](https://ui.dafkedd.be): copies components straight into your project, the way shadcn/ui does. The code is yours afterwards. Every component comes in React or HTML, with plain CSS or Tailwind. No dependencies; Node 20 or newer.

```bash
npx projectx-ui init # tokens, base CSS and helpers
npx projectx-ui add button card dialog # copy components (+ their dependencies)
npx projectx-ui add button --style tailwind
npx projectx-ui add --all # everything at once
npx projectx-ui update # update everything + add new components
npx projectx-ui list # overview
```

The component registry ships inside this package, so it works offline. Documentation, live demos and the source of every component: **https://ui.dafkedd.be**. Source code: https://github.com/DafkeDD/ProjectX-UI.
17 changes: 14 additions & 3 deletions packages/cli/bin/projectx-ui.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ async function loadRegistry(explicit) {
const candidates = [
explicit,
process.env.PROJECTX_UI_REGISTRY,
findUp("registry/index.json"),
// Een registry/ hoger in de mappenboom telt alleen als het de onze is: een
// project kan zelf een registry/index.json hebben die niets met ons te maken heeft.
findUp("registry/index.json", isOnzeRegistry),
// Het npm-pakket levert de registry mee naast bin/.
join(here, "../registry/index.json"),
// Ook buiten de monorepo (bv. na `npm link`): de registry naast deze CLI.
join(here, "../../../registry/index.json"),
Expand All @@ -114,11 +117,19 @@ async function loadRegistry(explicit) {
return null;
}

function findUp(relative) {
function isOnzeRegistry(path) {
try {
return JSON.parse(readFileSync(path, "utf8")).name === "projectx-ui";
} catch {
return false;
}
}

function findUp(relative, accept = () => true) {
let dir = cwd;
for (let depth = 0; depth < 8; depth += 1) {
const candidate = join(dir, relative);
if (existsSync(candidate)) return candidate;
if (existsSync(candidate) && accept(candidate)) return candidate;
const parent = dirname(dir);
if (parent === dir) break;
dir = parent;
Expand Down
25 changes: 22 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"name": "projectx-ui",
"version": "0.2.0",
"private": true,
"description": "CLI die ProjectX UI-componenten in je project kopieert. Nul dependencies.",
"version": "0.2.1",
"description": "CLI die ProjectX UI-componenten in je project kopieert (React of HTML, plain CSS of Tailwind). Nul dependencies.",
"keywords": [
"projectx-ui",
"ui",
"components",
"react",
"tailwind",
"cli"
],
"homepage": "https://ui.dafkedd.be",
"repository": {
"type": "git",
"url": "git+https://github.com/DafkeDD/ProjectX-UI.git",
"directory": "packages/cli"
},
"bugs": {
"url": "https://github.com/DafkeDD/ProjectX-UI/issues"
},
"type": "module",
"bin": {
"projectx-ui": "./bin/projectx-ui.mjs"
Expand All @@ -13,5 +29,8 @@
],
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public"
}
}
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@projectx/ui",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"description": "ProjectX UI — een volledig eigen component library. Geen shadcn, geen Radix, geen externe UI-dependencies.",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion registry/index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading