Skip to content

Commit

Permalink
chore: update from main
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 18, 2024
2 parents 8b715b5 + 95ed7ce commit f9f494a
Show file tree
Hide file tree
Showing 196 changed files with 5,709 additions and 4,107 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ updates:
- dependency-name: "sass"
# We currently need to ignore eslint@v9
- dependency-name: "eslint"
update-types: ["version-update:semver-minor"]
update-types: ["version-update:semver-major"]
pull-request-branch-name:
separator: "-"
# https://github.com/dependabot/dependabot-core/issues/5226#issuecomment-1179434437
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/build-gh-page.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ $PRE_RELEASE == "true" || $RELEASE == "true" ]]; then
rm -rf ./public/version/latest
fi
mkdir ./public/version/latest
cp ./out ./public/version/latest
cp -RT ./out ./public/version/latest
echo " Copied dir out to ./public/version/latest"
fi
mv ./out ./public/version/"$NAME"
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/cleanup-gh-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const removeOldFromPath = (isTag, data) => {
) {
const dirsToDelete = FS.readdirSync(path)
.filter((file) => !data.find((branch) => branch.name === file))
.filter((file) => file !== 'main');
// Let's not clean up specific folders
.filter((file) => !['main', 'latest'].includes(file));
if (dirsToDelete?.length > 0) {
console.log(
TAG,
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/01-build-patternhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ on:
required: false
default: "false"
type: string
outputs:
path:
description: "Base path for patternhub"
value: ${{ jobs.build-patternhub.outputs.path }}

jobs:
build-patternhub:
name: Build Patternhub
runs-on: ubuntu-latest
outputs:
path: ${{ steps.build.outputs.path }}
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -78,11 +84,13 @@ jobs:
return `/${context?.payload?.repository?.name}/${path}/${process.env.NAME}`
- name: 🔨 Build Patternhub
id: build
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.base-path.outputs.result }}
run: |
npx --no tsx scripts/md-resolve-svg.ts
npm run build --workspace=patternhub
echo "path=${NEXT_PUBLIC_BASE_PATH}" >> $GITHUB_OUTPUT
- name: ⏫ Upload Patternhub
uses: actions/upload-artifact@v4
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/02-e2e-regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
type:
required: true
type: string
path:
required: false
type: string

permissions:
actions: write
Expand Down Expand Up @@ -67,43 +70,46 @@ jobs:
env:
HOME: /root
TYPE: ${{ inputs.type }}
NEXT_PUBLIC_BASE_PATH: ${{ inputs.path }}
run: |
if [[ $TYPE == "components" ]]; then
npm run regenerate:screenshots --workspace=@db-ui/react-components
elif [[ $TYPE == "foundations" ]]; then
npm run regenerate:screenshots --workspace=@db-ui/foundations
elif [[ $TYPE == "patternhub" ]]; then
mkdir -p ./build-showcases${{ inputs.path }}
cp -RT ./build-showcases/${{ inputs.type }} ./build-showcases${{ inputs.path }}
npm run regenerate:screenshots --workspace=patternhub
else
npm run regenerate:screenshots --workspace=react-showcase
fi
- name: 🆙 Upload components
if: inputs.type == 'components'
if: always() && inputs.type == 'components'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/*/component
retention-days: 30

- name: 🆙 Upload foundations
if: inputs.type == 'foundations'
if: always() && inputs.type == 'foundations'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/foundations
retention-days: 30

- name: 🆙 Upload patternhub
if: inputs.type == 'patternhub'
if: always() && inputs.type == 'patternhub'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
path: ./__snapshots__/*/patternhub
retention-days: 30

- name: 🆙 Upload showcase
if: inputs.type == 'showcases'
if: always() && inputs.type == 'showcases'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ inputs.type }}
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/02-e2e-showcases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
showcase:
required: true
type: string
path:
required: false
type: string

permissions:
actions: write
Expand Down Expand Up @@ -59,10 +62,20 @@ jobs:
name: db-ui-${{ inputs.showcase }}
path: build-showcases/${{ inputs.showcase }}

