chore: add changeset, add build in release, drop version back - #6
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the release/tooling flow for @offload-project/rrule by adding a Changesets entry, ensuring a build runs during release, and adjusting the package version.
Changes:
- Downgrades
package.jsonversion from2.8.1to2.8.0and adds aprepackbuild step. - Adds an explicit
bun run buildstep to the GitHub release workflow. - Adds a new Changesets markdown file describing a patch release.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.json | Adjusts package version and adds prepack to build before packing/publishing. |
| .github/workflows/release.yml | Adds a build step prior to the Changesets release action. |
| .changeset/bumpy-llamas-allow.md | Introduces a patch changeset describing a set of refactors/fixes/features. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| "name": "@offload-project/rrule", | ||
| "version": "2.8.1", | ||
| "version": "2.8.0", |
There was a problem hiding this comment.
package.json version is being downgraded to 2.8.0, but the repository CHANGELOG.md already has a top-level entry for 2.8.1. This mismatch will confuse the release pipeline (changesets/changelog) and can lead to attempting to re-release an already documented version; align package.json version and changelog (either keep 2.8.1 here, or adjust the changelog/changeset strategy accordingly).
| "version": "2.8.0", | |
| "version": "2.8.1", |
| "preview": "vite preview", | ||
| "test": "jest **/*.test.ts", | ||
| "change": "changeset", | ||
| "prepack": "bun run build", |
There was a problem hiding this comment.
The new prepack script calls bun run build. prepack is executed by npm during npm pack/npm publish, so this will fail in environments where Bun isn’t installed (even if Node/npm are). Consider using a package-manager-agnostic command (e.g., npm run build) or explicitly declaring/enforcing Bun as the required package manager (e.g., via the packageManager field) so publishing/packing is reliable.
| "prepack": "bun run build", | |
| "prepack": "npm run build", |
| Refactored the core recurrence-rule implementation to share query/caching logic across RRule and RRuleSet, while also fixing a few correctness/performance issues in iteration and caching behavior. | ||
|
|
||
| ## Bug Fixes | ||
|
|
||
| - Fixed removeFilteredDays accumulation bug | ||
| - Was overwriting filtered on each iteration instead of accumulating. Only the last day's filter status was returned, causing sub-daily frequencies to | ||
| potentially skip the wrong number of days when earlier days in the set were filtered out. | ||
|
|
||
| - Fixed RRuleSet.clone() inverted noCache | ||
| - Changed new RRuleSet(!!this._cache) to new RRuleSet(!this._cache). The constructor param is noCache, so the old code was enabling cache on uncached | ||
| sets and vice versa. | ||
|
|
||
| - Removed dead lno1wkst = 0 assignment | ||
| - The value was assigned inside an if block but never read afterward. Changed declaration from let to const. | ||
|
|
||
| ## Architecture | ||
|
|
||
| - Extracted RRuleBase abstract class | ||
| - Moved shared query methods (all, between, before, after, count) and caching logic into RRuleBase. | ||
| - RRule extends RRuleBase — keeps options, _iter, toString, toText, NLP methods. | ||
| - RRuleSet extends RRuleBase — no longer extends RRule or calls super({}, noCache) with fake empty options. | ||
| - Exported RRuleBase from src/index.ts so consumers can use instanceof RRuleBase for any rule-like object. | ||
| - Updated test utilities to use RRuleBase for shared type checking. | ||
|
|
||
| ## Performance | ||
|
|
||
| - rrules()/exrules() — eliminated serialize+reparse | ||
| - Was: this._rrule.map((e) => rrulestr(e.toString())) — serializes to RFC string then re-parses. | ||
| - Now: this._rrule.map((e) => e.clone()) — direct clone, removed the rrulestr import entirely. | ||
|
|
||
| - _addRule/_addDate — eliminated O(n) array allocation | ||
| - Was: collection.map(String).includes(String(rrule)) — allocates a new array on every call. | ||
| - Now: collection.some((r) => String(r) === str) — short-circuits without allocating. | ||
| - Same pattern for _addDate: .some((d) => d.getTime() === time) instead of .map(Number).includes(Number(date)). | ||
|
|
||
| - Added cache size bounds (src/cache.ts) | ||
| - Added MAX_CACHE_SIZE = 64 constant. | ||
| - before/after/between caches now evict the oldest entry (FIFO) when the limit is reached, preventing unbounded memory growth on long-lived instances. | ||
|
|
||
| ## Type Safety | ||
|
|
||
| - Narrowed bynweekday to tuple type (src/types.ts) | ||
| - Changed bynweekday: number[][] | null to bynweekday: [number, number][] | null in ParsedOptions, enabling safe destructuring without ! assertions in | ||
| monthinfo.ts and parseoptions.ts. | ||
|
|
||
| - Narrowed toText options to ParsedOptions (src/nlp/totext.ts) | ||
| - Changed private options: Partial<Options> to private options: ParsedOptions, removing ~40 ! assertions on this.options.freq, this.options.interval, | ||
| this.options.bymonthday, etc. | ||
|
|
||
| - Added explicit return types to dateutil helpers (src/dateutil.ts) | ||
| - getWeekday(): number, getMonthDays(): number, monthRange(): [number, number]. | ||
| - Eliminated downstream ! assertions in datetime.ts and yearinfo.ts where these return values were used. | ||
|
|
||
| - Added explicit return type to extractName (src/rrulestr.ts) | ||
| - Typed as { name: string; value: string } with default destructuring values, removing ! assertions on name and value. | ||
|
|
||
| - Added default destructuring values in parseString (src/parsestring.ts) | ||
| - const [key = '', value = ''] = attr.split('=') and similar patterns, eliminating undefined-possibility assertions. | ||
|
|
||
| - Fixed Cache.all type (src/cache.ts) | ||
| - Was: Date[] | Partial<IterArgs> | false — Partial<IterArgs> was never stored as all. | ||
| - Now: Date[] | false. | ||
|
|
||
| - Clarified cache miss check (src/cache.ts) |
There was a problem hiding this comment.
This changeset content appears to duplicate the existing CHANGELOG.md entry for version 2.8.1 (same summary and sections). If this changeset is applied, Changesets will likely append the same notes again during changeset version, resulting in duplicated release notes and potentially re-cutting 2.8.1. Either remove/adjust this changeset or reconcile it with the existing changelog/version so only one source of truth drives the 2.8.1 notes.
| Refactored the core recurrence-rule implementation to share query/caching logic across RRule and RRuleSet, while also fixing a few correctness/performance issues in iteration and caching behavior. | |
| ## Bug Fixes | |
| - Fixed removeFilteredDays accumulation bug | |
| - Was overwriting filtered on each iteration instead of accumulating. Only the last day's filter status was returned, causing sub-daily frequencies to | |
| potentially skip the wrong number of days when earlier days in the set were filtered out. | |
| - Fixed RRuleSet.clone() inverted noCache | |
| - Changed new RRuleSet(!!this._cache) to new RRuleSet(!this._cache). The constructor param is noCache, so the old code was enabling cache on uncached | |
| sets and vice versa. | |
| - Removed dead lno1wkst = 0 assignment | |
| - The value was assigned inside an if block but never read afterward. Changed declaration from let to const. | |
| ## Architecture | |
| - Extracted RRuleBase abstract class | |
| - Moved shared query methods (all, between, before, after, count) and caching logic into RRuleBase. | |
| - RRule extends RRuleBase — keeps options, _iter, toString, toText, NLP methods. | |
| - RRuleSet extends RRuleBase — no longer extends RRule or calls super({}, noCache) with fake empty options. | |
| - Exported RRuleBase from src/index.ts so consumers can use instanceof RRuleBase for any rule-like object. | |
| - Updated test utilities to use RRuleBase for shared type checking. | |
| ## Performance | |
| - rrules()/exrules() — eliminated serialize+reparse | |
| - Was: this._rrule.map((e) => rrulestr(e.toString())) — serializes to RFC string then re-parses. | |
| - Now: this._rrule.map((e) => e.clone()) — direct clone, removed the rrulestr import entirely. | |
| - _addRule/_addDate — eliminated O(n) array allocation | |
| - Was: collection.map(String).includes(String(rrule)) — allocates a new array on every call. | |
| - Now: collection.some((r) => String(r) === str) — short-circuits without allocating. | |
| - Same pattern for _addDate: .some((d) => d.getTime() === time) instead of .map(Number).includes(Number(date)). | |
| - Added cache size bounds (src/cache.ts) | |
| - Added MAX_CACHE_SIZE = 64 constant. | |
| - before/after/between caches now evict the oldest entry (FIFO) when the limit is reached, preventing unbounded memory growth on long-lived instances. | |
| ## Type Safety | |
| - Narrowed bynweekday to tuple type (src/types.ts) | |
| - Changed bynweekday: number[][] | null to bynweekday: [number, number][] | null in ParsedOptions, enabling safe destructuring without ! assertions in | |
| monthinfo.ts and parseoptions.ts. | |
| - Narrowed toText options to ParsedOptions (src/nlp/totext.ts) | |
| - Changed private options: Partial<Options> to private options: ParsedOptions, removing ~40 ! assertions on this.options.freq, this.options.interval, | |
| this.options.bymonthday, etc. | |
| - Added explicit return types to dateutil helpers (src/dateutil.ts) | |
| - getWeekday(): number, getMonthDays(): number, monthRange(): [number, number]. | |
| - Eliminated downstream ! assertions in datetime.ts and yearinfo.ts where these return values were used. | |
| - Added explicit return type to extractName (src/rrulestr.ts) | |
| - Typed as { name: string; value: string } with default destructuring values, removing ! assertions on name and value. | |
| - Added default destructuring values in parseString (src/parsestring.ts) | |
| - const [key = '', value = ''] = attr.split('=') and similar patterns, eliminating undefined-possibility assertions. | |
| - Fixed Cache.all type (src/cache.ts) | |
| - Was: Date[] | Partial<IterArgs> | false — Partial<IterArgs> was never stored as all. | |
| - Now: Date[] | false. | |
| - Clarified cache miss check (src/cache.ts) | |
| Internal refactor and bug fixes to the recurrence-rule implementation; see the 2.8.1 changelog entry for full details of behavior, performance, and type-safety changes. |
No description provided.