From b9f45be052b280ef86116b7616884a893068379c Mon Sep 17 00:00:00 2001 From: gimy Date: Tue, 9 Apr 2024 18:22:57 +0800 Subject: [PATCH] chore: added initial ground work for jsr --- .releaserc | 2 +- jsr.json | 5 +++++ src/common/utils.ts | 2 +- src/plainWeekDate.ts | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 jsr.json diff --git a/.releaserc b/.releaserc index 62895bd..ba96952 100644 --- a/.releaserc +++ b/.releaserc @@ -22,7 +22,7 @@ [ "@semantic-release/git", { - "assets": ["package.json", "CHANGELOG.md"], + "assets": ["package.json", "jsr.json", "CHANGELOG.md"], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ] diff --git a/jsr.json b/jsr.json new file mode 100644 index 0000000..43fcf73 --- /dev/null +++ b/jsr.json @@ -0,0 +1,5 @@ +{ + "name": "@zaman/week-dates", + "version": "1.0.3", + "exports": "./src/index.ts" +} diff --git a/src/common/utils.ts b/src/common/utils.ts index 177ac85..1f97e8a 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -117,7 +117,7 @@ export function instantToOtherTemporal(instant: Temporal.Instant, target: T): * @return {number} a % b where the result is between 0 and b (either 0 <= x < b * or b < x <= 0, depending on the sign of b). */ -export const pymod = function (a: number, b: number) { +export const pymod = function (a: number, b: number): number { const r = a % b // If r and b differ in sign, add b to wrap the result to the correct sign. return r * b < 0 ? r + b : r diff --git a/src/plainWeekDate.ts b/src/plainWeekDate.ts index 0fb4a69..8f4d56f 100644 --- a/src/plainWeekDate.ts +++ b/src/plainWeekDate.ts @@ -113,7 +113,7 @@ export class PlainWeekDate { // TODO: document that the calendar part will always display the super id not the actual calendar id // string format: "yyyy-Www-d" - toString(options?: ToStringOptions) { + toString(options?: ToStringOptions): string { const optionsToUse = options ? Object.assign({}, this.options, options) : this.options const showWeekDay = optionsToUse.weekStartDay === 'always' || (optionsToUse.weekStartDay === 'auto' && this.weekStartDay !== 1) const showCalendar = optionsToUse.calendarName === 'always' || (optionsToUse.calendarName === 'auto' && this.calendarId !== 'iso8601') @@ -125,7 +125,7 @@ export class PlainWeekDate { } // string format: "yyyyWwwd" - toStringCompact(options?: ToStringOptions) { + toStringCompact(options?: ToStringOptions): string { const optionsToUse = options ? Object.assign({}, this.options, options) : this.options const showWeekDay = optionsToUse.weekStartDay === 'always' || (optionsToUse.weekStartDay === 'auto' && this.weekStartDay !== 1) const showCalendar = optionsToUse.calendarName === 'always' || (optionsToUse.calendarName === 'auto' && this.calendarId !== 'iso8601')