Skip to content

Commit f07a98e

Browse files
committed
Switch to modular imports of @hdate
See hebcal/hebcal-es6#475
1 parent 32b5434 commit f07a98e

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"homepage": "https://github.com/akivajgordon/tikkun.io#readme",
4242
"dependencies": {
4343
"@hebcal/core": "^5.6.1",
44+
"@hebcal/hdate": "^0.11.5",
4445
"@hebcal/leyning": "^8.2.9",
4546
"normalize.css": "^8.0.1"
4647
},

src/calendar-model/generator.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import test from 'ava'
22
import type { UserSettings } from './user-settings.ts'
33
import { LeiningGenerator } from './generator.ts'
4-
import { HDate, HebrewCalendar, Locale, months } from '@hebcal/core'
4+
import { Locale } from '@hebcal/leyning/dist/es/locale'
5+
import { HDate, months } from '@hebcal/hdate'
56
import type { LeiningAliyah, LeiningDate, LeiningRun } from './model-types.ts'
67
import hebrewNumeralFromInteger from '../hebrew-numeral.ts'
78
import type { Ref } from '../ref.ts'
89
import { getBookName } from './hebcal-conversions.ts'
910
import { last, toISODateString } from './utils.ts'
11+
import { getHolidaysOnDate } from '@hebcal/core/dist/es/holidays'
1012

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

src/calendar-model/generator.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HDate, HebrewCalendar, Locale, months } from '@hebcal/core'
1+
import { HDate, months } from '@hebcal/hdate'
22
import type {
33
LeiningAliyah,
44
LeiningDate,
@@ -7,14 +7,13 @@ import type {
77
} from './model-types.ts'
88
import { LeiningInstanceId, LeiningRunType } from './model-types.ts'
99
import type { UserSettings } from './user-settings.ts'
10-
import {
10+
import type {
1111
Aliyah,
1212
AliyotMap,
13-
getLeyningOnDate,
1413
LeyningBase,
1514
LeyningParshaHaShavua,
1615
LeyningShabbatHoliday,
17-
} from '@hebcal/leyning'
16+
} from '@hebcal/leyning/dist/types.d.ts'
1817
import {
1918
invert,
2019
fromISODateString,
@@ -24,6 +23,9 @@ import {
2423
} from './utils.ts'
2524
import { toLeiningAliyah, toAliyahIndex } from './hebcal-conversions.ts'
2625
import { isSameRun } from './ref-utils.ts'
26+
import { getSedra } from '@hebcal/core/dist/es/sedra'
27+
import { getLeyningOnDate } from '@hebcal/leyning/dist/es/getLeyningOnDate'
28+
import { Locale } from '@hebcal/leyning/dist/es/locale'
2729

2830
export function isSameLeiningDate(a: LeiningDate, b: LeiningDate) {
2931
return arrayEquals(a.leinings, b.leinings, isSameLeiningInstance)
@@ -97,10 +99,7 @@ export class LeiningGenerator {
9799
until = new HDate(untilDay, months.TISHREI, 1 + containing.getFullYear())
98100

99101
// Get בראשית from the previous year.
100-
const parshaFinder = HebrewCalendar.getSedra(
101-
until.getFullYear() - 1,
102-
this.settings.israel
103-
)
102+
const parshaFinder = getSedra(until.getFullYear() - 1, this.settings.israel)
104103
return this.generateCalendar({
105104
start: parshaFinder.find('Bereshit')!,
106105
until,

src/calendar-model/hebcal-conversions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** @fileoverview Contains generic helpers to convert between @hebcal types and our model types. */
22

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

src/components/ParshaPicker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ParshaResult, { NoResults } from './ParshaResult.ts'
44
import Search, { SearchEmitter } from './Search.ts'
55
import EventEmitter from '../event-emitter.ts'
66
import { LeiningGenerator } from '../calendar-model/generator.ts'
7-
import { HDate, Locale } from '@hebcal/core'
7+
import { HDate, Locale } from '@hebcal/hdate'
88
import {
99
LeiningInstance,
1010
LeiningInstanceId,

src/view-model/scroll-view-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
LeiningRunType,
1111
} from '../calendar-model/model-types.ts'
1212
import IntegerIterator from '../integer-iterator.ts'
13-
import { HDate } from '@hebcal/core'
13+
import { HDate } from '@hebcal/hdate'
1414
import { containsRef } from '../calendar-model/ref-utils.ts'
1515
import {
1616
fromISODateString,

0 commit comments

Comments
 (0)