@advantacode/brander 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ npx --package @advantacode/brander advantacode-brander setup --out src/brander -
22
22
  This creates `brand.config.ts`, adds a `brand:generate` script, patches your stylesheet imports, and prepares the token output folder.
23
23
 
24
24
  During setup, Brander creates `brand.css` next to your main stylesheet, writes token/theme imports there, and adds a single `@import './brand.css';` to your main stylesheet.
25
- The generated `brand:generate` script uses `advantacode-brander generate` and includes any setup generation flags (`--out`, `--format`, `--theme`, `--prefix`) so repeat runs keep writing to the same target.
25
+ The generated `brand:generate` script preserves the setup generation flags you used, including `--out` and `--style`, so repeat runs keep writing to the same target and refresh the stylesheet wiring when needed.
26
26
 
27
27
  AdvantaCode Brander generates design tokens and framework adapters from a single brand configuration file. It allows applications, design systems, and design tools to share a consistent source of truth for colors and semantic tokens.
28
28
 
@@ -87,6 +87,7 @@ Supported flags:
87
87
  * `--format <list>` limits output to specific formats: `all`, `css`, `json`, `typescript` or `ts`, `scss`, `tailwind`, `bootstrap`, `figma`
88
88
  * `--theme <value>` limits theme CSS output to `light`, `dark`, or `both`
89
89
  * `--prefix <value>` applies a CSS variable prefix like `ac`, producing variables such as `--ac-primary`
90
+ * `--style <path>` refreshes `brand.css` and the main stylesheet import during normal generation so package scripts can keep setup paths aligned
90
91
  * `--version`, `-v` prints the installed package version
91
92
  * `--help`, `-h` prints the CLI help text
92
93
 
@@ -280,6 +281,18 @@ text-danger
280
281
  border-secondary
281
282
  ```
282
283
 
284
+ CommonJS Tailwind config:
285
+
286
+ ```js
287
+ const brandPreset = require("./src/assets/brander/adapters/tailwind.preset");
288
+
289
+ module.exports = {
290
+ presets: [brandPreset]
291
+ };
292
+ ```
293
+
294
+ This step should stay documented rather than auto-patched for now. Unlike stylesheet imports, Tailwind config shape varies across projects between CJS, ESM, TS, Vite plugins, and newer Tailwind entrypoints, so automatic mutation is riskier and easier to get wrong.
295
+
283
296
  ## Bootstrap / SCSS Frameworks
284
297
 
285
298
  Generated file:
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import fs from 'fs';
2
+ import path from 'path';
2
3
  import { generateTokens, supportedFormats } from './generate-tokens.js';
3
- import { setupProject } from './setup.js';
4
+ import { setupProject, syncStyleImports } from './setup.js';
4
5
  export async function runCli(args) {
5
6
  try {
6
7
  if (args.includes('--version') || args.includes('-v')) {
@@ -14,7 +15,7 @@ export async function runCli(args) {
14
15
  return 0;
15
16
  }
16
17
  if (command === 'generate') {
17
- await generateTokens(parseGenerateArgs(commandArgs));
18
+ await runGenerateCommand(parseGenerateArgs(commandArgs));
18
19
  return 0;
19
20
  }
20
21
  await setupProject(parseSetupArgs(command, commandArgs));
@@ -44,6 +45,12 @@ function resolveCommand(args) {
44
45
  }
45
46
  throw new Error(`Unknown command "${firstArg}". Use --help to see supported commands.`);
46
47
  }
48
+ async function runGenerateCommand(options) {
49
+ await generateTokens(options);
50
+ if (options.stylePath) {
51
+ syncStyleImports(options.stylePath, options.outputDir ?? path.join('dist', 'brander'));
52
+ }
53
+ }
47
54
  function parseGenerateArgs(args) {
48
55
  const options = {};
49
56
  for (let index = 0; index < args.length; index += 1) {
@@ -74,6 +81,11 @@ function parseGenerateArgs(args) {
74
81
  index += 1;
75
82
  continue;
76
83
  }
84
+ if (arg === "--style") {
85
+ options.stylePath = getNextArgValue(arg, args, index);
86
+ index += 1;
87
+ continue;
88
+ }
77
89
  if (arg.startsWith("-")) {
78
90
  throw new Error(`Unknown option "${arg}". Use --help to see supported flags.`);
79
91
  }
@@ -186,10 +198,12 @@ Options:
186
198
  --format <list> Comma-separated formats: all, css, json, typescript|ts, scss, tailwind, bootstrap, figma
187
199
  --theme <value> Theme CSS output: light, dark, or both (default: both)
188
200
  --prefix <value> CSS variable prefix. Use "" or omit for no prefix
201
+ --style <path> Main stylesheet file to patch with a brand.css import
189
202
 
190
203
  Examples:
191
204
  advantacode-brander
192
205
  advantacode-brander --out src/tokens
206
+ advantacode-brander --out src/brander --style src/style.css
193
207
  advantacode-brander setup --out src/brander --style src/style.css
194
208
  advantacode-brander init --out resources/brander --skip-imports
195
209
  `;
package/dist/setup.js CHANGED
@@ -43,6 +43,9 @@ export async function setupProject(options) {
43
43
  console.log(` - ${note}`);
44
44
  }
45
45
  }
46
+ export function syncStyleImports(stylePath, outputDir) {
47
+ return ensureStyleImports(stylePath, outputDir);
48
+ }
46
49
  function ensureBrandConfig() {
47
50
  const configPath = path.resolve(process.cwd(), "brand.config.js");
48
51
  if (fs.existsSync(configPath)) {
@@ -149,7 +152,7 @@ function buildImportLine(stylePath, targetPath) {
149
152
  return `@import '${normalizedImportPath}';`;
150
153
  }
151
154
  function buildGenerateCommand(options) {
152
- const commandParts = ["advantacode-brander", "generate"];
155
+ const commandParts = ["advantacode-brander"];
153
156
  const outputDir = options.outputDir ?? defaultSetupOutputDir;
154
157
  commandParts.push("--out", outputDir);
155
158
  if (options.formats && options.formats.length > 0) {
@@ -161,6 +164,9 @@ function buildGenerateCommand(options) {
161
164
  if (options.prefix) {
162
165
  commandParts.push("--prefix", options.prefix);
163
166
  }
167
+ if (options.stylePath) {
168
+ commandParts.push("--style", options.stylePath);
169
+ }
164
170
  return commandParts.join(" ");
165
171
  }
166
172
  function getDefaultBrandConfigTemplate() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@advantacode/brander",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "AdvantaCode Design System Brand Generator",
5
5
  "type": "module",
6
6
  "files": [