To run the code, you need Node.js 18 or higher, Yarn 1 and mkcert or similar.
Contents:
As a suggestion, run Visual Studio Code with the plugins Vue, ESLint, Prettier and Tailwind CSS IntelliSense.
Recommended VSCode settings (see docs on settings.json):
{
"css.lint.unknownAtRules": "ignore", // Ignore Tailwind's @apply etc
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": true,
"[javascript][typescript][vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json][jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}For SB-Auth to allow authentication requests, the frontend must be served under spraakbanken.gu.se, and HTTPS must be enabled.
- Point the hostname minkdev.spraakbanken.gu.se to localhost. On a UNIX system, you can do this by editing /etc/hosts.
- Create certificate files with mkcert:
and refer to them in .env.local, as per examples in .env.
mkcert "*.spraakbanken.gu.se"
Vite will read variables from .env, see Vite docs. It will also read from .env.local, which is ignored by Git, so you can create it locally to override .env.
The dev server might not properly pick up on changes to these, so better restart yarn dev.
Some of these use commands defined in the scripts section of package.json.
See https://classic.yarnpkg.com/lang/en/docs/cli/run/
(Note that yarn <cmd> will map to yarn run <cmd>, unless cmd is a built-in yarn command.)
Install the dependencies needed to run the code (Vite, Vue, etc): yarn or yarn install
Serve the frontend from a temporary local development server: yarn dev
Now you can open the frontend in a web browser at https://minkdev.spraakbanken.gu.se:5173/mink/
Run tests and watch to rerun on changes: yarn test
Note that test coverage is very low so far. One thing that makes testing difficult is that most API calls require authentication.
Lint, check formatting etc: yarn validate
Some problems can be fixed automatically with: yarn fix
Build the frontend as optimized static HTML+JS+CSS assets: yarn build
The files in dist/ can now be copied to the web server. The rsync command is useful for copying across servers and including hidden files like .htaccess.
See ARCHITECTURE.md for an overview of the structure and STYLE.md for code style.
A commit should contain a single, coherent change.
The commit message must be of this form, based on Conventional commits:
<keyword>: <title>
<body>
<footer>
where
keywordis the most suitable from the list belowtitledescribes the change brieflybodyis optional and can contain any useful explanations or background information to the changefooteris optional and can contain GitHub keywords likeFixes #123
| Keyword | Purpose |
|---|---|
fix |
something broken is being fixed |
feat |
a new feature is added |
docs |
help text is being changed |
style |
the change concerns style (of code, prose, appearance or graphics) |
perf |
the change makes something faster |
test |
testing is improved |
build |
the build process is affected |
refactor |
code is being restructured for DX, sustainability or similar reasons |
chore |
for changes that do not affect code, behavior, docs, appearance or performance |
merge |
for merge commits |
revert |
for revert commits (git revert) |
release |
marks a release, see Releases |
Continual development happens on the main branch. It should always be healthy, so any changes that break the build should be fixed as soon as possible. There is a GitHub action ci.yml for this purpose, meaning someone will be notified if the code is broken.
For a larger change, please create a specific branch, and merge to main when ready. Merging without squash nor rebase is preferred but not mandatory.
Change suggestions in the form of pull requests are very welcome. Fork the repo, create a branch, add your commits, push it to your fork, and then open a pull request against the main branch.
Close collaborators can ask for write access to the repo, and do not need to fork it.
The timing of a release is determined by maintainers, and may be more or less connected to the ongoing work at Språkbanken Text.
- Check and test the code carefully
- Update CHANGELOG.md:
- Update the list under Unreleased to reflect changes made since the last release
- From the list of changes, determine whether this is a major, minor or patch release
- Add a release number heading directly under the Unreleased heading
- Update the compare urls in the bottom of the file
- Update the version number in
package.json - Commit as
release: version <version> - Tag the commit as
v+ version number, e.g.git tag v1.2.3 - Push the branch and the tag:
git push --tags origin main - Build and deploy to https://spraakbanken.gu.se/mink
- Add a newsdesk entry to mink.yaml
Sometimes we need to release a fix quickly, without other changes that may be happening on the main branch. In such cases, it is okay to commit the fix on a new branch directly off the last release commit, and then do the release workflow on that branch. For this reason, the deploy build must happen on the latest relase commit, rather than the latest main branch commit.
Get the latest release commit: git tag --list 'v[0-9]*' --sort=version:refname | tail -n1
After the fix is deployed, merge the hotfix branch back into main.