@hominis/fireforge 0.16.0 → 0.16.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.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Scaffolds the default tokens CSS file consumed by `fireforge token add`.
3
+ *
4
+ * Before 0.16.0 `fireforge furnace init` wrote `furnace.json` but not the
5
+ * tokens CSS — every project's first `fireforge token add` hit
6
+ * `Token CSS file not found: browser/themes/shared/<binaryName>-tokens.css`.
7
+ * The 0.16.0 init now calls into this module to write a canonical
8
+ * `:root { … }` shell with a seed set of category headers that
9
+ * `assertTokenCategoryExists` recognises, and registers the tokens CSS
10
+ * path in `patchLint.rawColorAllowlist` so the first token that's an
11
+ * actual color value does not instantly fail `fireforge lint`.
12
+ */
13
+ import type { ProjectLicense } from '../types/config.js';
14
+ /**
15
+ * The set of categories seeded by the default scaffold. `token add
16
+ * --category <name>` accepts any of these without further setup; an
17
+ * operator who needs another category only has to add a matching
18
+ * `/* = My Category = *\/` header inside the `:root` block by hand.
19
+ *
20
+ * The names intentionally mirror the vocabulary used in Firefox's own
21
+ * token files (Colors — Canvas, Spacing, …) so operators coming from
22
+ * upstream don't have to relearn a fork-specific taxonomy.
23
+ */
24
+ export declare const DEFAULT_TOKEN_CATEGORIES: readonly string[];
25
+ /**
26
+ * Generates the default tokens CSS body. Extracted from the init
27
+ * command so tests can assert on the generated shape without running
28
+ * the interactive scaffold flow.
29
+ *
30
+ * @param binaryName - `fireforge.json` `binaryName` used in the
31
+ * rendered file banner so operators can identify the fork on-sight.
32
+ * @param license - Project license; piped through `getLicenseHeader`
33
+ * so the scaffold is SPDX-marked and survives `fireforge lint`'s
34
+ * license-header checks without operator intervention.
35
+ */
36
+ export declare function generateDefaultTokensCss(binaryName: string, license: ProjectLicense): string;
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: EUPL-1.2
2
+ /**
3
+ * Scaffolds the default tokens CSS file consumed by `fireforge token add`.
4
+ *
5
+ * Before 0.16.0 `fireforge furnace init` wrote `furnace.json` but not the
6
+ * tokens CSS — every project's first `fireforge token add` hit
7
+ * `Token CSS file not found: browser/themes/shared/<binaryName>-tokens.css`.
8
+ * The 0.16.0 init now calls into this module to write a canonical
9
+ * `:root { … }` shell with a seed set of category headers that
10
+ * `assertTokenCategoryExists` recognises, and registers the tokens CSS
11
+ * path in `patchLint.rawColorAllowlist` so the first token that's an
12
+ * actual color value does not instantly fail `fireforge lint`.
13
+ */
14
+ import { getLicenseHeader } from './license-headers.js';
15
+ /**
16
+ * The set of categories seeded by the default scaffold. `token add
17
+ * --category <name>` accepts any of these without further setup; an
18
+ * operator who needs another category only has to add a matching
19
+ * `/* = My Category = *\/` header inside the `:root` block by hand.
20
+ *
21
+ * The names intentionally mirror the vocabulary used in Firefox's own
22
+ * token files (Colors — Canvas, Spacing, …) so operators coming from
23
+ * upstream don't have to relearn a fork-specific taxonomy.
24
+ */
25
+ export const DEFAULT_TOKEN_CATEGORIES = [
26
+ 'Colors — General',
27
+ 'Colors — Canvas',
28
+ 'Colors — Experiment',
29
+ 'Spacing',
30
+ ];
31
+ /**
32
+ * Generates the default tokens CSS body. Extracted from the init
33
+ * command so tests can assert on the generated shape without running
34
+ * the interactive scaffold flow.
35
+ *
36
+ * @param binaryName - `fireforge.json` `binaryName` used in the
37
+ * rendered file banner so operators can identify the fork on-sight.
38
+ * @param license - Project license; piped through `getLicenseHeader`
39
+ * so the scaffold is SPDX-marked and survives `fireforge lint`'s
40
+ * license-header checks without operator intervention.
41
+ */
42
+ export function generateDefaultTokensCss(binaryName, license) {
43
+ const header = getLicenseHeader(license, 'css');
44
+ const categoryBlocks = DEFAULT_TOKEN_CATEGORIES.map((category) => ` /* = ${category} = */\n /* (add design tokens for "${category}" here; use \`fireforge token add --category "${category}" …\`) */`).join('\n\n');
45
+ return `${header}
46
+
47
+ /*
48
+ * Design tokens for ${binaryName}.
49
+ *
50
+ * Scaffolded by \`fireforge furnace init\`. Add new tokens with
51
+ * \`fireforge token add --category '<name>' -- <token-name> <value>\`
52
+ * — the command appends into the matching \`/* = <name> = *\\/\` block
53
+ * below and keeps the per-category ordering stable.
54
+ *
55
+ * Raw color literals inside this file are expected — the whole point
56
+ * of the tokens layer is that every other CSS file consumes \`var(…)\`
57
+ * instead of literal colors. \`fireforge furnace init\` adds this
58
+ * file's path to \`patchLint.rawColorAllowlist\` in fireforge.json so
59
+ * \`fireforge lint\` stops flagging the literals here.
60
+ */
61
+
62
+ :root {
63
+ ${categoryBlocks}
64
+ }
65
+
66
+ @media (prefers-color-scheme: dark) {
67
+ :root {
68
+ /* Dark-mode overrides land here. Use \`fireforge token add --mode override --dark-value <v>\`
69
+ to have a token's dark value placed inside this block. */
70
+ }
71
+ }
72
+ `;
73
+ }
74
+ //# sourceMappingURL=token-scaffold.js.map
@@ -372,6 +372,16 @@ export interface FurnaceCreateOptions {
372
372
  * dry-run faithfully previews the real command's outcome.
373
373
  */
374
374
  dryRun?: boolean;
375
+ /**
376
+ * Bypass the configured `componentPrefix` check for the supplied name.
377
+ * Without this flag, a name that does not start with the prefix is
378
+ * rejected before any files are written, so a prefix-mismatched
379
+ * component cannot leave behind a half-scaffolded state. Pass this
380
+ * flag only when you know the prefix mismatch is intentional — e.g.
381
+ * creating an experimental component whose name intentionally breaks
382
+ * the fork's convention.
383
+ */
384
+ allowPrefixMismatch?: boolean;
375
385
  }
376
386
  /**
377
387
  * Options for the wire command.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hominis/fireforge",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "FireForge — a build tool for customizing Firefox",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",