@razorwind/tamagui
v0.0.116
Published
Razorwind plugin that creates Tamagui theme tokens from Razorwind design tokens.
Maintainers
Readme
💨 Razorwind is a unified set of tools that make creating design systems a breeze.
[!IMPORTANT] This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
Razorwind - Tamagui Generator
Razorwind - Tamagui Generator is a Power Plant generator that creates Tamagui theme tokens from Razorwind design tokens.
Quick Features
- Generate a Tamagui config from design tokens.
- Target Tamagui v2 by default or v3 with
target: "v3". - Emit ESLint guardrails for v3 flat values.
- Get v3 setup steps from the generated
INSTALL.md.
Installing
Using pnpm:
pnpm add -D @razorwind/tamaguinpm install -D @razorwind/tamaguiyarn add -D @razorwind/tamaguiUsage
import { defineConfig } from "@razorwind/core";
import tamagui from "@razorwind/tamagui";
export default defineConfig({
plugins: [tamagui()]
});See Tamagui version target to generate v3 output.
Development
Tamagui version target
Generated output targets Tamagui v2 by default. Select v3 to generate a config
with flat-value settings, v3 module augmentation, and v3 bare-token examples
in INSTALL.md:
import tamagui from "@razorwind/tamagui"
tamagui({ target: "v3" })ESLint guardrails (Tamagui v3)
@razorwind/tamagui/eslint is a second generator that emits an ESLint flat-config plugin aligned with the generated Tamagui config. It lints v3 flat values (bg="background hover:background-hover", p="4 sm:6") on JSX components and in styled() configs. It only emits when target is "v3"; with the default "v2" target it writes nothing.
import { defineConfig } from "@razorwind/core"
import tamagui from "@razorwind/tamagui"
import tamaguiEslint from "@razorwind/tamagui/eslint"
export default defineConfig({
plugins: [tamagui({ target: "v3" }), tamaguiEslint({ target: "v3" })]
})// eslint.config.mjs
import guardrails from "./eslint/tamagui/razorwind-guardrails.mjs"
export default [
guardrails({
files: ["src/**/*.{ts,tsx}"],
severity: { "no-stock-palette": "error" }
})
]Token rules only turn on for categories the generated config defines. Use them alongside @tamagui/eslint-plugin's valid-flat-values, which owns grammar and typo checks.
| Rule | Default (when enabled) | Flags |
| ---------------------------- | ---------------------- | ----------------------------------------------------------------- |
| no-legacy-token-prefix | error | bg="$background", p="$4" |
| no-legacy-condition-object | error | hoverStyle={…}, pressStyle, $sm={…}, $theme-dark={…} |
| no-color-literal | error | bg="#fff", color="hover:oklch(…)" |
| no-stock-palette | warn | color="red10" / "red-500" unless the schema defines it |
| no-spacing-literal | warn | p={13}, mt="12px", gap="7" when 7 is not a space token |
| no-radius-literal | error | rounded={3}, borderRadius="3px" |
| no-typography-literal | warn | raw fontSize / lineHeight / letterSpacing, unknown families |
| no-shadow-literal | error | boxShadow="0 2px 4px #000" |
| no-dark-pairs | error | bg="background dark:blue1" when tokens carry a dark set |
| focus-visible | warn | outlineColor="focus:…" (use focus-visible:) |
Every capitalized JSX component is linted by default; pass components: ["View", "Text", …] to restrict it, and callees to change the styled factory names.
| Option | Default | Description |
| --------------- | ------------------------------------------- | ------------------------------------------------- |
| target | "v2" | Must be "v3" for any output |
| eslintPath | "eslint/tamagui/razorwind-guardrails.mjs" | Output path of the generated plugin module |
| prefix | "design-system" | Rule namespace in flat config |
| runtimeImport | "@razorwind/tamagui/eslint-runtime" | Module the generated file imports rules from |
| shorthands | @tamagui/shorthands/v5 | Extra shorthands, merged over the v5 defaults |
| includeTypes | All types | Same token $type filter as the config generator |
| installGuide | Generated | Override body for the generated INSTALL.md |
Building
Run nx build tamagui to build the library.
Running unit tests
Run nx test tamagui to execute the unit tests via Vitest.
Storm Workspaces
Storm workspaces are built using Nx, a set of extensible dev tools for monorepos, which helps you develop like Google, Facebook, and Microsoft. Building on top of Nx, the Open System provides a set of tools and patterns that help you scale your monorepo to many teams while keeping the codebase maintainable.
Roadmap
See the open issues for a list of proposed features (and known issues).
- Top Feature Requests (Add your votes using the 👍 reaction)
- Top Bugs (Add your votes using the 👍 reaction)
- Newest Bugs
Support
Reach out to the maintainer at one of the following places:
License
This project is licensed under the Apache License 2.0. Feel free to edit and distribute this template as you like.
See LICENSE for more information.
Changelog
This project adheres to Semantic Versioning. Every release, along with the migration instructions, is documented in the CHANGELOG file
Contributing
First off, thanks for taking the time to contribute! Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.
Please try to create bug reports that are:
- Reproducible. Include steps to reproduce the problem.
- Specific. Include as much detail as possible: which version, what environment, etc.
- Unique. Do not duplicate existing opened issues.
- Scoped to a Single Bug. One bug per report.
Please adhere to this project's code of conduct.
You can use markdownlint-cli to check for common markdown style inconsistency.
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Storm Software is an open source software development organization and creator of Acidic, StormStack and StormCloud.
Our mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
Join us on Discord to chat with the team, receive release notifications, ask questions, and get involved.
If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our website or join our Slack channel!
