From a86cc6cea4a9019ef72d299ee85744801a7410ae Mon Sep 17 00:00:00 2001 From: Bojan Rajh Date: Mon, 19 Feb 2024 15:20:14 +0100 Subject: [PATCH 1/4] feat: activate mono repo for component library --- .github/scripts/embed.sh | 14 +++++++------- .vitepress/navigation.ts | 7 +++---- .vitepress/portal.json | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/scripts/embed.sh b/.github/scripts/embed.sh index 42b93f0b..536a3dc4 100755 --- a/.github/scripts/embed.sh +++ b/.github/scripts/embed.sh @@ -98,13 +98,13 @@ fi --dst resources/meteor-icon-kit \ --org ${ORG_METEOR_ICON_KIT:-shopware} -#./docs-cli.cjs clone \ -# --ci \ -# --repository shopware/meteor-component-library \ -# --branch ${BRANCH_METEOR_COMPONENT_LIBRARY:-main} \ -# --src docs \ -# --dst resources/meteor-component-library \ -# --org ${ORG_METEOR_COMPONENT_LIBRARY:-shopware} +./docs-cli.cjs clone \ + --ci \ + --repository shopware/meteor \ + --branch ${BRANCH_METEOR_COMPONENT_LIBRARY:-main} \ + --src packages/component-library/docs \ + --dst resources/meteor-component-library \ + --org ${ORG_METEOR_COMPONENT_LIBRARY:-shopware} ./docs-cli.cjs clone \ --ci \ diff --git a/.vitepress/navigation.ts b/.vitepress/navigation.ts index 99725cd4..3b294cb0 100644 --- a/.vitepress/navigation.ts +++ b/.vitepress/navigation.ts @@ -60,9 +60,8 @@ const navigation = buildSidebarNav('./src/', [ }, { text: "Meteor Component Library", - // link: "/resources/meteor-component-library/", - link: 'https://shopware.github.io/meteor-component-library/', - repo: 'shopware/meteor-component-library', + link: "/resources/meteor-component-library/", + repo: 'shopware/meteor', } ] }, @@ -96,7 +95,7 @@ const navigation = buildSidebarNav('./src/', [ '/docs/v6.4/', '/docs/v6.3/', //'/resources/admin-extension-sdk/', - //'/resources/meteor-component-library/', + '/resources/meteor-component-library/', '/', // always have root sidebar '/resources/meteor-icon-kit/', '/release-notes/', diff --git a/.vitepress/portal.json b/.vitepress/portal.json index 982dd25e..b77ecadc 100644 --- a/.vitepress/portal.json +++ b/.vitepress/portal.json @@ -148,8 +148,8 @@ } }, { - "name": "shopware/meteor-component-library", - "src": "docs", + "name": "shopware/meteor", + "src": "packages/component-library/docs", "dst": "resources/meteor-component-library", "branch": [ "env.BRANCH_METEOR_COMPONENT_LIBRARY", From 751de70dd98cbcdbc220bb7d4baed6a7031ad5a0 Mon Sep 17 00:00:00 2001 From: Bojan Rajh Date: Mon, 19 Feb 2024 15:58:36 +0100 Subject: [PATCH 2/4] update --- .github/scripts/embed.sh | 4 ++-- .vitepress/portal.json | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/scripts/embed.sh b/.github/scripts/embed.sh index 536a3dc4..43f12b61 100755 --- a/.github/scripts/embed.sh +++ b/.github/scripts/embed.sh @@ -9,7 +9,7 @@ BRANCH_DOCS_63=v6.3.0 BRANCH_FRONTENDS=DX-devhub BRANCH_ADMIN_EXTENSION_SDK=DX-223 BRANCH_METEOR_ICON_KIT=main -BRANCH_METEOR_COMPONENT_LIBRARY=DX-231 +BRANCH_METEOR_COMPONENT_LIBRARY=main BRANCH_RELEASE_NOTES=main # custom orgs @@ -20,7 +20,7 @@ ORG_DOCS_63=shopware ORG_FRONTENDS=shopware ORG_ADMIN_EXTENSION_SDK=shopware ORG_METEOR_ICON_KIT=shopware -ORG_METEOR_COMPONENT_LIBRARY=bojanrajh +ORG_METEOR_COMPONENT_LIBRARY=shopware ORG_RELEASE_NOTES=shopware if [[ "$PWD" != *"/developer-portal" ]]; then diff --git a/.vitepress/portal.json b/.vitepress/portal.json index b77ecadc..274bdb0c 100644 --- a/.vitepress/portal.json +++ b/.vitepress/portal.json @@ -153,14 +153,12 @@ "dst": "resources/meteor-component-library", "branch": [ "env.BRANCH_METEOR_COMPONENT_LIBRARY", - "DX-231", "main" ], "org": [ "env.ORG_METEOR_COMPONENT_LIBRARY", - "bojanrajh" - ], - "skip": true + "shopware" + ] }, { "name": "shopware/release-notes", From f0d77ef6ee5ac186aa01513ef8b54ff8b52f9af8 Mon Sep 17 00:00:00 2001 From: Bojan Rajh Date: Wed, 21 Feb 2024 14:26:39 +0100 Subject: [PATCH 3/4] tmp branch --- .github/scripts/embed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/embed.sh b/.github/scripts/embed.sh index 43f12b61..3df31e5e 100755 --- a/.github/scripts/embed.sh +++ b/.github/scripts/embed.sh @@ -9,7 +9,7 @@ BRANCH_DOCS_63=v6.3.0 BRANCH_FRONTENDS=DX-devhub BRANCH_ADMIN_EXTENSION_SDK=DX-223 BRANCH_METEOR_ICON_KIT=main -BRANCH_METEOR_COMPONENT_LIBRARY=main +BRANCH_METEOR_COMPONENT_LIBRARY=dx/devhub-component-library BRANCH_RELEASE_NOTES=main # custom orgs From 5f978c716c0240addbeb9b9355fb605863f607a3 Mon Sep 17 00:00:00 2001 From: Bojan Rajh Date: Wed, 21 Feb 2024 14:30:28 +0100 Subject: [PATCH 4/4] feat: auto-discover components --- .vitepress/theme/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 3e6223fb..f41120c5 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -4,6 +4,23 @@ import SwagRadialBg from "../../src/components/SwagRadialBg.vue"; import SwagCopilotMenu from "../../node_modules/vitepress-shopware-docs/src/shopware/components/copilot/SwagCopilotMenu.vue"; import "./style.scss"; +const autoDiscoverComponents = (app) => { + const requireComponent = require.context('../../src/resources/meteor-component-library/components/', true, /[A-Z]\w+\.(vue)$/); + + requireComponent.keys().forEach(fileName => { + const componentConfig = requireComponent(fileName); + const componentName = fileName + .split('/') + .pop()! + .replace(/\.\w+$/, ''); + + app.component( + componentName, + componentConfig.default || componentConfig + ); + }); +} + export default { ...SWAGTheme({ slots: { @@ -15,5 +32,8 @@ export default { SwagCopilotMenu, ] }, + enhanceApp({ app }) { + autoDiscoverComponents(app); + } }), }