raindrops-on-roses 0.0.4 → 0.0.5

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 CHANGED
@@ -17,16 +17,119 @@ And then I don't feel so bad_
17
17
 
18
18
  ## Install
19
19
 
20
+ Install the complete library:
21
+
20
22
  ```sh
21
23
  npm install raindrops-on-roses
22
24
  ```
23
25
 
26
+ Or install only the package you need:
27
+
28
+ ```sh
29
+ npm install @aleclloydprobert/number-clamp
30
+ ```
31
+
32
+ You can also install an aggregate package:
33
+
34
+ ```sh
35
+ npm install @aleclloydprobert/number
36
+ ```
37
+
24
38
  ## Usage
25
39
 
40
+ From the complete library:
41
+
26
42
  ```ts
27
43
  import { clamp } from "raindrops-on-roses";
28
44
  ```
29
45
 
46
+ From an aggregate package:
47
+
48
+ ```ts
49
+ import { clamp } from "@aleclloydprobert/number";
50
+ ```
51
+
52
+ From the smallest individual package:
53
+
54
+ ```ts
55
+ import { clamp } from "@aleclloydprobert/number-clamp";
56
+ ```
57
+
58
+ ## Package architecture
59
+
60
+ `raindrops-on-roses` uses a module tree as its source of truth.
61
+
62
+ Human-authored source lives in `modules/`. Publishable npm workspaces under `packages/` are generated from that tree.
63
+
64
+ ```text
65
+ modules/
66
+ └── number/
67
+ ├── clamp/
68
+ ├── nice-number/
69
+ └── numbers-from-seed/
70
+ ```
71
+
72
+ This produces:
73
+
74
+ ```text
75
+ @aleclloydprobert/number
76
+ @aleclloydprobert/number-clamp
77
+ @aleclloydprobert/number-nice-number
78
+ @aleclloydprobert/number-numbers-from-seed
79
+ raindrops-on-roses
80
+ ```
81
+
82
+ Package names are derived from the module path:
83
+
84
+ ```text
85
+ number
86
+ → @aleclloydprobert/number
87
+
88
+ number/clamp
89
+ → @aleclloydprobert/number-clamp
90
+
91
+ vector/poor
92
+ → @aleclloydprobert/vector-poor
93
+
94
+ vector/poor/distance
95
+ → @aleclloydprobert/vector-poor-distance
96
+ ```
97
+
98
+ Parent module paths automatically become aggregate packages.
99
+
100
+ For example:
101
+
102
+ ```text
103
+ modules/
104
+ └── vector/
105
+ └── poor/
106
+ ├── distance/
107
+ └── mid-point/
108
+ ```
109
+
110
+ generates:
111
+
112
+ ```text
113
+ @aleclloydprobert/vector
114
+ @aleclloydprobert/vector-poor
115
+ @aleclloydprobert/vector-poor-distance
116
+ @aleclloydprobert/vector-poor-mid-point
117
+ ```
118
+
119
+ with a dependency graph like:
120
+
121
+ ```text
122
+ @aleclloydprobert/vector
123
+
124
+
125
+ @aleclloydprobert/vector-poor
126
+
127
+ ├── @aleclloydprobert/vector-poor-distance
128
+ └── @aleclloydprobert/vector-poor-mid-point
129
+ ```
130
+
131
+ The `raindrops-on-roses` package is the root aggregate and depends only on top-level aggregate packages.
132
+
30
133
  ## Contribute
31
134
 
32
135
  `raindrops-on-roses` is an open-source library, and welcomes contributions from humans. If like us you love crafting beautiful and useful utilities, you can open a PR!
@@ -38,157 +141,297 @@ import { clamp } from "raindrops-on-roses";
38
141
 
39
142
  ### Adding a new function
40
143
 
41
- - Clone the repository and install dependencies:
42
-
43
- ```sh
44
- npm install
45
- ```
144
+ Clone the repository and install dependencies:
46
145
 
47
- - Use the generator to create a new function:
48
-
49
- ```sh
50
- npm run add:function -- <functionName>
51
- ```
146
+ ```sh
147
+ npm install
148
+ ```
52
149
 
53
- - The generator will prompt you to:
54
- - choose whether the function is `pure` or `composed`
55
- - choose an existing category, such as `numbers`, or create a new one
150
+ Use the generator:
56
151
 
