From bd77238411b78bf945a05c5803e220afcbfd1006 Mon Sep 17 00:00:00 2001 From: Edwin Tantawi Date: Fri, 11 Sep 2026 20:30:17 +0700 Subject: [PATCH 01/17] ci(workflows): add checks for pull requests and main --- .github/workflows/ci.yml | 115 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9b576b4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,115 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +permissions: {} # each job declares only the permissions it needs + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + # Superseded pull request runs are safe to drop; main runs always finish. + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + check: + name: Check + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read # to check out repo (actions/checkout) + steps: + - name: Check out repo + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Set up Vite+ and install dependencies + uses: voidzero-dev/setup-vp@v1.19.0 + with: + cache: true + - name: Format, lint and type check + run: vp check + + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read # to check out repo (actions/checkout) + steps: + - name: Check out repo + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Set up Vite+ and install dependencies + uses: voidzero-dev/setup-vp@v1.19.0 + with: + cache: true + - name: Run tests + run: vp test run --coverage + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read # to check out repo (actions/checkout) + steps: + - name: Check out repo + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Set up Vite+ and install dependencies + uses: voidzero-dev/setup-vp@v1.19.0 + with: + cache: true + - name: Build packages + run: vp run build + + commit: + name: Commit message + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read # to check out repo (actions/checkout) + steps: + - name: Check out repo + uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Set up Vite+ and install dependencies + uses: voidzero-dev/setup-vp@v1.19.0 + with: + cache: true + - name: Lint pull request title + env: + # Pull requests are squash merged, so the title becomes the commit + # subject on main and has to satisfy the same commitlint rules. + # Read through the environment, never interpolated into the script. + PR_TITLE: ${{ github.event.pull_request.title }} + run: printf '%s' "$PR_TITLE" | vp run commitlint + + changeset: + name: Changeset + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read # to check out repo (actions/checkout) + steps: + - name: Check out repo + uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 # changeset status diffs against the base branch + persist-credentials: false + - name: Set up Vite+ and install dependencies + uses: voidzero-dev/setup-vp@v1.19.0 + with: + cache: true + - name: Check for a changeset + env: + BASE_REF: ${{ github.base_ref }} + run: vp run changeset status --since="origin/$BASE_REF" From fcce38dad2fc8ba90c2c22c112fba0188364f380 Mon Sep 17 00:00:00 2001 From: Edwin Tantawi Date: Fri, 11 Sep 2026 20:30:20 +0700 Subject: [PATCH 02/17] docs(community): add contributing, conduct and security policies --- CODE_OF_CONDUCT.md | 136 +++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 120 +++++++++++++++++++++++++++++++++++++++ SECURITY.md | 58 +++++++++++++++++++ 3 files changed, 314 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1e9441d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,136 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement by opening a +[private report](https://github.com/devsantara/batik/security/advisories/new) on +this repository. It is the private channel GitHub gives us, and it is visible +only to the maintainers — you do not need to be reporting a security issue to +use it. + +All complaints will be reviewed and investigated promptly and fairly. All +community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +If the behavior also violates +[GitHub's Acceptable Use Policies](https://docs.github.com/site-policy/acceptable-use-policies/github-acceptable-use-policies), +you can additionally report it to GitHub at +https://github.com/contact/report-abuse. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1a26766 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,120 @@ +# Contributing to Batik + +Thanks for taking the time to contribute. + +Batik is a pnpm workspace built on [Vite+](https://viteplus.dev), which wraps the +runtime, the package manager, and the frontend toolchain behind a single `vp` +CLI. You do not need to install Node.js or pnpm yourself — `vp` downloads the +versions pinned in `package.json` under `devEngines`. + +## Setup + +Install `vp` once, globally: + +```bash +# macOS / Linux +curl -fsSL https://vite.plus | bash + +# Windows +irm https://vite.plus/ps1 | iex +``` + +Then clone and install: + +```bash +git clone git@github.com:devsantara/batik.git +cd batik +vp install +``` + +`vp install` runs the `prepare` script, which installs the Git hooks in +`.vite-hooks/`. Those hooks format and lint staged files on commit and validate +your commit message, so the first `vp install` is not optional. + +Run `vp install` again after every pull — the dependency catalog in +`pnpm-workspace.yaml` moves with it. + +## Working on a change + +| Command | What it does | +| ---------------- | ----------------------------------------------- | +| `vp check` | Format, lint and type check the whole workspace | +| `vp check --fix` | The same, writing the fixes it can apply | +| `vp test` | Run the test suite in watch mode | +| `vp test run` | Run the test suite once | +| `vp run build` | Build every package | + +Run `vp check` and `vp test run` before opening a pull request. CI runs exactly +these commands, so a clean local run means a green PR. + +`vp ` is a built-in command and `vp run ` is a `package.json` script +or a `vite.config.ts` task. They are not interchangeable: `vp check` is the +built-in checker, `vp run check` is the script. When in doubt, `vp help` and +`vp --help` list what is available. + +If setup, runtime, or package-manager behavior looks wrong, run `vp env doctor` +and include its output when you ask for help. + +## Commit messages + +Commits follow [Conventional Commits](https://www.conventionalcommits.org) and +are enforced by commitlint through the `commit-msg` hook. A **scope is +required**, and the header is capped at 72 characters: + +``` +feat(tokens): add a neutral color scale +fix(react): forward ref on Button +docs(readme): document the token naming rules +``` + +The full rule set lives in `commitlint.config.ts`. To read it as JSON: + +```bash +vp run commitlint --print-config json +``` + +To validate a message before you use it (exit code `0` means valid): + +```bash +printf '%s' "feat(tokens): add a neutral color scale" | vp run commitlint +``` + +If the hook rejects your commit, fix the rules named in brackets — for example +`[subject-case]` — and try again. **Never use `git commit --no-verify`.** + +Pull requests are squash merged, so the **pull request title becomes the commit +subject on `main`** and has to pass the same rules. CI checks it for you. + +## Changesets + +Every change that affects a published package needs a changeset. It is what +decides the next version number and writes the changelog entry: + +```bash +vp run changeset +``` + +Pick the affected packages, pick `patch` / `minor` / `major`, and describe the +change in a sentence a consumer of the package would understand. Commit the +generated file in `.changeset/` alongside your code. + +Changes that ship nothing to npm — CI config, repo docs, tooling — do not need +one. + +Releases are automated: once a pull request with changesets lands on `main`, a +bot opens a "version packages" pull request. Merging that one publishes to npm. +Maintainers handle this; you do not need to. + +## Pull requests + +- Branch off `main`. +- Keep the pull request focused on one thing. Several small pull requests land + faster than one large one. +- Fill in the pull request template. +- Open an issue first for anything large or architectural, so you do not spend + time on an approach that will not be merged. + +## Code of Conduct + +This project ships a [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, +you agree to uphold it. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..1fa7f9e --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,58 @@ +# Security Policy + +## Reporting a vulnerability + +**Please do not report security vulnerabilities through public issues, pull +requests, or discussions.** + +Report them privately through GitHub instead: + +> [**Open a private security advisory**](https://github.com/devsantara/batik/security/advisories/new) + +Only the maintainers can see a report filed this way, and it gives us a private +place to work with you on a fix before anything becomes public. + +If you cannot use that form for any reason, open a regular issue saying only +that you have a security report to make — no details — and a maintainer will +reach out. + +## What to include + +The more of this you can give us, the faster we can confirm and fix it: + +- The affected package and version +- The type of issue and where it is in the source +- Step-by-step instructions to reproduce it, ideally a minimal repository +- A proof of concept, if you have one +- What an attacker could do with it + +## What to expect + +- **Within 72 hours** — we acknowledge the report. +- **Within 7 days** — we confirm whether it is a vulnerability and tell you what + we plan to do. +- **Then** — we keep you updated as we work on the fix, and credit you in the + advisory when it publishes, unless you would rather stay anonymous. + +We ask that you give us a reasonable window to ship a fix before disclosing +publicly. We will not take legal action against anyone who reports in good faith +and follows this policy. + +## Supported versions + +Batik is pre-1.0. Only the latest published version of each package receives +security fixes. Older versions are not patched — please upgrade. + +## How releases are secured + +- Packages publish from GitHub Actions with + [npm trusted publishing](https://docs.npmjs.com/trusted-publishers) (OIDC). No + long-lived npm tokens exist in this repository. +- The publish job runs in a protected `npm` environment that requires a + maintainer to approve each release. +- Release workflows check out with `persist-credentials: false` and every job + declares the narrowest permissions it needs. +- Third-party actions are pinned to exact versions. +- Dependency updates wait out a minimum release age before they can be installed + (`minimumReleaseAge` in `pnpm-workspace.yaml`), which blunts the window for a + compromised upstream release. From 2b00428388bf1079a9615b42972bab69487c0685 Mon Sep 17 00:00:00 2001 From: Edwin Tantawi Date: Fri, 11 Sep 2026 20:30:23 +0700 Subject: [PATCH 03/17] chore(github): add issue forms, pull request and codeowners templates --- .github/CODEOWNERS | 4 ++ .github/ISSUE_TEMPLATE/bug_report.yml | 77 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 11 ++++ .github/ISSUE_TEMPLATE/feature_request.yml | 55 ++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 40 +++++++++++ 5 files changed, 187 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..40412ce --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# Review is requested from these owners on every pull request. +# https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + +* @edwintantawi diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..3a08a82 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,77 @@ +name: Bug report +description: Something in Batik does not work the way it is documented +labels: ['bug', 'triage'] +body: + - type: markdown + attributes: + value: | + Thanks for the report. A minimal reproduction is the single most useful + thing you can give us — it usually turns a week of back and forth into + an afternoon. + + - type: checkboxes + id: preflight + attributes: + label: Before you start + options: + - label: I searched the existing issues and this has not been reported yet. + required: true + - label: I am on the latest version of the affected package. + required: true + + - type: input + id: package + attributes: + label: Affected package and version + placeholder: '@devsantara/batik-tokens@0.2.1' + validations: + required: true + + - type: textarea + id: description + attributes: + label: What happened + description: What you saw, and what you expected instead. + validations: + required: true + + - type: input + id: reproduction + attributes: + label: Reproduction + description: >- + A link to a minimal repository or a StackBlitz that shows the bug. + Issues without one may be closed without investigation. + placeholder: https://github.com/your-name/batik-bug + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to reproduce + placeholder: | + 1. Install the package + 2. Render `