@defra/lis-taxonomy-move 0.8.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,133 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lis-taxonomy-move
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Part of the Livestock Information Service (LIS), which lets livestock keepers, owners, agents and
|
|
4
|
+
delegates record and manage their animals.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
`@defra/lis-taxonomy-move` is a shared npm package that holds the definition of the "move"
|
|
7
|
+
taxonomy: livestock movements and their traceability.
|
|
8
|
+
|
|
9
|
+
Used by:
|
|
10
|
+
|
|
11
|
+
- apps: [lis-apps-cattle-move](https://github.com/DEFRA/lis-apps-cattle-move)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @defra/lis-taxonomy-move
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The package has no peer dependencies.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
LIS splits each microsite into a taxonomy and a species. A taxonomy package says which task the
|
|
24
|
+
microsite does, such as home, register, move or death. A species package says which animal it is
|
|
25
|
+
for. A microsite app combines one of each.
|
|
26
|
+
|
|
27
|
+
The only export is `taxonomy`, the move taxonomy definition:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { taxonomy } from '@defra/lis-taxonomy-move'
|
|
31
|
+
|
|
32
|
+
// {
|
|
33
|
+
// id: 'move',
|
|
34
|
+
// label: 'Move',
|
|
35
|
+
// summary: 'Coordinate movement-related livestock journeys and traceability.'
|
|
36
|
+
// }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[lis-apps-cattle-move](https://github.com/DEFRA/lis-apps-cattle-move) uses `taxonomy.id` together with the species `id` from
|
|
40
|
+
`@defra/lis-species-cattle` to build the microsite path:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import { buildMicrositePath } from '@defra/lis-infra-ui-services'
|
|
44
|
+
import { taxonomy } from '@defra/lis-taxonomy-move'
|
|
45
|
+
import { species } from '@defra/lis-species-cattle'
|
|
46
|
+
|
|
47
|
+
const path = buildMicrositePath(taxonomy.id, species.id)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Prerequisites
|
|
51
|
+
|
|
52
|
+
- Node.js 24 (see `.nvmrc`, use `nvm use`)
|
|
53
|
+
- To check changes against a consuming app: a local clone of [lis-dev](https://github.com/DEFRA/lis-dev) with its one-time setup done
|
|
54
|
+
|
|
55
|
+
## Setup
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
nvm use
|
|
59
|
+
npm install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
There are no tools to install beyond `npm install`. Tests use [Vitest](https://vitest.dev/).
|
|
63
|
+
|
|
64
|
+
## Running in development
|
|
65
|
+
|
|
66
|
+
This is a library, so it has no server of its own. To try a change in a consuming app without
|
|
67
|
+
publishing, link the local copy into the lis-dev stack:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd lis-dev
|
|
71
|
+
.bin/sideload link taxonomy/move # every installed copy now points at this repo
|
|
72
|
+
.bin/sideload up cattle-move # optional: run a consumer locally with hot reload
|
|
73
|
+
.bin/sideload unlink taxonomy/move # when done
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Running tests
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm test # unit tests
|
|
80
|
+
npm run test:coverage # with coverage
|
|
81
|
+
npm run lint # ESLint
|
|
82
|
+
npm run format:check # Prettier
|
|
83
|
+
npm run security-audit # audit-ci
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Before releasing a change, also run the tests of each consuming repo against the linked package.
|
|
87
|
+
|
|
88
|
+
## Pipelines
|
|
89
|
+
|
|
90
|
+
The workflows in `.github/workflows` call the shared composite actions in
|
|
91
|
+
[lis-github-actions](https://github.com/DEFRA/lis-github-actions), pinned by commit SHA. Every run
|
|
92
|
+
calculates the version from git tags (SemVer), then runs **build, test and pack** (security
|
|
93
|
+
audit, format check, lint, tests, `npm pack`) alongside a **Sonar analysis**.
|
|
94
|
+
|
|
95
|
+
- **Pull request to `main`** (`pull-request.yml`): the checks above. The `Pull Request Validation` job is the required check.
|
|
96
|
+
- **Push to a `feature/` or `hotfix/` branch** (`prerelease.yml`): the checks above, then a prerelease tag such as `0.2.0-LREG-123-alpha.1.1` if the Sonar quality gate passes.
|
|
97
|
+
- **Merge to `main`** (`release.yml`): the checks above on the merge commit, then a release tag if the quality gate passes.
|
|
98
|
+
- **Tag push** (`publish.yml`): publishes the package built for that tag to [npm](https://www.npmjs.com/package/@defra/lis-taxonomy-move) with trusted publishing, under the `alpha` dist-tag for prereleases and `latest` for releases.
|
|
99
|
+
|
|
100
|
+
After a merge, wait for the publish job to finish before bumping the package in consuming repos.
|
|
101
|
+
|
|
102
|
+
## Branching policy
|
|
103
|
+
|
|
104
|
+
The repo uses mainline development. Branch from `main` and name the branch:
|
|
105
|
+
|
|
106
|
+
- `feature/LREG-<ticket>-<short-kebab-description>`
|
|
107
|
+
- `hotfix/LREG-<ticket>-<short-kebab-description>`
|
|
108
|
+
|
|
109
|
+
`LREG` must be uppercase, because the GitHub ruleset rejects other branch names. Rebase onto `main`
|
|
110
|
+
rather than merging `main` in.
|
|
111
|
+
|
|
112
|
+
## Contributing to this project
|
|
113
|
+
|
|
114
|
+
- Follow the [Defra software development standards](https://github.com/DEFRA/software-development-standards).
|
|
115
|
+
- Run `npm run git:pre-commit-hook` before committing. It runs the security audit, format check and lint, the same checks CI runs first.
|
|
116
|
+
- Open a pull request against `main` using the PR template. CI must pass and the Sonar quality gate must be green before merge.
|
|
117
|
+
- Feature branches bump the minor version and hotfix branches the patch version. While the package is on 0.x, a breaking change to the public API ships as a minor version, so call it out in the PR so consumers can update.
|
|
118
|
+
|
|
119
|
+
## Licence
|
|
120
|
+
|
|
121
|
+
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
|
|
122
|
+
|
|
123
|
+
<http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3>
|
|
124
|
+
|
|
125
|
+
The following attribution statement MUST be cited in your products and applications when using this information.
|
|
126
|
+
|
|
127
|
+
> Contains public sector information licensed under the Open Government licence v3
|
|
128
|
+
|
|
129
|
+
### About the licence
|
|
130
|
+
|
|
131
|
+
The Open Government Licence (OGL) was developed by the Controller of His Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
|
|
132
|
+
|
|
133
|
+
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.
|