Skip to content

Commit

Permalink
feat: use brand-theme optional in core and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleroux committed Sep 14, 2022
1 parent a048162 commit 8978d3d
Show file tree
Hide file tree
Showing 30 changed files with 155 additions and 577 deletions.
3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
"@popperjs/core": "^2.11.0",
"bootstrap": "~5.2.0"
},
"optionalDependencies": {
"@siemens/ix-brand-theme": "~1.0.0-beta.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
Expand Down
36 changes: 11 additions & 25 deletions packages/core/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import { devices } from '@playwright/test';
*/
// require('dotenv').config();

const THEMES = [
'theme-brand-dark',
'theme-brand-light',
'theme-classic-light',
'theme-classic-dark',
];
let THEMES = ['theme-classic-light', 'theme-classic-dark'];

try {
const moduleName = '@siemens/ix-brand-theme';
require.resolve(moduleName);
THEMES = ['theme-brand-dark', 'theme-brand-light', ...THEMES];
} catch (e) {
console.warn(
'optionalDependency @siemens/ix-brand-theme not found for visual-regression'
);
}

function buildProjectsWithThemes() {
return THEMES.flatMap((theme) => {
Expand All @@ -35,25 +40,6 @@ function buildProjectsWithThemes() {
theme,
},
},
// Currently deactivated to speedup regression test
// {
// name: `firefox - ${theme}`,
// use: {
// ...devices['Desktop Firefox'],
// },
// metadata: {
// theme,
// },
// },
// {
// name: `webkit - ${theme}`,
// use: {
// ...devices['Desktop Safari'],
// },
// metadata: {
// theme,
// },
// },
];
});
}
Expand Down
33 changes: 22 additions & 11 deletions packages/core/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ import { reactOutputTarget } from '@stencil/react-output-target';
import { sass } from '@stencil/sass';
import autoprefixer from 'autoprefixer';
import fs from 'fs';

const copyAssets = [
{
src: './../../../node_modules/@siemens/ix-icons/dist',
dest: 'build/ix-icons',
},
];

try {
const moduleName = '@siemens/ix-brand-theme';
require.resolve(moduleName);
copyAssets.push({
src: './../../../node_modules/@siemens/ix-brand-theme/dist/ix-brand-theme',
dest: 'build/ix-brand-theme',
});
} catch (e) {
console.warn(
'optionalDependency @siemens/ix-brand-theme not found for visual-regression'
);
}

