Contribution Guide
We always welcome everyone to contribute! Here is a guide for you.
Clone and Install Project
You should have Node.js and Git installed, and enabled corepack with corepack enable.
Use Git to clone the project to the local, and install dependencies:
git clone git@github.com:vuepress-theme-hope/vuepress-theme-hope.git
pnpm iProject File Structure
The project is a monorepo, managed by pnpm.
docs: place the documentation of each plugin and theme, each subdirectory is a projectdemo: theme demo projectpackages: place the code of each plugin and theme, each subdirectory is a project
.
├── .github → GitHub config
├── .husky → husky config
│
├── demo → Demo projects
│
├── docs → document directory
│ ├── components → components plugin document
│ ├── lightgallery → lightgallery plugin document
│ ├── md-enhance → md-enhance plugin document
│ └── theme → theme document
│
├── packages → project source code
│ ├── components → components plugin
│ ├── create → create-vuepress-theme-hope helper
│ ├── lightgallery → lightgallery plugin
│ ├── md-enhance → md-enhance plugin
│ ├── shared → shared file
│ └── theme → vuepress-theme-hope theme
│
├── scripts → command scripts
│
├── ... → some config files
│
├── LICENSE → License
├── package.json → root package.json
├── README.md → project intro
├── SECURITY.md → Security Policy
│
└── tsconfig.* → TypeScript config fileDocument Modification
You can find the corresponding project in the docs directory, so you can modify the corresponding Markdown directly.
After ensuring that the pnpm lint and pnpm lint:md commands emit no errors, you can commit to GitHub to open a PR.
Preview Docs
Since the docs are using local themes and plugins, you need to build the local project through pnpm build first.
To start previewing, cd to the right project under docs directory, then run pnpm docs:vite-dev (using Vite) or pnpm docs:webpack-dev (using Webpack).
Project Modification
The structure of each project is as follows:
.
├── lib → compiled output file
│ │
│ ├── client → client-side compiled code
│ │
│ └── node → Node.js side compiled code
│
└── src → source file
│
├── client → client-side source code
│
├── node → Node.js side source code
│
└── shared → Shared files between node and clientVuePress is running both in client side and node side. Node side has node module like fs, while client side is running in browser which has document windows navigator etc. globals, you should be aware of where a piece of code is running.
clientdirectory stores code running in browsernodedirectory stores code running in Node.jsshareddirectory stores files that are used in both client and node, so code shall not reference any browser globals or node module.
For better performance, all plugins are packed and minified using rollup when they are published.
Project Development
Build project:
pnpm build- Use rollup to bundle source files and minify them, and output results to
libfolder - Use
rollup-plugin-copyto copy other files tolibfolder
- Use rollup to bundle source files and minify them, and output results to
Develop project:
pnpm dev- Use
tscto compile ts file tolibfolder - Use
cpxto copy other files tolibfolder
- Use
Format project:
pnpm lintIt will format the project using prettier, eslint and stylelint.
If you modify Markdown, you also need to run the
pnpm lint:mdcommand.
Warning
Please do not mix build and dev commands as they compile in completely different ways.
You may need to execute the pnpm clean command to clear previous command result.
Commit
The project uses husky to add Git Hooks for verification:
In
precommitstage: we usenano-stagedto check the changed code with the corresponding LinterThis means that you need to ensure that your code is formatted by the project requirements and can pass Linter tests.
In
commit-msgstage: we usecommitlintto verify the commit comment.This means that you need to ensure that your commit comments comply with Semantic
Tips
If you cannot pass the above Git Hooks, you will not be able to complete git commit.
If you have already contributed something, but cannot make a commit and don't know how to fix it, you can add the --no-verify flag when committing to bypass Git Hooks.
Changelog
05fbb-on68504-on22787-onef81f-onc0af3-onb51ab-on4a38e-ond5824-on05c41-on6449c-on636cc-on0fe94-on2a306-on52428-onee68e-onf2189-on3ddf9-on8174c-on06c47-on80e15-onf7e60-on437a1-onae2d2-on8e16a-onbcdf4-on37eb7-on6e564-onb62f8-on2243a-onca46a-on6051e-on49169-ond8a69-onf4127-on1a6ac-onb1302-onad3a9-on5cc7a-onad023-on1bd08-one07b5-on354ec-on24cc4-onfd395-onc0323-on0b96a-on60053-on96dc8-on04b8a-on3c199-on