From 82340103c89f0756d4e1ca5f71d94dddb9f0a942 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 3 Sep 2024 15:49:43 -0400 Subject: [PATCH] chore: re-add custom file header to include tokens docs --- lib/build-tokens.js | 15 +++------------ styles/css/core/custom-media-breakpoints.css | 4 ++-- styles/css/core/variables.css | 4 ++-- styles/css/themes/light/utility-classes.css | 4 ++-- styles/css/themes/light/variables.css | 4 ++-- tokens/style-dictionary.js | 11 +++++++++++ 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/build-tokens.js b/lib/build-tokens.js index bbf9e577c6..2fa26c22b4 100755 --- a/lib/build-tokens.js +++ b/lib/build-tokens.js @@ -61,6 +61,9 @@ async function buildTokensCommand(commandArgs) { prefix: 'pgn', // NOTE: buildPath must end with a slash buildPath: buildDir.slice(-1) === '/' ? buildDir : `${buildDir}/`, + options: { + fileHeader: 'customFileHeader', + }, files: [ { format: 'css/custom-variables', @@ -68,9 +71,6 @@ async function buildTokensCommand(commandArgs) { filter: hasSourceTokensOnly ? 'isSource' : undefined, options: { outputReferences, - formatting: { - fileHeaderTimestamp: true, - }, }, }, { @@ -79,9 +79,6 @@ async function buildTokensCommand(commandArgs) { filter: hasSourceTokensOnly ? 'isSource' : undefined, options: { outputReferences, - formatting: { - fileHeaderTimestamp: true, - }, }, }, ], @@ -124,9 +121,6 @@ async function buildTokensCommand(commandArgs) { : `isThemeVariant.${themeVariant}`, options: { outputReferences, - formatting: { - fileHeaderTimestamp: true, - }, }, }, { @@ -135,9 +129,6 @@ async function buildTokensCommand(commandArgs) { filter: hasSourceTokensOnly ? 'isSource' : undefined, options: { outputReferences, - formatting: { - fileHeaderTimestamp: true, - }, }, }, ], diff --git a/styles/css/core/custom-media-breakpoints.css b/styles/css/core/custom-media-breakpoints.css index 13b21e5baa..09745d53bf 100644 --- a/styles/css/core/custom-media-breakpoints.css +++ b/styles/css/core/custom-media-breakpoints.css @@ -1,6 +1,6 @@ /** - * Do not edit directly, this file was auto-generated. - * Generated on Tue, 03 Sep 2024 13:46:25 GMT + * Do not edit directly, this file was auto-generated. while transforming design tokens. + * See /tokens/README.md for more details. */ @custom-media --pgn-size-breakpoint-min-width-xs (min-width: 0); diff --git a/styles/css/core/variables.css b/styles/css/core/variables.css index a989679ba4..97d1d869c2 100644 --- a/styles/css/core/variables.css +++ b/styles/css/core/variables.css @@ -1,6 +1,6 @@ /** - * Do not edit directly, this file was auto-generated. - * Generated on Tue, 03 Sep 2024 13:46:25 GMT + * Do not edit directly, this file was auto-generated. while transforming design tokens. + * See /tokens/README.md for more details. */ :root { diff --git a/styles/css/themes/light/utility-classes.css b/styles/css/themes/light/utility-classes.css index 0542cfc2f0..76948fbcbf 100644 --- a/styles/css/themes/light/utility-classes.css +++ b/styles/css/themes/light/utility-classes.css @@ -1,6 +1,6 @@ /** - * Do not edit directly, this file was auto-generated. - * Generated on Tue, 03 Sep 2024 13:46:26 GMT + * Do not edit directly, this file was auto-generated. while transforming design tokens. + * See /tokens/README.md for more details. */ .bg-accent-a { diff --git a/styles/css/themes/light/variables.css b/styles/css/themes/light/variables.css index f59c9e361f..4cee81a244 100644 --- a/styles/css/themes/light/variables.css +++ b/styles/css/themes/light/variables.css @@ -1,6 +1,6 @@ /** - * Do not edit directly, this file was auto-generated. - * Generated on Tue, 03 Sep 2024 13:46:26 GMT + * Do not edit directly, this file was auto-generated. while transforming design tokens. + * See /tokens/README.md for more details. */ :root { diff --git a/tokens/style-dictionary.js b/tokens/style-dictionary.js index 0e295fc38b..fa56e7f977 100644 --- a/tokens/style-dictionary.js +++ b/tokens/style-dictionary.js @@ -346,6 +346,17 @@ const initializeStyleDictionary = async ({ themes }) => { parser: ({ contents }) => toml.load(contents), }); + /** + * Registers a custom fileHeader. + */ + StyleDictionary.registerFileHeader({ + name: 'customFileHeader', + fileHeader: (defaultMessage) => [ + `${defaultMessage} while transforming design tokens.`, + 'See /tokens/README.md for more details.', + ], + }); + return StyleDictionary; };