@terrazzo/cli 2.0.0-beta.3 → 2.0.0-beta.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## 2.0.0
4
4
 
5
+ The 2.0.0 release is full of new features:
6
+
7
+ - Full support for the DTCG v2025.10 spec, including resolvers
8
+ - New and improved [native Figma import](https://terrazzo.app/docs/guides/import-from-figma)
9
+ - `@terrazzo/plugin-js` was reimagined as a resolver API to build your own token machine (server-side)
10
+ - `@terrazzo/plugin-css-in-js` was added as the missing solution for type-safe JS to use in any CSS-in-JS library
11
+ - And of course dozens of bugfixes and quality of life improvements
12
+
5
13
  ### Minor Changes
6
14
 
7
15
  - [#530](https://github.com/terrazzoapp/terrazzo/pull/530) [`370ed7b`](https://github.com/terrazzoapp/terrazzo/commit/370ed7b0f578a64824124145d7f4936536b37bb3) Thanks [@drwpow](https://github.com/drwpow)! - ⚠️ Breaking change; DTCG 2nd Editors draft format will throw errors by default. This means converting all colors and dimensions to the new object format.
@@ -48,7 +56,7 @@
48
56
  - Typography
49
57
 
50
58
  These behaviors may be opted out individually by adjusting the new lint rules ([see documentation](https://terrazzo.app/cli/linting/)).
51
-
59
+
52
60
  - [#589](https://github.com/terrazzoapp/terrazzo/pull/589) [`8f32d44`](https://github.com/terrazzoapp/terrazzo/commit/8f32d44792bba62194e674c9b60cfdeb366c96c7) Thanks [@michaelurban](https://github.com/michaelurban)! - feat: add typography shorthand, improve Sass plugin
53
61
 
54
62
  ### Patch Changes
package/bin/cli.js CHANGED
@@ -29,7 +29,17 @@ import { createRequire } from 'node:module';
29
29
  import { parseArgs } from 'node:util';
30
30
  import { Logger } from '@terrazzo/parser';
31
31
  import dotenv from 'dotenv';
32
- import { buildCmd, checkCmd, helpCmd, initCmd, labCmd, loadConfig, normalizeCmd, versionCmd } from '../dist/index.js';
32
+ import {
33
+ buildCmd,
34
+ checkCmd,
35
+ helpCmd,
36
+ importCmd,
37
+ initCmd,
38
+ labCmd,
39
+ loadConfig,
40
+ normalizeCmd,
41
+ versionCmd,
42
+ } from '../dist/index.js';
33
43
 
34
44
  const require = createRequire(process.cwd());
35
45
 
@@ -44,13 +54,18 @@ const { values: flags, positionals } = parseArgs({
44
54
  allowPositionals: true,
45
55
  options: {
46
56
  config: { type: 'string', short: 'c' },
47
- out: { type: 'string', short: 'o' },
48
- output: { type: 'string' },
57
+ output: { type: 'string', short: 'o' },
49
58
  help: { type: 'boolean' },
50
59
  silent: { type: 'boolean' },
51
60
  quiet: { type: 'boolean' }, // secret alias for --silent because I can’t remember it
52
61
  watch: { type: 'boolean', short: 'w' },
53
62
  version: { type: 'boolean' },
63
+ unpublished: { type: 'boolean' },
64
+ 'skip-styles': { type: 'boolean' },
65
+ 'skip-variables': { type: 'boolean' },
66
+ 'font-family-names': { type: 'string' },
67
+ 'font-weight-names': { type: 'string' },
68
+ 'number-names': { type: 'string' },
54
69
  },
55
70
  });
56
71
 
@@ -96,7 +111,12 @@ export default async function main() {
96
111
 
97
112
  // normalize
98
113
  if (cmd === 'normalize') {
99
- await normalizeCmd(positionals[1], { logger, output: flags.out ?? flags.output });
114
+ await normalizeCmd(positionals[1], { logger, output: flags.output });
115
+ process.exit(0);
116
+ }
117
+ // import
118
+ if (cmd === 'import') {
119
+ await importCmd({ flags, logger, positionals });
100
120
  process.exit(0);
101
121
  }
102
122
 
@@ -118,6 +138,7 @@ export default async function main() {
118
138
  await initCmd({ config, flags, logger });
119
139
  break;
120
140
  }
141
+
121
142
  case 'lab': {
122
143
  try {
123
144
  require.resolve('@terrazzo/token-lab');
package/dist/index.d.ts CHANGED
@@ -97,6 +97,54 @@ declare function checkCmd({
97
97
  /** Show help */
98
98
  declare function helpCmd(): void;
99
99
  //#endregion
100
+ //#region src/import/figma/index.d.ts
101
+ interface importFromFigmaOptions {
102
+ url: string;
103
+ logger: Logger;
104
+ /** Grab unpublished Styles/Variables @default false */
105
+ unpublished?: boolean;
106
+ skipStyles?: boolean;
107
+ skipVariables?: boolean;
108
+ /** RegEx for overriding Variable types with fontFamily tokens */
109
+ fontFamilyNames?: string;
110
+ /** RegEx for overriding Variable types with fontWeight tokens */
111
+ fontWeightNames?: string;
112
+ /** RegEx for overriding Variable types with number tokens */
113
+ numberNames?: string;
114
+ }
115
+ interface FigmaOutput {
116
+ variableCount: number;
117
+ styleCount: number;
118
+ /** The Resolver JSON, in object format (could be any shape) */
119
+ code: Record<string, any>;
120
+ }
121
+ declare function importFromFigma({
122
+ url,
123
+ logger,
124
+ unpublished,
125
+ skipStyles,
126
+ skipVariables,
127
+ fontFamilyNames,
128
+ fontWeightNames,
129
+ numberNames
130
+ }: importFromFigmaOptions): Promise<FigmaOutput>;
131
+ /** Is this a valid URL, and one belonging to a Figma file? */
132
+ declare function isFigmaPath(url: string): boolean;
133
+ //#endregion
134
+ //#region src/import/index.d.ts
135
+ interface ImportCmdOptions {
136
+ flags: {
137
+ /** The output file @default stdout */output?: string;
138
+ } & Record<string, any>;
139
+ positionals: string[];
140
+ logger: Logger;
141
+ }
142
+ declare function importCmd({
143
+ flags,
144
+ positionals,
145
+ logger
146
+ }: ImportCmdOptions): Promise<void>;
147
+ //#endregion
100
148
  //#region src/init.d.ts
101
149
  interface InitOptions {
102
150
  logger: Logger;
@@ -133,5 +181,5 @@ declare function versionCmd(): void;
133
181
  //#region src/index.d.ts
134
182
  declare function defineConfig(config: Config): ConfigInit;
135
183
  //#endregion
136
- export { BuildOptions, CheckOptions, Command, DEFAULT_CONFIG_PATH, DEFAULT_TOKENS_PATH, Flags, GREEN_CHECK, InitOptions, LabBuildOptions, LoadConfigOptions, NormalizeOptions, buildCmd, checkCmd, cwd, defineConfig, helpCmd, initCmd, labCmd, loadConfig, loadTokens, normalizeCmd, printError, printSuccess, resolveConfig, resolveTokenPath, time, versionCmd, writeFiles };
184
+ export { BuildOptions, CheckOptions, Command, DEFAULT_CONFIG_PATH, DEFAULT_TOKENS_PATH, FigmaOutput, Flags, GREEN_CHECK, ImportCmdOptions, InitOptions, LabBuildOptions, LoadConfigOptions, NormalizeOptions, buildCmd, checkCmd, cwd, defineConfig, helpCmd, importCmd, importFromFigma, importFromFigmaOptions, initCmd, isFigmaPath, labCmd, loadConfig, loadTokens, normalizeCmd, printError, printSuccess, resolveConfig, resolveTokenPath, time, versionCmd, writeFiles };
137
185
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/shared.ts","../src/build.ts","../src/check.ts","../src/help.ts","../src/init.ts","../src/lab.ts","../src/normalize.ts","../src/version.ts","../src/index.ts"],"mappings":";;;cASa,GAAA,EAAG,GAAA;AAAA,cACH,mBAAA,EAAmB,GAAA;AAAA,cACnB,mBAAA,EAAmB,GAAA;AAAA,KAEpB,OAAA;AAAA,cAEC,WAAA;AAAA,UAEI,KAAA;EAR6C;EAU5D,MAAA;EATqE;EAWrE,GAAA;EAX8B;EAa9B,IAAA;EAZW;EAcX,KAAA;;EAEA,OAAA;AAAA;AAAA,UAGe,iBAAA;EACf,GAAA,EAAK,OAAA;EACL,KAAA,EAAO,KAAA;EACP,MAAA,EAAQ,MAAA;AAAA;AAlBV;AAAA,iBAsBsB,UAAA,CAAA;EAAa,GAAA;EAAK,KAAA;EAAO;AAAA,GAAU,iBAAA,GAAiB,OAAA;;;;AApB1E;AAAA,iBA2GsB,UAAA,CAAW,UAAA,EAAY,GAAA;EAAS;AAAA;EAAY,MAAA,EAAQ,MAAA;AAAA,IAAQ,OAAA;;;;;iBAiGlE,UAAA,CAAW,OAAA;;iBAKX,YAAA,CAAa,OAAA,UAAiB,SAAA;AApM9C;AAAA,iBAyMgB,aAAA,CAAc,QAAA;;iBAgBd,gBAAA,CAAiB,QAAA;EAAoB;AAAA;EAAY,MAAA,EAAQ,MAAA;AAAA,IAAQ,GAAA;;iBAWjE,IAAA,CAAK,KAAA;;;UChPJ,YAAA;EACf,KAAA,EAAO,KAAA;EACP,MAAA,EAAQ,UAAA;EACR,UAAA;EACA,MAAA,EAAQ,MAAA;AAAA;ADZV;AAAA,iBCgBsB,QAAA,CAAA;EAAW,MAAA;EAAQ,UAAA;EAAY,KAAA;EAAO;AAAA,GAAU,YAAA,GAAY,OAAA;;iBAoFlE,UAAA,CAAW,MAAA,EAAQ,iBAAA;EAAqB,MAAA;EAAQ;AAAA;EAAY,MAAA,EAAQ,UAAA;EAAY,MAAA,EAAQ,MAAA;AAAA;;;UC1GvF,YAAA;;EAEf,WAAA;EACA,MAAA,EAAQ,UAAA;EACR,MAAA,EAAQ,MAAA;AAAA;;iBAIY,QAAA,CAAA;EAAW,MAAA;EAAQ,MAAA;EAAQ;AAAA,GAAe,YAAA,GAAY,OAAA;;;;iBCX5D,OAAA,CAAA;;;UCoFC,WAAA;EACf,MAAA,EAAQ,MAAA;AAAA;AAAA,iBAGY,OAAA,CAAA;EAAU;AAAA,GAAU,WAAA,GAAW,OAAA;;;UChFpC,eAAA;EACf,KAAA,EAAO,KAAA;EACP,MAAA,EAAQ,UAAA;EACR,UAAA;EACA,MAAA,EAAQ,MAAA;AAAA;AAAA,iBAGY,MAAA,CAAA;EAAS,MAAA;EAAQ;AAAA,GAAU,eAAA,GAAe,OAAA;;;UCR/C,gBAAA;EACf,MAAA,EAAQ,MAAA;EACR,MAAA,EAAQ,GAAA;AAAA;AAAA,iBASY,YAAA,CAAa,QAAA;EAAoB,MAAA;EAAQ;AAAA,GAAU,gBAAA,GAAgB,OAAA;;;iBCjBzE,UAAA,CAAA;;;iBCeA,YAAA,CAAa,MAAA,EAAQ,MAAA,GAAS,UAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/shared.ts","../src/build.ts","../src/check.ts","../src/help.ts","../src/import/figma/index.ts","../src/import/index.ts","../src/init.ts","../src/lab.ts","../src/normalize.ts","../src/version.ts","../src/index.ts"],"mappings":";;;cASa,GAAA,EAAG,GAAA;AAAA,cACH,mBAAA,EAAmB,GAAA;AAA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