Skip to content

Contributing to jskos-vue

Thanks for your interest in improving jskos-vue and its documentation, your contributions are welcome!

To start contributing please make sure you have a GitHub account. Bug reports and feature requests can best be given as GitHub issues. We use a GitHub repository for version control and CI.

Development

Please work on the dev branch during development or better yet, work in a feature branch and merge into dev when ready.

bash
git clone https://github.com/gbv/jskos-vue.git
cd jskos-vue
git checkout dev
npm install

We are using VitePress for documentation as well as component development as it includes live reloading of Vue components as well.

Development server on port 4311 (http://localhost:4311/):

bash
npm run docs:dev

Documentation and examples

Each of the component as well as each utility method has its own documentation file in docs/components/ and docs/utilities/ respectively. Those files include practical examples which also function as a way to develop a component. In each file, you can have one <script setup> block that initializes the Vue/JS part of the page. Any variables defined in that block will be available to use in the template. You can use components and other Vue template structures right in the Markdown file. You can also define a <style> block if necessary. Note that this only works because VitePress handles these blocks separately from the rest of the Markdown content!

You should include the components via a relative path and you can also include any dependencies like you normally would:

html
<script setup>
import { ItemDetails } from "../../src/components"
import * as jskos from "jskos-tools"
import { reactive } from "vue"
// ...
</script>

For the code block that shows users how to replicate the example, please replace import { ItemDetails } from "../../src/components" with import { ItemDetails } from "jskos-vue". Also, the template part of the example needs to be enclosed in a <template> tag (only in the code block!) so that it is possible to copy-paste the example into a SFC .vue file.

Documentation build:

bash
npm run docs:build # documentation build
BASE=/dist/ npm run docs:build # documentation build with base path

The documentation build will be in docs/.vitepress/dist/.

A full example how to use jskos-vue without bundler is in examples/browser.html (also included in the documentation) and there is an additional example in src/App.vue. Running make app build the second into examples/app. Running npm run examples starts a web server to serve both examples at localhost.

Examples

Additional examples are located in directory examples. To serve them:

bash
npm run examples

Build

Library browser build:

bash
npm run build

The browser build files will be in dist/.

Tests

Please always run tests and aim at high test coverage.

bash
npm test
npm run coverage

Release

When a new release is ready (i.e. the features are finished, merged into dev, and all tests succeed), run the included release script (replace "patch" with "minor" or "major" if necessary):

bash
npm run release:patch

This will:

  • Check that we are on dev
  • Run tests and build to make sure everything works
  • Make sure dev is up-to-date
  • Run npm version patch (or "minor"/"major")
  • Push changes to dev
  • Switch to main
  • Merge changes from dev
  • Push main with tags
  • Switch back to dev

After running this, GitHub Actions will automatically publish the new version to npm. It will also create a new GitHub Release draft. Please edit and publish the release draft manually.