@focusbc/bbs-lib 0.0.5 → 0.0.7

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 DELETED
@@ -1,169 +0,0 @@
1
- # `@focusbc/bbs-lib`
2
-
3
- TypeScript library wrapping `deck.gl` and [`@focusbc/map-rendering`](https://www.npmjs.com/package/@focusbc/map-rendering) for BBS map rendering.
4
-
5
- The library exposes a high-level `MapOverlay` API that receives the BBS map context returned by the integration API and renders the corresponding static and dynamic map layers.
6
-
7
- ---
8
-
9
- ## Installation
10
-
11
- The package is published to npm under the `@focusbc` scope.
12
-
13
- ```bash
14
- # Using yarn
15
- yarn add @focusbc/bbs-lib
16
-
17
- # Using npm
18
- npm install @focusbc/bbs-lib
19
- ```
20
-
21
- Because this package depends on `@focusbc/map-rendering` and deck.gl, consumers should use compatible deck.gl versions with the ones declared by the package.
22
-
23
- ---
24
-
25
- ## Usage
26
-
27
- ```html
28
- <div id="map-overlay" style="position: relative; width: 100%; height: 100%;"></div>
29
- ```
30
-
31
- ```ts
32
- import { MapOverlay, type MapContext } from '@focusbc/bbs-lib'
33
-
34
- const context: MapContext = {
35
- // Context returned by the BBS/integration API
36
- }
37
-
38
- const overlay = MapOverlay.initialize(document.getElementById('map-overlay')!, context)
39
-
40
- overlay.click().subscribe(({ shape, lat, lng }) => {
41
- console.log('left click', { shape, lat, lng })
42
- })
43
-
44
- overlay.doubleClick().subscribe(({ shape, lat, lng }) => {
45
- console.log('double click', { shape, lat, lng })
46
- })
47
-
48
- overlay.rightClick().subscribe(({ shape, lat, lng }) => {
49
- console.log('right click', { shape, lat, lng })
50
- })
51
-
52
- // Later, when the event/site changes:
53
- overlay.setContext(newContext)
54
- ```
55
-
56
- ---
57
-
58
- ## Development
59
-
60
- Install dependencies and build the library from the `bbs-lib/` directory:
61
-
62
- ```bash
63
- yarn install
64
- yarn build
65
- ```
66
-
67
- From the repository root you can also run:
68
-
69
- ```bash
70
- yarn bbs-lib build
71
- ```
72
-
73
- The build output is generated under `dist/`. Only `dist/**/*` and this README are included in the published npm package. The `demo/` and `sandbox/` folders are **not** published (see `package.json` `"files"` and `.npmignore`).
74
-
75
- ---
76
-
77
- ## Sandbox (local manual testing)
78
-
79
- A small static page under `sandbox/` can be used to test `MapOverlay` against the integration API BBS endpoints. Unlike `demo/`, the sandbox bundles the **local library source** from this repo.
80
-
81
- 1. Copy `sandbox/config.example.ts` to `sandbox/config.ts` and set:
82
- - `INTEGRATION_API_BASE` — for example, `http://localhost:5016`
83
- - `BBS_API_KEY` — must match `Settings.BbsApiKey` in your local integration-api config
84
-
85
- 2. Start `integration-api` locally.
86
-
87
- 3. Build and serve the sandbox:
88
-
89
- ```bash
90
- cd bbs-lib
91
- yarn install
92
- yarn sandbox:build
93
- npx --yes serve sandbox -p 5173
94
- ```
95
-
96
- For continuous rebuild on save:
97
-
98
- ```bash
99
- yarn sandbox:watch
100
- ```
101
-
102
- Open `http://localhost:5173`, select an event, then a site. The overlay calls `MapOverlay.initialize` on first site selection and `setContext` on subsequent changes.
103
-
104
- ---
105
-
106
- ## Client demo
107
-
108
- The client-facing reference implementation lives in [`demo/`](demo/). It is a static site (`index.html` + `main.js`) with no build step. See [`demo/README.md`](demo/README.md).
109
-
110
- From this directory:
111
-
112
- ```bash
113
- yarn demo:serve
114
- ```
115
-
116
- Or from the repository root:
117
-
118
- ```bash
119
- yarn bbs-demo:serve
120
- ```
121
-
122
- To run the demo folder on its own, serve it statically — for example `npx --yes serve . -p 5174` from `demo/`.
123
-
124
- ---
125
-
126
- ## Releasing the library
127
-
128
- The release process is handled by `bbs-lib/scripts/release-lib.sh` and can be started from inside `bbs-lib/`:
129
-
130
- ```bash
131
- yarn release:lib
132
- ```
133
-
134
- By default, this performs a patch release, for example `1.0.0` → `1.0.1`.
135
-
136
- You can also choose the version bump explicitly:
137
-
138
- ```bash
139
- yarn release:lib patch
140
- yarn release:lib minor
141
- yarn release:lib major
142
- ```
143
-
144
- From the repository root, the equivalent command is:
145
-
146
- ```bash
147
- yarn release:bbs-lib
148
- ```
149
-
150
- ### Release prerequisites
151
-
152
- 1. You must have access to publish `@focusbc/bbs-lib` under the `@focusbc` npm scope.
153
- 2. You must have the Google Cloud CLI installed and authenticated.
154
- 3. Your Google Cloud user must be able to decrypt/encrypt with the existing KMS key used by `auxiliary/scripts/decrypt_file.sh` and `auxiliary/scripts/encrypt_file.sh`.
155
- 4. `bbs-lib/.npmrc.enc` must exist. This is the encrypted version of the npm credentials file and is the only credential file that should be committed.
156
-
157
- ### What happens during release
158
-
159
- When you run `yarn release:lib`, the script:
160
-
161
- 1. Decrypts `bbs-lib/.npmrc.enc` into a temporary local `bbs-lib/.npmrc`.
162
- 2. Bumps `package.json` using `npm version <patch|minor|major> --no-git-tag-version`.
163
- 3. Builds the package with `npm run build`.
164
- 4. Publishes the package to `https://registry.npmjs.org/` with `npm publish --access public`.
165
- 5. Uploads `dist/browser/bbs-lib.js` to Cloud Storage at `gs://bbs-lib-bucket/bbs-lib` (override with `BBS_LIB_BUCKET_URI` or `BBS_LIB_BUCKET`).
166
- 6. Re-encrypts the temporary `.npmrc` back into `.npmrc.enc`.
167
- 7. Removes the plaintext `.npmrc` from disk.
168
-
169
- If the release fails after the version bump, review `package.json` before retrying because the version may already have been changed locally.