57
- - Each function is created as its own npm workspace package. The generator creates:
58
- - `src/index.ts` for the implementation
59
- - `test/index.test.ts` for tests
60
- - `package.json` for the individual npm package
61
- - `tsconfig.json`
62
- - `vite.config.ts`
63
- - the corresponding dependency and export in the `raindrops-on-roses` umbrella package
152
+ ```sh
153
+ npm run add:function -- <functionName>
154
+ ```
64
155
 
65
- - New utility packages start at version `0.0.0`.
156
+ The generator will prompt you to choose an existing module path or create a new one.
66
157
 
67
- - After generating a function, install again so npm registers the new workspace:
158
+ For example, adding `distance` under `vector/poor` creates:
68
159
 
69
- ```sh
70
- npm install
71
- ```
160
+ ```text
161
+ modules/
162
+ └── vector/
163
+ └── poor/
164
+ └── distance/
165
+ ├── src/
166
+ │ └── index.ts
167
+ ├── test/
168
+ │ └── index.test.ts
169
+ └── README.md
170
+ ```
72
171
 
73
- - The generated tests are intentionally incomplete and should initially fail.
172
+ The generator creates only the human-authored module. It does not manually create npm manifests, Vite configs, TypeScript configs, aggregate exports, or umbrella dependencies.
74
173
 
75
- - Implement and document the function, then replace the placeholder test with meaningful test cases.
174
+ After creating the module, the package assembler generates all required npm workspaces automatically.
76
175
 
77
- - Every function must:
78
- - be fully typed
79
- - have JSDoc documentation
80
- - have 100% test coverage
176
+ The generated test is intentionally incomplete and should initially fail.
81
177
 
82
- - Run the full test suite:
178
+ Implement and document the function, then replace the placeholder test with meaningful test cases.
83
179
 
84
- ```sh
85
- npm run test
86
- ```
180
+ Every function must:
87
181
 
88
- - Check coverage:
182
+ - be fully typed
183
+ - have JSDoc documentation
184
+ - have 100% test coverage
89
185
 
90
- ```sh
91
- npm run coverage
92
- ```
186
+ Run the test suite:
93
187
 
94
- - Verify that every package builds successfully:
188
+ ```sh
189
+ npm run test
190
+ ```
95
191
 
96
- ```sh
97
- npm run build
98
- ```
192
+ Check coverage:
99
193
 
100
- You should not need to manually add the function to the umbrella `package.json`, `index.ts`, or Vite configuration. The generator handles this automatically.
194
+ ```sh
195
+ npm run coverage
196
+ ```
101
197
 
102
- Do not attempt to publish packages created as part of a contribution. Publishing and versioning are handled by the maintainers as part of the release process.
198
+ Build every package:
103
199
 
104
- ### File system
200
+ ```sh
201
+ npm run build
202
+ ```
105
203
 
106
- There are two types of functions:
204
+ You should not manually edit generated files under `packages/`. Changes belong in `modules/` or in the repository's generation scripts.
107
205
 
108
- - **pure**: an independent unit with no side effects and no dependency on other `raindrops-on-roses` utilities
109
- - **composed**: a function built by composing existing utilities
206
+ Do not attempt to publish packages created as part of a contribution. Publishing and versioning are handled by the maintainers.
110
207
 
111
- Every utility is also an independent npm workspace package.
208
+ ## File system
112
209
 
113
- For example, the `clamp` utility is stored as:
210
+ The repository separates authored modules from generated npm packages.
114
211
 
