Skip to content

Commit

Permalink
chore: workspace cleanup (#5131)
Browse files Browse the repository at this point in the history
* chore: extracted HTML from js files [ci visual]

* chore: improved type safety in visual stories executor [ci visual]

* chore: improved type safety in build theming preview executor [ci visual]

* chore: replaced glob usages with fast-glob [ci visual]

* chore: removed unused list-fn-icons script [ci visual]

* chore: created executor for syncing the entry for the libraries [ci visual]
  • Loading branch information
g-cheishvili authored Jan 25, 2024
1 parent 697b53f commit 9dc199e
Show file tree
Hide file tree
Showing 93 changed files with 1,942 additions and 1,895 deletions.
5 changes: 4 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"dependsOn": ["^build", "sync-entry"],
"cache": true
},
"test": {
Expand All @@ -17,6 +17,9 @@
},
"build-visual": {
"cache": true
},
"sync-entry": {
"cache": true
}
},
"affected": {
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"build:visual-stories": "nx run-many --target=build-visual --all",
"lint:style": "stylelint \"packages/*/src/**/*.(sa|sc|c)ss\"",
"lint:js": "eslint . --ext .js",
"lint": "yarn run sync-fiori-components && yarn run lint:style && yarn run lint:js",
"lint:fix": "yarn run sync-fiori-components fix && yarn run lint:style --fix && yarn run lint:js --fix",
"lint": "yarn run sync-entries && yarn run lint:style && yarn run lint:js",
"lint:fix": "yarn run sync-entries fix && yarn run lint:style --fix && yarn run lint:js --fix",
"lint:pre-commit": "echo running pre-commit lint... && yarn run lint && echo done!\n",
"hotfix-release": "./scripts/hotfix-publish-release.sh",
"hotfix-release-latest": "./scripts/hotfix-publish-release.sh latest",
Expand All @@ -34,7 +34,8 @@
"storybook:static": "yarn run storybook:prep && cross-env STORYBOOK_ENV=docs storybook build -c .storybook -o storybook-static --docs",
"storybook:chromatic": "yarn run storybook:prep && cross-env STORYBOOK_ENV=chromatic storybook build -c .storybook -o storybook-chromatic",
"prepare": "husky install",
"sync-fiori-components": "node ./scripts/sync-components.js lib=fiori",
"sync-fiori-components": "npx nx run styles:sync-entry",
"sync-entries": "npx nx run-many --target sync-entry --all",
"pre-commit": "lint-staged && yarn run lint:pre-commit"
},
"repository": {
Expand Down Expand Up @@ -80,6 +81,7 @@
"@storybook/html-vite": "7.6.5",
"@storybook/theming": "7.6.5",
"@testing-library/react": "13.4.0",
"@types/fs-extra": "^11.0.4",
"@types/node": "18.11.9",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.9",
Expand Down Expand Up @@ -107,6 +109,7 @@
"eslint-plugin-react": "7.31.11",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "^0.6.15",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0",
"git-semver-tags": "^4.1.1",
"glob": "^8.0.3",
Expand Down Expand Up @@ -167,4 +170,4 @@
"fast-deep-equal": "^3.1.3",
"jsdom": "^20.0.1"
}
}
}
16 changes: 16 additions & 0 deletions packages/common-css/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@
}
}
},
"sync-entry": {
"executor": "workspace-plugins:sync-components",
"options": {
"entry": "{projectRoot}/src/common-css.scss",
"include": [
"{projectRoot}/src/*.scss",
"packages/styles/src/layout-grid.scss"
],
"exclude": [
"{options.entry}",
"{projectRoot}/src/_common-mixins.scss",
"{projectRoot}/src/_common-variables.scss"
]
},
"outputs": ["{options.entry}"]
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
Expand Down
40 changes: 23 additions & 17 deletions packages/common-css/src/common-css.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
@import "./common-settings";
@import "../../styles/src/layout-grid";
@import "./sap-display.scss";
@import "./sap-typography.scss";
@import "./sap-content-paddings.scss";
@import "./sap-shadow.scss";
@import "./sap-margin.scss";
@import "./sap-flex.scss";
@import "./sap-padding.scss";
@import "./sap-border-radius.scss";
@import "./sap-elevation.scss";
@import "./sap-overflow.scss";
@import "./sap-colors.scss";
@import "./sap-position.scss";
@import "./sap-tool-layout.scss";
@import "./sap-busy-indicator.scss";
@import "./sap-text.scss";
/* Do not modify manually, this file is being generated by workspace-plugins:sync-components executor */
@import './../../styles/src/layout-grid';
@import './common-settings';
@import './sap-border-radius';
@import './sap-busy-indicator';
@import './sap-colors';
@import './sap-container-type';
@import './sap-content-paddings';
@import './sap-display';
@import './sap-elevation';
@import './sap-flex';
@import './sap-heading';
@import './sap-label';
@import './sap-margin';
@import './sap-normalize';
@import './sap-overflow';
@import './sap-padding';
@import './sap-position';
@import './sap-shadow';
@import './sap-sr-only';
@import './sap-text';
@import './sap-tool-layout';
@import './sap-typography';
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<style>
div.demo {
display: flex;
height: 4rem;
width: 8rem;
background: #69ADF8;
}
</style>

<h3>Element</h3>
<div class="demo sap-border-radius-element"></div>
<br>
<h3>Button</h3>
<div class="demo sap-border-radius-button"></div>
<br>
<h3>Field</h3>
<div class="demo sap-border-radius-field"></div>
<br>
<h3>Group</h3>
<div class="demo sap-border-radius-group"></div>
<br>
<h3>Popover</h3>
<div class="demo sap-border-radius-popover"></div>
<br>
<h3>Tile</h3>
<div class="demo sap-border-radius-tile"></div>
<br>
<h3>None</h3>
<div class="demo sap-border-radius-none"></div>
45 changes: 7 additions & 38 deletions packages/common-css/stories/border-radius/border-radius.stories.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import '../../src/sap-border-radius.scss';

import borderRadiusExampleHtml from './border-radius.example.html?raw'
export default {
title: 'Border Radius',
parameters: {
description: `
title: 'Border Radius',
parameters: {
description: `
<table style="width: 100%; border-collapse: collapse; margin-top: 1rem;">
<thead>
<tr>
Expand Down Expand Up @@ -59,40 +59,9 @@ Example: <br>
<code>@include sap-border-radius(1rem 0.5rem)</code><br>
<code>@include sap-border-radius(1rem 0.5rem 0.25rem)</code><br>
<code>@include sap-border-radius(1rem 0.5rem 0.25rem 0.25rem)</code><br>
`,
}
`
}
};

const localStyles = `
<style>
div.demo {
display: flex;
height: 4rem;
width: 8rem;
background: #69ADF8;
}
</style>
`;
export const BorderRadius = () => `${localStyles}
<h3>Element</h3>
<div class="demo sap-border-radius-element"></div>
<br>
<h3>Button</h3>
<div class="demo sap-border-radius-button"></div>
<br>
<h3>Field</h3>
<div class="demo sap-border-radius-field"></div>
<br>
<h3>Group</h3>
<div class="demo sap-border-radius-group"></div>
<br>
<h3>Popover</h3>
<div class="demo sap-border-radius-popover"></div>
<br>
<h3>Tile</h3>
<div class="demo sap-border-radius-tile"></div>
<br>
<h3>None</h3>
<div class="demo sap-border-radius-none"></div>
`;
export const BorderRadius = () => borderRadiusExampleHtml;
BorderRadius.storyName = 'Border Radius Types';
31 changes: 31 additions & 0 deletions packages/common-css/stories/border/border.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div>
1. All

<pre>@include sap-border(0.125rem, solid, #000);</pre>
<br>

2. Top Border
<pre>@include sap-border(0.125rem, solid, #000, top);</pre>
<br>

3. Bottom Border
<pre>@include sap-border(0.125rem, solid, #000, bottom);</pre>
<br>

4. Left Border
<pre>@include sap-border(0.125rem, solid, #000, left);</pre>
<br>

6. Right Border
<pre>@include sap-border(0.125rem, solid, #000, right);</pre>
<br>

7. Top and Bottom Border (y)
<pre>@include sap-border(0.125rem, solid, #000, y);</pre>
<br>

8. Left and Right Border (x)
<pre>@include sap-border(0.125rem, solid, #000, x);</pre>
<br>

</div>
43 changes: 6 additions & 37 deletions packages/common-css/stories/border/border.stories.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,17 @@
import borderExampleHtml from "./border.example.html?raw";
export default {
title: 'Border',
parameters: {
description: `
`,
}
};

export const Border = () => `<div>
1. All
<pre>@include sap-border(0.125rem, solid, #000);</pre>
<br>
2. Top Border
<pre>@include sap-border(0.125rem, solid, #000, top);</pre>
<br>
3. Bottom Border
<pre>@include sap-border(0.125rem, solid, #000, bottom);</pre>
<br>
4. Left Border
<pre>@include sap-border(0.125rem, solid, #000, left);</pre>
<br>
6. Right Border
<pre>@include sap-border(0.125rem, solid, #000, right);</pre>
<br>
7. Top and Bottom Border (y)
<pre>@include sap-border(0.125rem, solid, #000, y);</pre>
<br>
8. Left and Right Border (x)
<pre>@include sap-border(0.125rem, solid, #000, x);</pre>
<br>
</div>`;
export const Border = () => borderExampleHtml;
Border.storyName = 'Mixin sap-border';
Border.parameters = {
docs: {
description: {
story: 'The <code>sap-border</code> helper mixin allows you to specify the width, style, and color of an element\'s border. This is achieved by providing values to the <code>sap-border</code> parameters: <code>$width</code>, <code>$style</code>, <code>$color</code>, and <code>$pos</code>.<br><br> The <code>$pos</code> value can be one of the following: <code>all | top | bottom | left | right | x | y</code>. The default value is <code>all</code>, which will apply borders on all sides. <code>x</code> will set borders on left and right of the element, and <code>y</code> on top and bottom of the element.'
}
docs: {
description: {
story: 'The <code>sap-border</code> helper mixin allows you to specify the width, style, and color of an element\'s border. This is achieved by providing values to the <code>sap-border</code> parameters: <code>$width</code>, <code>$style</code>, <code>$color</code>, and <code>$pos</code>.<br><br> The <code>$pos</code> value can be one of the following: <code>all | top | bottom | left | right | x | y</code>. The default value is <code>all</code>, which will apply borders on all sides. <code>x</code> will set borders on left and right of the element, and <code>y</code> on top and bottom of the element.'
}
}
};

17 changes: 17 additions & 0 deletions packages/common-css/stories/colors/background-color.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<h3>brandColor (--sapBrandColor)</h3>
<div class="demo sap-bg-color-brandColor"></div>
<br>
<h3>errorBackground (--sapErrorBackground)</h3>
<div class="demo sap-bg-color-errorBackground"></div>
<br>
<h3>warningBackground (--sapWarningBackground)</h3>
<div class="demo sap-bg-color-warningBackground"></div>
<br>
<h3>successBackground (--sapSuccessBackground)</h3>
<div class="demo sap-bg-color-successBackground"></div>
<br>
<h3>informationBackground (--sapInformationBackground)</h3>
<div class="demo sap-bg-color-informationBackground"></div>
<br>
<h3>neutralBackground (--sapNeutralBackground)</h3>
<div class="demo sap-bg-color-neutralBackground"></div>
50 changes: 9 additions & 41 deletions packages/common-css/stories/colors/colors.stories.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import '../../src/sap-colors.scss';
import textColorExampleHtml from './text-color.example.html?raw';
import backgroundColorExampleHtml from './background-color.example.html?raw';

export default {
title: 'Colors',
parameters: {
description: '',
description: ''
}
};

const localStyles = `
<style>
div.demo {
Expand All @@ -16,26 +17,10 @@ const localStyles = `
}
</style>
`;
export const TextColor = () => `${localStyles}
<h3>brandColor (--sapBrandColor)</h3>
<div class="sap-color-brandColor">TEXT</div>
<br>
<h3>positiveTextColor (--sapPositiveTextColor)</h3>
<div class="sap-color-positiveTextColor">TEXT</div>
<br>
<h3>criticalTextColor (--sapCriticalTextColor)</h3>
<div class="sap-color-criticalTextColor">TEXT</div>
<br>
<h3>negativeTextColor (--sapNegativeTextColor)</h3>
<div class="sap-color-negativeTextColor">TEXT</div>
<br>
<h3>informativeTextColor (--sapInformativeTextColor)</h3>
<div class="sap-color-informativeTextColor">TEXT</div>
<br>
<h3>neutralTextColor (--sapNeutralTextColor)</h3>
<div class="sap-color-neutralTextColor">TEXT</div>
export const TextColor = () => `
${localStyles}
${textColorExampleHtml}
`;

TextColor.parameters = {
docs: {
description: {
Expand All @@ -46,27 +31,10 @@ TextColor.parameters = {
}
}
};

export const BackgroundColor = () => `${localStyles}
<h3>brandColor (--sapBrandColor)</h3>
<div class="demo sap-bg-color-brandColor"></div>
<br>
<h3>errorBackground (--sapErrorBackground)</h3>
<div class="demo sap-bg-color-errorBackground"></div>
<br>
<h3>warningBackground (--sapWarningBackground)</h3>
<div class="demo sap-bg-color-warningBackground"></div>
<br>
<h3>successBackground (--sapSuccessBackground)</h3>
<div class="demo sap-bg-color-successBackground"></div>
<br>
<h3>informationBackground (--sapInformationBackground)</h3>
<div class="demo sap-bg-color-informationBackground"></div>
<br>
<h3>neutralBackground (--sapNeutralBackground)</h3>
<div class="demo sap-bg-color-neutralBackground"></div>
export const BackgroundColor = () => `
${localStyles}
${backgroundColorExampleHtml}
`;

BackgroundColor.parameters = {
docs: {
description: {
Expand Down
Loading

0 comments on commit 9dc199e

Please sign in to comment.