diff --git a/.gitignore b/.gitignore index c0311f28..f8cbc64e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ node_modules .temp .cache dist +pnpm-workspace.yaml # File management @@ -63,4 +64,5 @@ upgrade-util odoo-build-vault # Jupyter Notebooks + .ipynb_checkpoints \ No newline at end of file diff --git a/.vuepress/client.js b/.vuepress/client.js index 957ce565..32b0aea4 100644 --- a/.vuepress/client.js +++ b/.vuepress/client.js @@ -1,15 +1,40 @@ -import { defineClientConfig } from '@vuepress/client' +import { defineClientConfig } from 'vuepress/client' +import { defineSearchConfig } from '@vuepress/plugin-slimsearch/client' +import Layout from './layouts/Layout.vue' -const { domain = undefined } = __PLAUSIBLE_OPTIONS__ +// A snippet is an array of tokens: plain strings, or ['mark', matchedText] tuples. +const flattenSnippet = (snippet) => + snippet.map((word) => (Array.isArray(word) ? word[1] : word)).join('') + +defineSearchConfig({ + combineWith: 'AND', + resultsFilter: (results, query) => { + const phrase = query.trim().toLowerCase() + if (!phrase.includes(' ')) return results // single word — no phrase check needed + + return results + .map((result) => { + const matchedContents = result.contents + .map((item) => { + const matchedSnippets = item.display.filter((snippet) => + flattenSnippet(snippet).toLowerCase().includes(phrase), + ) + return matchedSnippets.length + ? { ...item, display: matchedSnippets } + : null + }) + .filter(Boolean) + + return matchedContents.length + ? { ...result, contents: matchedContents } + : null + }) + .filter(Boolean) + }, +}) export default defineClientConfig({ - enhance({ router }) { - if (!__VUEPRESS_SSR__) { - var script = document.createElement('script') - script.defer = true - script.dataset.domain = domain - script.src = "https://plausible.io/js/script.js" - document.getElementsByTagName('head')[0].appendChild(script) - } - } -}) + layouts: { + Layout, + }, +}) \ No newline at end of file diff --git a/.vuepress/config.js b/.vuepress/config.js index 82d4e4bc..a5115019 100644 --- a/.vuepress/config.js +++ b/.vuepress/config.js @@ -40,8 +40,6 @@ export default defineUserConfig({ { text: 'Snippets', link: '/snippets' }, { text: 'Revisions', link: '/revisions' }, { text: 'Modules', link: '/modules' }, - { text: 'Changelog', link: '/CHANGELOG' }, - { text: 'Mint System', link: 'https://www.mint-system.ch/odoo' }, { text: 'Chat', link: 'https://matrix.to/#/!gmucNdFKeaGvdzcGTP:mint-system.ch?via=mint-system.ch'} ], sidebar: { @@ -92,10 +90,6 @@ export default defineUserConfig({ text: 'Modules', link: '/modules', }, - { - text: 'Changelog', - link: '/CHANGELOG', - } ], }, ], @@ -109,13 +103,14 @@ export default defineUserConfig({ } }), plugins: [ - // slimsearchPlugin({ - // indexContent: true, - // suggestion: false - // }), - searchPlugin({ - maxSuggestions: 10, + slimsearchPlugin({ + indexContent: true, + suggestion: false, + sortStrategy: "total" }), + // searchPlugin({ + // maxSuggestions: 10, + // }), plausiblePlugin({ 'domain': 'odoo.build' }), diff --git a/.vuepress/layouts/Layout.vue b/.vuepress/layouts/Layout.vue new file mode 100644 index 00000000..721efd0b --- /dev/null +++ b/.vuepress/layouts/Layout.vue @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/.vuepress/plausible.js b/.vuepress/plausible.js index 128c268a..e8c62a76 100644 --- a/.vuepress/plausible.js +++ b/.vuepress/plausible.js @@ -5,7 +5,7 @@ const name = '@mint-system/plugin-plausible' const plausiblePlugin = ({ domain }) => { return { name, - clientConfigFile: path.resolve(__dirname, 'client.js'), + clientConfigFile: path.resolve(__dirname, 'plausibleClient.js'), define: { __PLAUSIBLE_OPTIONS__: { domain }, }, diff --git a/.vuepress/plausibleClient.js b/.vuepress/plausibleClient.js new file mode 100644 index 00000000..957ce565 --- /dev/null +++ b/.vuepress/plausibleClient.js @@ -0,0 +1,15 @@ +import { defineClientConfig } from '@vuepress/client' + +const { domain = undefined } = __PLAUSIBLE_OPTIONS__ + +export default defineClientConfig({ + enhance({ router }) { + if (!__VUEPRESS_SSR__) { + var script = document.createElement('script') + script.defer = true + script.dataset.domain = domain + script.src = "https://plausible.io/js/script.js" + document.getElementsByTagName('head')[0].appendChild(script) + } + } +}) diff --git a/.vuepress/styles/index.scss b/.vuepress/styles/index.scss new file mode 100644 index 00000000..e69de29b diff --git a/register-module-repos b/bin/register-module-repos similarity index 100% rename from register-module-repos rename to bin/register-module-repos diff --git a/task b/task index b6db035b..7a1f3afd 100755 --- a/task +++ b/task @@ -2578,7 +2578,7 @@ register-module-repos() { echo "Path: $path" echo "" - ./register-module-repos "$path" "$version" + ./bin/register-module-repos "$path" "$version" } # Upgrade commands