Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: turn off generated timestamp by default in file headers #1174

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/four-fireants-try.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'style-dictionary': patch
---

Pass outputReferencesFallback option to the relevant utilities, so the option actually works.
Pass outputReferenceFallbacks option to the relevant utilities, so the option actually works.
33 changes: 33 additions & 0 deletions .changeset/young-cameras-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
'style-dictionary': major
---

BREAKING: For formats using the `fileHeader` `formatHelpers` utility, it will no longer display a timestamp in the fileHeader output by default. This is now an opt-in by setting `file.formatting.fileHeaderTimestamp` to `true`. The reason for making this opt-in now is that using Style Dictionary in the context of a CI (continuous integration) pipeline is a common use-case, and when running on pull request event, output files always show a diff in git due to the timestamp changing, which often just means that the diff is bloated by redundancy.

New:

```json
{
"platforms": {
"css": {
"files": [{
"destination": "variables.css",
"format": "css/variables",
"options": {
"formatting": {
"fileHeaderTimestamp": true
}
}
}]
}
}
}
```

or:

```js
import { fileHeader } from 'style-dictionary/utils';

const headerContent = await fileHeader({ formatting: { fileHeaderTimestamp: true } });
```
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@

### Patch Changes

- 72f020d: Pass outputReferencesFallback option to the relevant utilities, so the option actually works.
- 72f020d: Pass outputReferenceFallbacks option to the relevant utilities, so the option actually works.
- d008c67: Fix a couple of spots where DTCG option wasn't properly taken into account, more tests added.

## 4.0.0-prerelease.15
Expand Down
9 changes: 3 additions & 6 deletions __integration__/__snapshots__/android.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ snapshots["integration android android/resources should match snapshot"] =
`<?xml version="1.0" encoding="UTF-8"?>

<!--
Do not edit directly
Generated on Sat, 01 Jan 2000 00:00:00 GMT
Do not edit directly, this file was auto-generated.
-->
<resources>
<color name="color_background_primary">#ffffffff</color>
Expand Down Expand Up @@ -178,8 +177,7 @@ snapshots["integration android android/resources with references should match sn
`<?xml version="1.0" encoding="UTF-8"?>