115
212
  ```text
116
- packages/
117
- ├── pure/
118
- │ └── numbers/
119
- └── clamp/
120
- ├── src/
121
- │ └── index.ts
122
- ├── test/
123
- │ └── index.test.ts
124
- ├── package.json
125
- ├── tsconfig.json
126
- └── vite.config.ts
213
+ raindrops-on-roses/
214
+ ├── modules/ # source of truth
215
+ │ └── number/
216
+ ├── clamp/
217
+ ├── src/
218
+ └── index.ts
219
+ ├── test/
220
+ └── index.test.ts
221
+ │ └── README.md
222
+ ├── nice-number/
223
+ └── numbers-from-seed/
224
+
225
+ ├── packages/ # generated npm workspaces
226
+ │ ├── number/
227
+ │ ├── number-clamp/
228
+ │ ├── number-nice-number/
229
+ │ ├── number-numbers-from-seed/
230
+ │ └── raindrops-on-roses/
127
231
 
128
- └── raindrops-on-roses/
129
- ├── src/
130
- └── index.ts
131
- ├── package.json
132
- ├── tsconfig.json
133
- └── vite.config.ts
232
+ ├── config/
233
+ │ └── vite.library.ts
234
+
235
+ ├── scripts/
236
+ ├── assemble.mjs
237
+ │ ├── bootstrap.mjs
238
+ │ ├── build.mjs
239
+ │ ├── droplet.mjs
240
+ │ ├── publish.mjs
241
+ │ └── release.mjs
242
+
243
+ ├── packages.config.mjs
244
+ ├── packages.versions.json
245
+ ├── package.json
246
+ └── tsconfig.base.json
134
247
  ```
135
248
 
136
- The directory hierarchy describes the kind of utility:
249
+ ### Authored modules
250
+
251
+ Each leaf module contains only the things contributors maintain directly:
137
252
 
138
253
  ```text
139
- packages/<type>/<category>/<utility>/
254
+ modules/<path>/<utility>/
255
+ ├── src/
256
+ │ └── index.ts
257
+ ├── test/
258
+ │ └── index.test.ts
259
+ └── README.md
140
260
  ```
141
261
 
142
262
  For example:
143
263
 
144
264
  ```text
145
- packages/pure/numbers/clamp/
146
- packages/pure/numbers/numbers-from-seed/
265
+ modules/number/clamp/
266
+ modules/number/nice-number/
267
+ modules/number/numbers-from-seed/
147
268
  ```
148
269
 
149
- The utility directory name uses kebab-case, while the exported JavaScript function keeps its normal camelCase name:
270
+ The exported JavaScript function keeps its normal camelCase name while the directory uses kebab-case:
150
271
 
151
272
  ```text
152
273
  numbersFromSeed
153
274
 
154
- packages/pure/numbers/numbers-from-seed/
275
+ modules/number/numbers-from-seed/
155
276
 
156
- @aleclloydprobert/numbers-from-seed
277
+ @aleclloydprobert/number-numbers-from-seed
157
278
  ```
158
279
 
159
- Each utility package can be installed independently:
280
+ ### Generated packages
281
+
282
+ Run:
160
283
 
161
284
  ```sh
162
- npm install @aleclloydprobert/clamp
285
+ npm run assemble
163
286
  ```
164
287
 
165
- and imported directly:
288
+ to regenerate npm workspaces from the module tree.
289
+
290
+ Generated packages contain npm/build infrastructure such as:
291
+
292
+ ```text
293
+ package.json
294
+ tsconfig.json
295
+ vite.config.ts
296
+ src/index.ts
297
+ README.md
298
+ .raindrops-generated
299
+ ```
300
+
301
+ Aggregate package sources are generated as re-exports of their direct child packages.
302
+
303
+ For example:
166
304
 
167
305
  ```ts
168
- import { clamp } from "@aleclloydprobert/clamp";
306
+ export * from "@aleclloydprobert/number-clamp";
307
+ export * from "@aleclloydprobert/number-nice-number";
308
+ export * from "@aleclloydprobert/number-numbers-from-seed";
169
309
  ```
170
310
 
171
- The same utility is also re-exported by the umbrella package:
311
+ The umbrella package is generated from top-level aggregates, for example:
172
312
 
173
313
  ```ts
174
- import { clamp } from "raindrops-on-roses";
314
+ export * from "@aleclloydprobert/number";
175
315
  ```
176
316
 
177
- The umbrella package depends on the individual utility packages and provides the complete library API while remaining tree-shakeable.
317
+ ### Build order
178
318
 
179
- When using:
319
+ Packages are built in dependency order by:
180
320
 
