From b953ab1148278bcaf3e213d17bc8e8aedac313a9 Mon Sep 17 00:00:00 2001 From: David East Date: Tue, 21 Apr 2026 12:47:14 -0400 Subject: [PATCH] docs: update README and spec generation - Replace outdated tailwind command with export command in root README - Add spec:gen script to packages/cli/package.json - Fix path to repo root in generate.ts so it can find docs/spec.md - Ignore smoke-test/ and *.tgz in packages/cli/.gitignore - Note: packages/cli/README.md is generated from root README and ignored. --- README.md | 12 ++-- packages/cli/.gitignore | 2 + packages/cli/package.json | 58 ++++++++++---------- packages/cli/src/linter/spec-gen/generate.ts | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 1b8bf8e2..c7d9f0b5 100644 --- a/README.md +++ b/README.md @@ -220,19 +220,19 @@ npx @google/design.md diff DESIGN.md DESIGN-v2.md Exit code `1` if regressions are detected (more errors or warnings in the "after" file). -### `tailwind` +### `export` -Generate a Tailwind CSS `theme.extend` configuration from a DESIGN.md file. +Export DESIGN.md tokens to other formats (tailwind, dtcg). ```bash -npx @google/design.md tailwind DESIGN.md > tailwind.theme.json +npx @google/design.md export --format tailwind DESIGN.md > tailwind.theme.json +npx @google/design.md export --format dtcg DESIGN.md > tokens.json ``` | Option | Type | Default | Description | |:-------|:-----|:--------|:------------| -| `file` | positional | required | Path to DESIGN.md | - -Outputs a JSON object with `theme.extend` containing `colors`, `fontFamily`, `fontSize`, `borderRadius`, and `spacing` mapped from the design tokens. +| `file` | positional | required | Path to DESIGN.md (or `-` for stdin) | +| `--format` | `tailwind` \| `dtcg` | required | Output format | ### `spec` diff --git a/packages/cli/.gitignore b/packages/cli/.gitignore index f0f644ee..64f419e6 100644 --- a/packages/cli/.gitignore +++ b/packages/cli/.gitignore @@ -1,2 +1,4 @@ LICENSE README.md +smoke-test/ +*.tgz diff --git a/packages/cli/package.json b/packages/cli/package.json index aa42f93e..5f66e7c5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,14 +1,13 @@ { "name": "@google/design.md", - "version": "0.1.0", - "description": "A design.md CLI tool by Google Stitch.", + "version": "0.1.1", + "description": "Bridging design systems and code: a linter and exporter for the DESIGN.md format", "keywords": [ "design.md" ], "repository": { "type": "git", - "url": "git+https://github.com/google-labs-code/design.md.git", - "directory": "packages/cli" + "url": "git+https://github.com/google-labs-code/design.md.git" }, "bugs": { "url": "https://github.com/google-labs-code/design.md/issues" @@ -16,21 +15,12 @@ "main": "./dist/index.js", "types": "./dist/index.d.ts", "files": [ - "dist", - "README.md", - "LICENSE" + "dist" ], - "license": "Apache-2.0", - "publishConfig": { - "access": "public" - }, + "private": false, "type": "module", - "engines": { - "node": ">=22.0.0" - }, "bin": { - "design.md": "./dist/index.js", - "designmd": "./dist/index.js" + "design.md": "./dist/index.js" }, "exports": { ".": { @@ -40,34 +30,42 @@ "./linter": { "import": "./dist/linter/index.js", "types": "./dist/linter/index.d.ts" - }, - "./package.json": "./package.json" + } + }, + "publishConfig": { + "registry": "https://wombat-dressing-room.appspot.com", + "access": "public" }, "scripts": { - "prepublishOnly": "bun run build", - "build": "bun build src/index.ts src/linter/index.ts --outdir dist --target node && npx tsc --project tsconfig.build.json --emitDeclarationOnly --skipLibCheck && cp src/linter/spec-config.yaml dist/linter/ && cp src/linter/spec-config.yaml dist/ && cp ../../docs/spec.md dist/linter/ && cp ../../docs/spec.md dist/ && cp ../../README.md . && cp ../../LICENSE .", + "build": "bun build src/index.ts src/linter/index.ts --outdir dist --target node && npx tsc --project tsconfig.build.json --emitDeclarationOnly --skipLibCheck && cp src/linter/spec-config.yaml dist/linter/ && cp src/linter/spec-config.yaml dist/ && cp ../../docs/spec.md dist/linter/", "dev": "bun run src/index.ts", "test": "bun test", + "spec:gen": "bun run src/linter/spec-gen/generate.ts", "check-package": "bun run scripts/check-package.ts" }, "dependencies": { - "zod": "^3.24.0" - }, - "devDependencies": { - "@types/bun": "latest", - "@types/mdast": "^4.0.4", - "@types/node": "^20.11.24", - "bun-types": "^1.3.12", + "@json-render/core": "^0.16.0", + "@json-render/ink": "^0.16.0", "citty": "^0.1.6", + "ink": "^7.0.0", "mdast": "^3.0.0", + "react": "^19.2.5", "remark-frontmatter": "^5.0.0", "remark-mdx": "^3.1.1", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", - "tailwindcss": "3", - "typescript": "^5.7.3", "unified": "^11.0.5", "unist-util-visit": "^5.1.0", - "yaml": "^2.7.1" + "yaml": "^2.7.1", + "zod": "^3.24.0" + }, + "devDependencies": { + "@types/bun": "latest", + "@types/mdast": "^4.0.4", + "@types/node": "^20.11.24", + "@types/react": "^19.2.14", + "bun-types": "^1.3.12", + "tailwindcss": "3", + "typescript": "^5.7.3" } } diff --git a/packages/cli/src/linter/spec-gen/generate.ts b/packages/cli/src/linter/spec-gen/generate.ts index ccd61dbb..b622ec37 100644 --- a/packages/cli/src/linter/spec-gen/generate.ts +++ b/packages/cli/src/linter/spec-gen/generate.ts @@ -27,7 +27,7 @@ import { compileMdx } from './compiler.js'; import { SPEC_CONFIG } from '../spec-config.js'; import * as renderers from './renderers.js'; -const ROOT = resolve(import.meta.dir, '../../../../'); +const ROOT = resolve(import.meta.dir, '../../../../../'); const MDX_PATH = resolve(import.meta.dir, 'spec.mdx'); const OUTPUT_PATH = resolve(ROOT, 'docs/spec.md');