Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
patzick committed Oct 22, 2024
1 parent cbd27cb commit b4c3a4f
Show file tree
Hide file tree
Showing 30 changed files with 323 additions and 301 deletions.
50 changes: 31 additions & 19 deletions apps/docs/.vitepress/config.hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,40 @@ import { ComposablesBuilder } from "./theme/typer/composables-builder";
* - DevHub - /apps/docs/src/ is mounted to /src/frontends/ in DevHub, root-source is available under /src/frontends/_source/
* - Frontend (standalone) docs
*/
export default (original, {
export default (
original,
{
projectRootDir,
mountPoint,
}: { projectRootDir: string, mountPoint: string }) => {
if (!original.vite) {
original.vite = {};
}
}: { projectRootDir: string; mountPoint: string },
) => {
if (!original.vite) {
original.vite = {};
}

if (!original.vite.plugins) {
original.vite.plugins = [];
}
if (!original.vite.plugins) {
original.vite.plugins = [];
}

// add custom plugins
// they should work in the context of the DevHub and Frontend docs
original.vite.plugins.push(...[
ReadmeBasedReference({ projectRootDir, relativeDir: 'packages' }),
CmsBaseReference({ projectRootDir, relativeDir: 'packages/cms-base/components/public/cms' }),
ReadmeLoader(),
ComposablesBuilder({ projectRootDir, mountPoint, relativeDir: 'packages/composables/src' }),
]);
// add custom plugins
// they should work in the context of the DevHub and Frontend docs
original.vite.plugins.push(
...[
ReadmeBasedReference({ projectRootDir, relativeDir: "packages" }),
CmsBaseReference({
projectRootDir,
relativeDir: "packages/cms-base/components/public/cms",
}),
ReadmeLoader(),
ComposablesBuilder({
projectRootDir,
mountPoint,
relativeDir: "packages/composables/src",
}),
],
);

console.log('Extending', projectRootDir, mountPoint);
console.log("Extending", projectRootDir, mountPoint);

return original;
}
return original;
};
285 changes: 147 additions & 138 deletions apps/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,148 +13,157 @@ interface ThemeConfigExtended extends ThemeConfig {
};
}

