Skip to content

Commit

Permalink
Switch to modular imports of @hdate
Browse files Browse the repository at this point in the history
  • Loading branch information
SLaks committed Nov 5, 2024
1 parent 0532f8a commit 5688ed9
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"homepage": "https://github.com/akivajgordon/tikkun.io#readme",
"dependencies": {
"@hebcal/core": "^5.6.1",
"@hebcal/hdate": "^0.11.5",
"@hebcal/leyning": "^8.2.9",
"normalize.css": "^8.0.1"
},
Expand Down
5 changes: 3 additions & 2 deletions src/calendar-model/generator.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import test from 'ava'
import type { UserSettings } from './user-settings.ts'
import { LeiningGenerator } from './generator.ts'
import { HDate, HebrewCalendar, Locale, months } from '@hebcal/core'
import { HDate, Locale, months } from '@hebcal/hdate'
import type { LeiningAliyah, LeiningDate, LeiningRun } from './model-types.ts'
import hebrewNumeralFromInteger from '../hebrew-numeral.ts'
import type { Ref } from '../ref.ts'
import { getBookName } from './hebcal-conversions.ts'
import { last, toISODateString } from './utils.ts'
import { getHolidaysOnDate } from '@hebcal/core/dist/es/holidays'

const testSettings: UserSettings = {
ashkenazi: true,
Expand Down Expand Up @@ -60,7 +61,7 @@ test('4 פרשיות always get separate runs', (t) => {
const start = new HDate(20, months.SHVAT, year)
for (let day = 0; day < 100; day++) {
const date = start.add(day, 'days')
const events = HebrewCalendar.getHolidaysOnDate(date)
const events = getHolidaysOnDate(date)
if (!events?.some((d) => fourParshaDescriptions.includes(d.desc)))
continue

Expand Down
14 changes: 6 additions & 8 deletions src/calendar-model/generator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HDate, HebrewCalendar, Locale, months } from '@hebcal/core'
import { HDate, Locale, months } from '@hebcal/hdate'
import type {
LeiningAliyah,
LeiningDate,
Expand All @@ -7,14 +7,13 @@ import type {
} from './model-types.ts'
import { LeiningInstanceId, LeiningRunType } from './model-types.ts'
import type { UserSettings } from './user-settings.ts'
import {
import type {
Aliyah,
AliyotMap,
getLeyningOnDate,
LeyningBase,
LeyningParshaHaShavua,
LeyningShabbatHoliday,
} from '@hebcal/leyning'
} from '@hebcal/leyning/dist/types.d.ts'
import {
invert,
fromISODateString,
Expand All @@ -24,6 +23,8 @@ import {
} from './utils.ts'
import { toLeiningAliyah, toAliyahIndex } from './hebcal-conversions.ts'
import { isSameRun } from './ref-utils.ts'
import { getSedra } from '@hebcal/core/dist/es/sedra'
import { getLeyningOnDate } from '@hebcal/leyning/dist/es/getLeyningOnDate'

export function isSameLeiningDate(a: LeiningDate, b: LeiningDate) {
return arrayEquals(a.leinings, b.leinings, isSameLeiningInstance)
Expand Down Expand Up @@ -97,10 +98,7 @@ export class LeiningGenerator {
until = new HDate(untilDay, months.TISHREI, 1 + containing.getFullYear())

// Get בראשית from the previous year.
const parshaFinder = HebrewCalendar.getSedra(
until.getFullYear() - 1,
this.settings.israel
)
const parshaFinder = getSedra(until.getFullYear() - 1, this.settings.israel)
return this.generateCalendar({
start: parshaFinder.find('Bereshit')!,
until,
Expand Down
3 changes: 2 additions & 1 deletion src/calendar-model/hebcal-conversions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @fileoverview Contains generic helpers to convert between @hebcal types and our model types. */

import { Aliyah, BOOK, calculateNumVerses } from '@hebcal/leyning'
import type { Aliyah } from '@hebcal/leyning/dist/es/types'
import { BOOK, calculateNumVerses } from '@hebcal/leyning/dist/es/common'
import type { RefWithScroll, ScrollName } from '../ref.ts'
import type { LeiningAliyah } from './model-types.ts'

Expand Down
2 changes: 1 addition & 1 deletion src/components/ParshaPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ParshaResult, { NoResults } from './ParshaResult.ts'
import Search, { SearchEmitter } from './Search.ts'
import EventEmitter from '../event-emitter.ts'
import { LeiningGenerator } from '../calendar-model/generator.ts'
import { HDate, Locale } from '@hebcal/core'
import { HDate, Locale } from '@hebcal/hdate'
import {
LeiningInstance,
LeiningInstanceId,
Expand Down
2 changes: 1 addition & 1 deletion src/view-model/scroll-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
LeiningRunType,
} from '../calendar-model/model-types.ts'
import IntegerIterator from '../integer-iterator.ts'
import { HDate } from '@hebcal/core'
import { HDate } from '@hebcal/hdate'
import { containsRef } from '../calendar-model/ref-utils.ts'
import {
fromISODateString,
Expand Down

0 comments on commit 5688ed9

Please sign in to comment.