181
321
  ```sh
182
- npm run add:function -- <functionName>
322
+ npm run build
323
+ ```
324
+
325
+ Leaf packages build first, then aggregates, then the umbrella package.
326
+
327
+ For example:
328
+
329
+ ```text
330
+ @aleclloydprobert/number-clamp
331
+
332
+ @aleclloydprobert/number
333
+
334
+ raindrops-on-roses
335
+ ```
336
+
337
+ ### Versions and releases
338
+
339
+ Generated `package.json` files are not the source of truth for package versions.
340
+
341
+ Versions are stored in:
342
+
343
+ ```text
344
+ packages.versions.json
345
+ ```
346
+
347
+ Prepare a release with:
348
+
349
+ ```sh
350
+ npm run release
351
+ ```
352
+
353
+ The release script lets maintainers select changed leaf modules and choose `patch`, `minor`, or `major`.
354
+
355
+ Version changes propagate through dependent aggregates automatically.
356
+
357
+ For example:
358
+
359
+ ```text
360
+ number/clamp changes
361
+
362
+ @aleclloydprobert/number-clamp
363
+
364
+ @aleclloydprobert/number
365
+
366
+ raindrops-on-roses
367
+ ```
368
+
369
+ Unchanged branches keep their existing versions.
370
+
371
+ ### Publishing
372
+
373
+ Publishing is dependency-aware and skips package versions that already exist on npm.
374
+
375
+ The publish order is:
376
+
377
+ ```text
378
+ leaf packages
379
+
380
+ aggregate packages
381
+
382
+ raindrops-on-roses
383
+ ```
384
+
385
+ Normal releases are published through GitHub Actions with npm Trusted Publishing.
386
+
387
+ When a brand-new module path introduces npm package names that have never existed before, maintainers can inspect the bootstrap plan with:
388
+
389
+ ```sh
390
+ npm run bootstrap:dry
183
391
  ```
184
392
 
185
- you will be prompted to select:
393
+ and then bootstrap the new package names with:
186
394
 
187
- 1. `pure` or `composed`
188
- 2. an existing category or a new category
395
+ ```sh
396
+ npm run bootstrap
397
+ ```
398
+
399
+ The bootstrap script publishes new package names once and configures Trusted Publishing for future CI releases.
400
+
401
+ ### Package levels
402
+
403
+ Consumers can choose how much of the library they want to install.
404
+
405
+ Individual utility:
406
+
407
+ ```sh
408
+ npm install @aleclloydprobert/number-clamp
409
+ ```
189
410
 
190
- The generator then creates the complete workspace package in the appropriate location.
411
+ ```ts
412
+ import { clamp } from "@aleclloydprobert/number-clamp";
413
+ ```
414
+
415
+ Aggregate:
416
+
417
+ ```sh
418
+ npm install @aleclloydprobert/number
419
+ ```
420
+
421
+ ```ts
422
+ import { clamp, niceNumber, numbersFromSeed } from "@aleclloydprobert/number";
423
+ ```
424
+
425
+ Complete library:
426
+
427
+ ```sh
428
+ npm install raindrops-on-roses
429
+ ```
430
+
431
+ ```ts
432
+ import { clamp, niceNumber, numbersFromSeed } from "raindrops-on-roses";
433
+ ```
191
434
 
192
- ### Show your love
435
+ ## Show your love
193
436
 
194
437
  - In the JsDoc above your function, feel free to add a quote you like. It should ideally be related to the function.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export { clamp } from "@aleclloydprobert/clamp";
2
- export { numbersFromSeed } from "@aleclloydprobert/numbers-from-seed";
3
- export { niceNumber } from "@aleclloydprobert/nice-number";
1
+ export * from "@aleclloydprobert/number";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1 @@
1
- export { clamp } from "@aleclloydprobert/clamp";
2
- export { numbersFromSeed } from "@aleclloydprobert/numbers-from-seed";
3
- export { niceNumber } from "@aleclloydprobert/nice-number";
4
- //# sourceMappingURL=index.js.map
1
+ export * from "@aleclloydprobert/number";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrops-on-roses",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [
@@ -12,14 +12,14 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
+ "scripts": {
16
+ "build": "vite build && tsc -p tsconfig.json"
17
+ },
15
18
  "dependencies": {
16
- "@aleclloydprobert/clamp": "0.0.2",
17
- "@aleclloydprobert/nice-number": "0.0.2",
18
- "@aleclloydprobert/numbers-from-seed": "0.0.2"
19
+ "@aleclloydprobert/number": "0.0.1"
19
20
  },
20
- "scripts": {
21
- "build": "tsc -p tsconfig.json",
22
- "prepack": "node ../../scripts/copy-readme.mjs"
21
+ "publishConfig": {
22
+ "access": "public"
23
23
  },
24
24
  "license": "MIT",
25
25
  "repository": {
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}