- name: 🧴 Copy patternhub testing app
if: inputs.path
shell: bash
run: |
mkdir -p ./build-showcases${{ inputs.path }}
cp -RT ./build-showcases/${{ inputs.showcase }} ./build-showcases${{ inputs.path }}
- name: 👩‍🔬 Test showcase with Playwright 🎭
shell: bash
env:
HOME: /root
NEXT_PUBLIC_BASE_PATH: ${{ inputs.path }}
run: |
ls ./build-showcases${{ inputs.path }}
npm run test:e2e --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- name: 🔣 Print GitHub Report
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
needs: [build-showcase-patternhub, get-playwright-version]
with:
version: ${{ needs.get-playwright-version.outputs.version }}
path: ${{ needs.build-showcase-patternhub.outputs.path }}
showcase: patternhub

regenerate-snapshots-components:
Expand All @@ -159,8 +160,14 @@ jobs:
uses: ./.github/workflows/02-e2e-regenerate.yml
with:
version: ${{ needs.get-playwright-version.outputs.version }}
path: ${{ needs.build-showcase-patternhub.outputs.path }}
type: patternhub
needs: [test-showcase-patternhub, get-playwright-version]
needs:
[
build-showcase-patternhub,
test-showcase-patternhub,
get-playwright-version
]

test-screen-reader:
uses: ./.github/workflows/02-e2e-screen-reader.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ jobs:
uses: ./.github/workflows/02-e2e-showcases.yml
needs: [build-showcase-patternhub, get-playwright-version]
with:
path: ${{ needs.build-showcase-patternhub.outputs.path }}
version: ${{ needs.get-playwright-version.outputs.version }}
showcase: patternhub

Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ designers, and content authors build, maintain, and scale best of class digital
<figcaption><a href="https://bradfrost.com/blog/post/bdconf-stephen-hay-presents-responsive-design-workflow/" target="_blank" rel="noopener noreferrer">Stephen Hay</a>. <a href="https://vimeo.com/67476280" title="Brad Frosts at beyond tellerrand conference regarding Atomic Design" target="_blank" rel="noopener noreferrer">Cited in a talk by Brad Frost at beyond tellerrand conference.</a></figcaption>
</figure>

> [!WARNING]
> We currently don't fully support Samsung Internet browser until it adds the following functionality with its new version 27, which is expected to get released later this year:
>
> - [CSS: `light-dark()`](https://caniuse.com/mdn-css_types_color_light-dark)
## Packages

| Package | Content | Version |
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"fs-extra": "^11.1.0",
"http-server": "14.1.1",
"npm-run-all": "4.1.5",
"tslib": "^2.8.0",
"tslib": "^2.8.1",
"typescript": "^5.3.3"
}
}
15 changes: 0 additions & 15 deletions output/stencil/custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { generateVsCodeCustomElementData } from 'custom-element-vs-code-integrat
import { getTsProgram } from 'cem-plugin-expanded-types';
import { resolveTypesPlugin } from './scripts/resolveTypes.js';
import { generateJetBrainsWebTypes } from 'custom-element-jet-brains-integration';
import { writeFileSync } from 'node:fs';
import { customElementsManifestToMarkdown } from '@custom-elements-manifest/to-markdown';

const outdir = './dist';