export default defineConfigWithTheme<ThemeConfigExtended>(sharedConfig({
extends: baseConfig.default,
title: "Shopware Frontends",
description: "Documentation for Shopware developers",
srcDir: "src",
srcExclude: [
// when symlinked to DevHub
"**/_source/**",
],
ignoreDeadLinks: true, // remove once MR #294 is merged
head: [
[
"link",
{
rel: "icon",
type: "image/svg+xml",
href: "/logo-icon.svg",
},
],
[
"link",
{
rel: "mask-icon",
type: "image/svg+xml",
href: "/logo-icon.svg",
},
],
[
"link",
{
rel: "apple-touch-icon",
sizes: "57x57",
href: "/logo-icon-57x57.png",
},
],
[
"link",
{
rel: "shortcut icon",
href: "/favicon-16x16.ico",
},
],
["meta", { name: "og:type", content: "website" }],
[
"meta",
{ name: "og:site_name", content: "Shopware Frontends - Documentation" },
],
["meta", { name: "og:title", content: "" }],
[
"meta",
{
name: "og:description",
content:
"Shopware Frontends is a framework for building custom, headless storefronts with Shopware 6.",
},
],
[
"meta",
{ name: "og:site_name", content: "Shopware Frontends - Documentation" },
],
[
"meta",
{
name: "og:image",
content:
"https://user-images.githubusercontent.com/5596960/192812626-03033263-dc5d-42e3-bf5c-b5b738cc48bb.png",
},
],
],
export default defineConfigWithTheme<ThemeConfigExtended>(
sharedConfig(
{
extends: baseConfig.default,
title: "Shopware Frontends",
description: "Documentation for Shopware developers",
srcDir: "src",
srcExclude: [
// when symlinked to DevHub
"**/_source/**",
],
ignoreDeadLinks: true, // remove once MR #294 is merged
head: [
[
"link",
{
rel: "icon",
type: "image/svg+xml",
href: "/logo-icon.svg",
},
],
[
"link",
{
rel: "mask-icon",
type: "image/svg+xml",
href: "/logo-icon.svg",
},
],
[
"link",
{
rel: "apple-touch-icon",
sizes: "57x57",
href: "/logo-icon-57x57.png",
},
],
[
"link",
{
rel: "shortcut icon",
href: "/favicon-16x16.ico",
},
],
["meta", { name: "og:type", content: "website" }],
[
"meta",
{
name: "og:site_name",
content: "Shopware Frontends - Documentation",
},
],
["meta", { name: "og:title", content: "" }],
[
"meta",
{
name: "og:description",
content:
"Shopware Frontends is a framework for building custom, headless storefronts with Shopware 6.",
},
],
[
"meta",
{
name: "og:site_name",
content: "Shopware Frontends - Documentation",
},
],
[
"meta",
{
name: "og:image",
content:
"https://user-images.githubusercontent.com/5596960/192812626-03033263-dc5d-42e3-bf5c-b5b738cc48bb.png",
},
],
],

themeConfig: {
nav,
sidebar,
algolia: {
indexName: "",
appId: "",
apiKey: "",
// searchParameters: {
// facetFilters: ["version:v1"],
// },
},
ai: {
endpoint: "",
},
editLink: {
pattern: 'https://github.com/shopware/frontends',
},
},
themeConfig: {
nav,
sidebar,
algolia: {
indexName: "",
appId: "",
apiKey: "",
// searchParameters: {
// facetFilters: ["version:v1"],
// },
},
ai: {
endpoint: "",
},
editLink: {
pattern: "https://github.com/shopware/frontends",
},
},

vite: {
build: {
minify: "terser",
chunkSizeWarningLimit: Infinity,
ssr: false,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("mermaid")) {
return "mermaid";
}
vite: {
build: {
minify: "terser",
chunkSizeWarningLimit: Infinity,
ssr: false,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("mermaid")) {
return "mermaid";
}
},
},
},
},
plugins: [SearchPlugin()],
server: {
watch: {
ignored: (p) => {
// added to next version of baseConfig
return p.includes("_source") || p.includes("node_modules");
},
},
},
resolve: {
alias: {
"@node_modules": resolve(process.cwd(), "node_modules"),
"../composables/edit-link": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/composables/edit-link.ts",
),
"./VPNavBarTitle.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/VPNavBarTitle.vue",
),
"./VPAlgoliaSearchBox.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/VPAlgoliaSearchBox.vue",
),
"../NotFound.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/NotFound.vue",
),
"../SwagRelatedArticles.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/SwagRelatedArticles.vue",
),
},
},
},
},
plugins: [
SearchPlugin(),
],
server: {
watch: {
ignored: (p) => {
// added to next version of baseConfig
return p.includes('_source') || p.includes('node_modules');
}
}
},
resolve: {
alias: {
"@node_modules": resolve(process.cwd(), "node_modules"),
"../composables/edit-link": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/composables/edit-link.ts",
),
"./VPNavBarTitle.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/VPNavBarTitle.vue",
),
"./VPAlgoliaSearchBox.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/VPAlgoliaSearchBox.vue",
),
"../NotFound.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/override/NotFound.vue",
),
"../SwagRelatedArticles.vue": resolve(
__dirname,
"../node_modules/vitepress-shopware-docs/src/shopware/components/SwagRelatedArticles.vue",
),
},
{
projectRootDir: `${process.cwd()}/../..`,
mountPoint: "",
},
},
}, {
projectRootDir: `${process.cwd()}/../..`,
mountPoint: '',
}));
),
);
11 changes: 7 additions & 4 deletions apps/docs/.vitepress/data/composables.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ export { data };
export default defineLoader({
async load(): Promise<Data> {
const cwd = process.cwd();
const projectRootDir = cwd.endsWith('/apps/docs')
const projectRootDir = cwd.endsWith("/apps/docs")
? `${cwd}/../..`
: `${cwd}/src/frontends/_source`;

const composablesList = readdirSync(`${projectRootDir}/packages/composables/src`, {
withFileTypes: true,
})
const composablesList = readdirSync(
`${projectRootDir}/packages/composables/src`,
{
withFileTypes: true,
},
)
.filter(
(element) => element.isDirectory() && element.name.startsWith("use"),
)
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/.vitepress/theme.hub.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ComposablesList from "./theme/components/ComposablesList.vue";

export default ({ app }) => {
app.component('ComposablesList', ComposablesList);
}
app.component("ComposablesList", ComposablesList);
};
Loading

0 comments on commit b4c3a4f

Please sign in to comment.