export const config: Config = {
bundles: [
{
Expand Down Expand Up @@ -179,17 +200,7 @@ export const config: Config = {
{
type: 'www',
serviceWorker: null, // disable service workers
copy: [
{
src: './../../../node_modules/@siemens/ix-icons/dist',
dest: 'build/ix-icons',
},
{
// Temporary workaround until the brand theme is part of ix core
src: './../../../node_modules/@siemens/ix-brand-theme/dist/ix-brand-theme',
dest: 'build/ix-brand-theme',
},
],
copy: copyAssets,
},
],
};
4 changes: 0 additions & 4 deletions packages/documentation/docs/components/_category_.json

This file was deleted.

12 changes: 0 additions & 12 deletions packages/documentation/docs/components/animated-tabs.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/documentation/docs/components/input-validation.md

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions packages/documentation/docs/components/stepper.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/documentation/docs/icon-library/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
sidebar_position: 3
---

import LivePreview from '@site/src/components/LivePreview';
import Icons from '@site/src/components/Icons';

# Icons
Expand Down
17 changes: 0 additions & 17 deletions packages/documentation/docs/theming/border.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/documentation/docs/theming/colors.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import LivePreview from '@site/src/components/LivePreview';
import Color from '@site/src/components/Color';

# Colors
Expand Down
2 changes: 0 additions & 2 deletions packages/documentation/docs/theming/theming-and-styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
sidebar_position: 1
---

import HTMLPreview from '@site/src/components/HTMLPreview';
import {Card, CardList} from '@site/src/components/Card';

# Theming and Styling

<CardList>
<Card label="Theme overview" isPrimary={true} link="theme"/>
<Card label="Animation" link="animation"/>
<Card label="Border" link="border"/>
<Card label="Colors" link="colors" />
<Card label="Fonts" link="fonts" />
</CardList>
36 changes: 28 additions & 8 deletions packages/documentation/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

let withBrandTheme = false;

const libCss = [
require.resolve('@siemens/ix/dist/siemens-ix/siemens-ix.css'),
require.resolve('@siemens/ix-icons/dist/css/ix-icons.css'),
];

try {
const path = require.resolve(
'@siemens/ix-brand-theme/dist/ix-brand-theme/ix-brand-theme.css'
);
console.log('Found optionalDependency @siemens/ix-brand-theme.');
libCss.push(path);
withBrandTheme = true;
} catch (e) {
console.warn('optionalDependency @siemens/ix-brand-theme not found!');
}

const customCss = [
...libCss,
require.resolve('./src/css/custom.css'),
require.resolve('./src/css/search.css'),
];

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Siemens iX',
Expand All @@ -34,18 +58,14 @@ const config = {
'https://www.github.com/siemens/ix/edit/main/packages/documentation/',
},
theme: {
customCss: [
require.resolve('@siemens/ix/dist/siemens-ix/siemens-ix.css'),
// Insert additional theme (DO NOT REMOVE THIS LINE)
require.resolve('@siemens/ix-icons/dist/css/ix-icons.css'),
require.resolve('./src/css/custom.css'),
require.resolve('./src/css/search.css'),
],
customCss,
},
}),
],
],

customFields: {
withBrandTheme,
},
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
Expand Down
4 changes: 3 additions & 1 deletion packages/documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@mdx-js/react": "^1.6.22",
"@siemens/ix-icons": "1.0.0-beta.1",
"@siemens/ix": "~1.0.0-beta.0",
"@siemens/ix-brand-theme": "~1.0.0-beta.0",
"@siemens/ix-react": "~1.0.0-beta.0",
"@stencil/postcss": "^2.1.0",
"clsx": "^1.2.1",
Expand All @@ -43,6 +42,9 @@
"rimraf": "^3.0.2",
"typescript": "^4.7.4"
},
"optionalDependencies": {
"@siemens/ix-brand-theme": "~1.0.0-beta.0"
},
"browserslist": {
"production": [
">0.5%",
Expand Down
8 changes: 5 additions & 3 deletions packages/documentation/scripts/copy-webcomponents.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ function filter(fileName) {
fsExtra.copy(ix_path, ix_dest_path, { filter }),
fsExtra.copy(ix_aggrid_path, ix_aggrid_dest_path, { filter }),
fsExtra.copy(icon_path, icon_dest_path),
fsExtra.copy(ix_brand_theme_path, ix_brand_theme_dest_path, {
filter: (path) => !path.includes('ix-brand-theme/node_modules'),
}),
fsExtra.pathExistsSync(ix_brand_theme_path)
? fsExtra.copy(ix_brand_theme_path, ix_brand_theme_dest_path, {
filter: (path) => !path.includes('ix-brand-theme/node_modules'),
})
: Promise.resolve(),
]);
console.log('Copy finished!');
})();
12 changes: 1 addition & 11 deletions packages/documentation/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,7 @@ const sidebars = {
},
{
type: 'category',
label: 'Controls (Core UI)',
items: [
{
type: 'autogenerated',
dirName: 'components',
},
],
},
{
type: 'category',
label: 'Controls (iX development)',
label: 'Controls',
items: [
{
type: 'category',
Expand Down
16 changes: 0 additions & 16 deletions packages/documentation/src/components/ComponentApi.module.css

This file was deleted.

Loading

0 comments on commit 8978d3d

Please sign in to comment.