Expand Down Expand Up @@ -44,19 +42,6 @@ export default {
},
plugins: [
resolveTypesPlugin(({ customElementsManifest }) => {
writeFileSync(
`${outdir}/custom-elements.md`,
customElementsManifestToMarkdown(customElementsManifest, {
private: 'hidden',
omitDeclarations: [
'mixins',
'variables',
'functions',
'exports'
],
omitSections: ['attributes', 'methods']
})
);
generateVsCodeCustomElementData(
customElementsManifest,
vsCodeOptions
Expand Down
3 changes: 1 addition & 2 deletions output/stencil/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
},
"devDependencies": {
"@custom-elements-manifest/analyzer": "^0.10.3",
"@custom-elements-manifest/to-markdown": "^0.1.0",
"@stencil/core": "4.22.2",
"cem-plugin-expanded-types": "^1.3.2",
"custom-element-jet-brains-integration": "^1.6.2",
"custom-element-vs-code-integration": "^1.4.1",
"workbox-build": "4.3.1"
"workbox-build": "7.3.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
Expand Down
30 changes: 26 additions & 4 deletions output/stencil/scripts/analyzePhase.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
const getPrimitive = (ts, kind) =>
ts.SyntaxKind[kind.toString()].replace('Keyword', '').toLowerCase();

const getElementsRecursive = (node) => {
if (node.expression) {
return getElementsRecursive(node.expression);
}

return node.elements;
};

/**
* Get string arrays like: export const LinkCurrentList = (['time', 'true', 'false', 'date', 'page', 'step', 'location'] as const)
* @param initializer {object}
*/
const getStringArrayConst = (initializer) => {
const texts = initializer.expression?.expression?.elements?.map(
(elemNode) => `"${elemNode.text}"`
);
const elements = getElementsRecursive(initializer);
const texts = elements?.map((elemNode) => `"${elemNode.text}"`);
if (texts) {
return {
values: texts,
Expand All @@ -19,6 +26,16 @@ const getStringArrayConst = (initializer) => {
return undefined;
};

const getArrayType = (ts, type) => {
let array;
if (type.elementType.typeName) {
array = type.elementType.typeName.escapedText;
} else {
array = getPrimitive(ts, type.elementType.kind);
}
return `${array}[]`;
};

/**
* Get literals or type unions like: export const Test = "a" | "b";
* @param ts {object} Typescript ast
Expand All @@ -33,6 +50,9 @@ const getUnions = (ts, types) => {
return innerType.typeName?.escapedText;
} else if (innerType.literal) {
return `'${innerType.literal?.text}'`;
} else if (innerType.elementType) {
// Arrays
return getArrayType(ts, innerType);
} else if (innerType.kind) {
return getPrimitive(ts, innerType.kind);
}
Expand Down Expand Up @@ -76,6 +96,8 @@ const getMembers = (ts, members) => ({
type = memberType?.typeName?.escapedText;
} else if (memberType.types) {
type = getUnions(ts, memberType.types);
} else if (memberType.elementType) {
type = getArrayType(ts, memberType);
} else {
type = getPrimitive(ts, memberType.kind);
}
Expand All @@ -89,7 +111,7 @@ const getMembers = (ts, members) => ({
type: 'props'
});

export const analyzePhase = ({ ts, node, context }) => {
export const analyzePhase = ({ ts, node, context }) => {
if (!context.data) {
context.data = {};
}
Expand Down
36 changes: 26 additions & 10 deletions output/stencil/scripts/packageLinkPhase.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ const getFilteredContextData = (data) => {
if (currentType !== 'literal') {
foundType = data[currentType];
}
const resolvedType = `${foundType.values.join(unionSeperator)}`;
let resolvedType;
try {
resolvedType = `${foundType.values.join(unionSeperator)}`;
} catch (e) {
console.error(key, obj);
throw e;
}

resolvedData[key] = {
...obj,
Expand All @@ -46,11 +52,11 @@ const getFilteredContextData = (data) => {
/**
* Resolves props by data
* @param resolvedData {object}
* @param value {object}
* @param value {object|string}
* @return {{resolvedType, name, type}}
*/
const resolveProp = (resolvedData, value) => {
const { type } = value;
let type = value.type ?? value;
if (type !== type?.toLowerCase()) {
// This isn't a primitive like string, boolean, etc.
const foundData = resolvedData[type];
Expand Down Expand Up @@ -80,14 +86,14 @@ const resolveAllProps = (resolvedData, resolvedProps) => {
const { name, type } = value;
if (type instanceof Object) {
// In this case we have a literal or union
const resolvedType = type.values
.map((val) => {
return resolveProp(resolvedData, val).resolvedType;
})
.join(unionSeperator);
return {
...value,
resolvedType: type.values
.map((val) => {
return resolveProp(resolvedData, '', val)
.resolvedType;
})
.join(unionSeperator)
resolvedType
};
} else {
return resolveProp(resolvedData, value);
Expand Down Expand Up @@ -223,7 +229,17 @@ export const packageLinkPhase = (
declaration.attributes
);

return { ...declaration, members, attributes };
const slots = declaration.slots.map((slot) => ({
name: slot.name,
description:
resolvedUnions[
`${declaration.name}Props`
]?.resolvedValues.find(
(value) => value.name === slot.name
)?.comment || slot.description
}));

return { ...declaration, members, attributes, slots };
});
const path = module.path.split('/').at(-1);

Expand Down
Loading

0 comments on commit f9f494a

Please sign in to comment.