Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
vuepress-plugin-component-catalog
Advanced tools
This plugin is for generating a component catalog of Vue.js. The catalog page is generated by adding it to the VuePress plugin.
This plugin is for VuePress Next(v1.x.x).
Available in 2 steps.
$ yarn add -D vuepress@next vuepress-plugin-component-catalog
.vuepress/config.js
module.exports = {
// ...
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Components', link: '/components/' },
]
},
plugins: [
['vuepress-plugin-component-catalog'],
],
};
Scan the project and complete the setup automatically.
Depending on the project it may not work.
This plugin uses custom blocks of SFC.
<docs>
# Base Button
Can be written with Markdown.
VuePress markdown extensions are also available.
[[toc]]
When you write a component, it will be mounted and displayed.
<base-button>Smaple Button</base-button>
</docs>
<template>
<button type="button"><slot /></button>
</template>
<script>
export default {
// ...
}
</script>
module.exports = {
plugins: [
[
'vuepress-plugin-component-catalog',
{
// All options
rootDir: '<your project root dir>',
include: ['**/components/**'] // Specify the target to create a catalog
exclude: ['**/views/**', '**/App.vue'] // Specify a target that does not create a catalog
distDirPrefix: 'components',
alias: { // import path alias
'@': \<your project alias\>,
},
vueCli: { // vue cli option
configPath: path.join(PROJECT_DIR, 'vue.config.js'),
},
nuxt: { // nuxt option
configPath: path.join(PROJECT_DIR, 'nuxt.config.js'),
},
},
],
],
};
rootDir
(option)string
process.cwd()
include
(option)Specify the target to create a catalog. Can use glob.
string
or Array<string>
e.g.
{
include: ['**/components/**'],
}
exclude
(option)Specify a target that does not create a catalog. Can use globs.
string
or Array<string>
distDirPrefix
(option)string
components
It becomes the URL path.
http://localhost:8080/components/your-component
vueCli.configPath
(option)string
process.cwd() + vue.config.js
Please try to set it when the alias such as @
can not be resolved automatically.
nuxt.configPath
(option)string
process.cwd() + nuxt.config.js
Please try to set it when the alias such as @
(~
) can not be resolved automatically.
It is not possible to process docs
custom blocks, and errors may occur in the build of your application.
Please load and use the prepared webpack loader. Here is a sample.
vue.config.js
module.exports = {
// ...
chainWebpack: config => {
config.module
.rule('docs')
.oneOf('docs')
.resourceQuery(/blockType=docs/)
.use('through-loader')
.loader('vuepress-plugin-component-catalog/dist/through-loader')
.end();
},
};
nuxt.config.js
module.exports = {
// ...
build: {
extend(config) {
config.module.rules.push({
resourceQuery: /blockType=docs/,
loader: 'vuepress-plugin-component-catalog/dist/through-loader',
});
},
},
};
Please use .vuepress/enhancedApp.js
.
In the future, if you are using Nuxt.js, it will be loaded automatically.
Please use VuePress Build Pipeline.
Refer to the project in the example directory.
Sorry, I haven't tried it yet. I'm planning to make samples.
Probably I will use .vuepress/enhancedApp.js
.
See example directory.
There is such an idea.
FAQs
Generating a component catalog of Vue.js.
We found that vuepress-plugin-component-catalog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.