@hedia/types 3.12.5-alpha.352 → 3.12.6-alpha.353

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.
Files changed (2) hide show
  1. package/README.md +106 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,108 @@
1
- # **Hedia types**
1
+ # @hedia/types
2
2
 
3
- ### **Auto-publishing to npm as an alpha-version package**
3
+ Shared TypeScript enums, interfaces, and constants used across Hedia's software. Published to npm as [`@hedia/types`](https://www.npmjs.com/package/@hedia/types).
4
4
 
5
- In order to easily test our npm packages, auto-publishing of an alpha version to npm has been implemented.
6
- This will allow testers to easily install and test npm packages as they’ll be automatically published to npm at the moment of creating a Pull Request on GitHub.
5
+ This package contains **types only**. It has no runtime dependencies and ships as CommonJS with TypeScript declarations.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install @hedia/types
11
+ ```
12
+
13
+ Pin the exact version in consuming projects, as this repo does with its own dependencies.
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { BloodGlucoseUnit, DiabetesType, IUserSettings } from "@hedia/types";
19
+
20
+ const settings: IUserSettings = {
21
+ // ...
22
+ };
23
+
24
+ if (unit === BloodGlucoseUnit.MMOL_L) {
25
+ // ...
26
+ }
27
+ ```
28
+
29
+ Everything is exported from the package root via [`src/index.ts`](src/index.ts).
30
+
31
+ ## What's included
32
+
33
+ | Module | Contents |
34
+ | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
35
+ | [`activity`](src/activity/activity.ts) | Activity entries, intensity and reduction interval enums, activity settings |
36
+ | [`boluscalculator`](src/boluscalculator/boluscalculator.ts) | Bolus calculator constants, error enums, recommendation params and result |
37
+ | [`logbook`](src/logbook/logbook.ts) | Logbook entries, mood enum, client/backend sync objects |
38
+ | [`userdetails`](src/userdetails/userdetails.ts) | User details |
39
+ | [`usersettings`](src/usersettings/usersettings.ts) | User settings, notifications, BGL targets, insulin, diabetes type, and related enums |
40
+ | [`enums`](src/enums.ts) | Cross-cutting enums: glucose and ketone units, insulin units, languages, HTTP status codes and methods |
41
+
42
+ Types prefixed with `Legacy` describe older data shapes still present in stored data and should not be used for new code.
43
+
44
+ ## Development
45
+
46
+ Requires Node `>=22.14.0` (see `engines` in `package.json`).
47
+
48
+ ```sh
49
+ npm ci
50
+ npm run validate
51
+ ```
52
+
53
+ `validate` runs everything CI runs:
54
+
55
+ | Script | What it does |
56
+ | ----------------------------------- | --------------------------------------------------------------- |
57
+ | `npm run tsc` | Type-check without emitting |
58
+ | `npm run eslint` / `eslint:fix` | Lint with `@hedia/eslint-config` |
59
+ | `npm run prettier` / `prettier:fix` | Check or fix formatting with `@hedia/prettier-config` |
60
+ | `npm run pkg-json-lint` | Lint `package.json` (exact versions, alphabetical dependencies) |
61
+ | `npm audit --audit-level=critical` | Fail on critical vulnerabilities |
62
+
63
+ ### Conventions
64
+
65
+ - Prefer `interface` over `type` for object shapes (enforced by ESLint).
66
+ - Enum members must be literal values (enforced by ESLint).
67
+ - Dependencies are pinned to exact versions, no `^` or `~`, and kept in alphabetical order (enforced by npm-package-json-lint).
68
+ - Source lives in `src/`. The build output in `lib/` is generated and git-ignored.
69
+
70
+ ### Build
71
+
72
+ The build runs automatically on `npm pack` / `npm publish` via the `prepack` hook. To build manually:
73
+
74
+ ```sh
75
+ npx bob build
76
+ ```
77
+
78
+ [react-native-builder-bob](https://github.com/callstack/react-native-builder-bob) emits `lib/commonjs` (JavaScript) and `lib/typescript` (declarations). Both `lib/` and `src/` are included in the published package so source maps resolve.
79
+
80
+ ## Releasing
81
+
82
+ Publishing is fully automated by [`.github/workflows/ci.yaml`](.github/workflows/ci.yaml). **Do not bump the version manually.**
83
+
84
+ ### Pull requests
85
+
86
+ 1. Branch from `master` and open a PR. The title must reference a Jira ticket, e.g. `HDAM-1234 Add ketone thresholds`. An optional `[x.y.z] - ` or `[Anytime] - ` prefix is allowed. Draft PRs skip this check.
87
+ 2. Add a `major` or `minor` label to control the version bump. With no label the bump is `patch`.
88
+ 3. On every push CI runs `validate`, then:
89
+ - commits the bumped version to the PR branch as `chore: bump version to x.y.z [skip ci]`
90
+ - publishes `x.y.z-alpha.<run>` to npm under the `alpha` dist-tag
91
+ - comments the install command on the PR
92
+
93
+ Pull the branch after CI runs so you pick up the version bump commit before pushing again.
94
+
95
+ ### Testing an alpha
96
+
97
+ ```sh
98
+ npm install @hedia/types@3.12.5-alpha.352 # exact version from the PR comment
99
+ npm install @hedia/types@alpha # latest alpha
100
+ ```
101
+
102
+ ### Release
103
+
104
+ Merging to `master` publishes the version in `package.json` as `latest`, creates a `vX.Y.Z` git tag, and creates a GitHub release. If that version is already on npm the publish is skipped.
105
+
106
+ ## License
107
+
108
+ UNLICENSED. This package is published publicly for distribution convenience only. All rights reserved by Hedia.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/types",
3
- "version": "3.12.5-alpha.352",
3
+ "version": "3.12.6-alpha.353",
4
4
  "description": "Enums, interfaces, and other common types for use in Hedia's software.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/index.d.ts",