<!--
Do not edit directly
Generated on Sat, 01 Jan 2000 00:00:00 GMT
Do not edit directly, this file was auto-generated.
-->
<resources>
<color name="color_background_primary">@color/color_core_neutral_0</color>
Expand Down Expand Up @@ -351,8 +349,7 @@ snapshots["integration android android/resources with filter should match snapsh
`<?xml version="1.0" encoding="UTF-8"?>

<!--
Do not edit directly
Generated on Sat, 01 Jan 2000 00:00:00 GMT
Do not edit directly, this file was auto-generated.
-->
<resources>
<color name="color_background_primary">#ffffffff</color>
Expand Down
6 changes: 2 additions & 4 deletions __integration__/__snapshots__/compose.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export const snapshots = {};
snapshots["integration compose compose/object should match snapshot"] =
`

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.



Expand Down Expand Up @@ -183,8 +182,7 @@ object StyleDictionary {
snapshots["integration compose compose/object with references should match snapshot"] =
`

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.



Expand Down
12 changes: 4 additions & 8 deletions __integration__/__snapshots__/css.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ export const snapshots = {};

snapshots["integration css css/variables should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand Down Expand Up @@ -179,8 +178,7 @@ snapshots["integration css css/variables should match snapshot"] =

snapshots["integration css css/variables with references should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand Down Expand Up @@ -355,8 +353,7 @@ snapshots["integration css css/variables with references should match snapshot"]

snapshots["integration css css/variables with selector should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

.test {
Expand Down Expand Up @@ -531,8 +528,7 @@ snapshots["integration css css/variables with selector should match snapshot"] =

snapshots["integration css css/variables with referenceFallbacks should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand Down
9 changes: 3 additions & 6 deletions __integration__/__snapshots__/customFileHeader.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export const snapshots = {};
snapshots["integration valid custom file headers file options registered file header should match snapshot"] =
`/**
* hello
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -16,8 +15,7 @@ snapshots["integration valid custom file headers file options registered file he

snapshots["integration valid custom file headers file options config file header should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
* hello, world!
*/

Expand All @@ -40,8 +38,7 @@ snapshots["integration valid custom file headers file options inline file header

snapshots["integration valid custom file headers platform options no file options should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
* hello, world!
*/

Expand Down
9 changes: 3 additions & 6 deletions __integration__/__snapshots__/flutter.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ snapshots["integration flutter flutter/class.dart should match snapshot"] =
// style_dictionary.dart
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.



Expand Down Expand Up @@ -188,8 +187,7 @@ snapshots["integration flutter flutter/class.dart with references should match s
// style_dictionary_with_references.dart
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.



Expand Down Expand Up @@ -369,8 +367,7 @@ snapshots["integration flutter flutter/class.dart separate should match snapshot
// style_dictionary_color.dart
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.



Expand Down
21 changes: 7 additions & 14 deletions __integration__/__snapshots__/iOSObjectiveC.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ snapshots["integration ios objective-c ios/singleton.m should match snapshot"] =
// singleton.m
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import "StyleDictionary.h"
Expand Down Expand Up @@ -1367,8 +1366,7 @@ snapshots["integration ios objective-c ios/singleton.h should match snapshot"] =
// singleton.h
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import <Foundation/Foundation.h>
Expand All @@ -1389,8 +1387,7 @@ snapshots["integration ios objective-c ios/color.m should match snapshot"] =
// color.m
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import "StyleDictionaryColor.h"
Expand Down Expand Up @@ -1575,8 +1572,7 @@ snapshots["integration ios objective-c ios/color.h should match snapshot"] =
// color.h
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import <UIKit/UIKit.h>
Expand Down Expand Up @@ -1749,8 +1745,7 @@ snapshots["integration ios objective-c ios/macros.h should match snapshot"] =
// macros.h
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import <Foundation/Foundation.h>
Expand Down Expand Up @@ -1926,8 +1921,7 @@ snapshots["integration ios objective-c ios/static.h should match snapshot"] =
// static.h
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import <Foundation/Foundation.h>
Expand All @@ -1950,8 +1944,7 @@ snapshots["integration ios objective-c ios/static.m should match snapshot"] =
// static.m
//

// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.


#import "StyleDictionaryStatic.h"
Expand Down
30 changes: 10 additions & 20 deletions __integration__/__snapshots__/objectValues.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ $border-primary: $size-border solid $color-red;

snapshots["integration object values css/variables shadow should match snapshot with references"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -136,8 +135,7 @@ snapshots["integration object values css/variables shadow should match snapshot

snapshots["integration object values css/variables hsl syntax should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -149,8 +147,7 @@ snapshots["integration object values css/variables hsl syntax should match snaps

snapshots["integration object values css/variables hsl syntax with references should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -162,8 +159,7 @@ snapshots["integration object values css/variables hsl syntax with references sh

snapshots["integration object values css/variables hex syntax should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -175,8 +171,7 @@ snapshots["integration object values css/variables hex syntax should match snaps

snapshots["integration object values css/variables hex syntax with references should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -188,8 +183,7 @@ snapshots["integration object values css/variables hex syntax with references sh

snapshots["integration object values css/variables border should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -200,8 +194,7 @@ snapshots["integration object values css/variables border should match snapshot"

snapshots["integration object values css/variables border with references should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -212,8 +205,7 @@ snapshots["integration object values css/variables border with references should

snapshots["integration object values css/variables shadow should match snapshot"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand All @@ -225,17 +217,15 @@ snapshots["integration object values css/variables shadow should match snapshot"

snapshots["integration object values scss/variables should match snapshot"] =
`
// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.

$border-primary: 0.125rem solid #ff0000;
`;
/* end snapshot integration object values scss/variables should match snapshot */

snapshots["integration object values scss/variables with references should match snapshot"] =
`
// Do not edit directly
// Generated on Sat, 01 Jan 2000 00:00:00 GMT
// Do not edit directly, this file was auto-generated.

$border-primary: $size-border solid $color-red;
`;
Expand Down
3 changes: 1 addition & 2 deletions __integration__/__snapshots__/outputReferences.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ css

snapshots["integration output references should allow using outputReferencesTransformed to not output refs when value has been transitively transformed"] =
`/**
* Do not edit directly
* Generated on Sat, 01 Jan 2000 00:00:00 GMT
* Do not edit directly, this file was auto-generated.
*/

:root {
Expand Down
Loading
Loading