rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getPublicHolidays, toIsoDate } from "@capakraken/shared";
|
||||
import { getPublicHolidays, toIsoDate } from "@nexus/shared";
|
||||
|
||||
export type HolidayCalendarSeedScope = "COUNTRY" | "STATE" | "CITY";
|
||||
|
||||
@@ -62,10 +62,15 @@ function computeEasterSunday(year: number): Date {
|
||||
return dateUtc(year, month, day);
|
||||
}
|
||||
|
||||
function nthWeekdayOfMonth(year: number, month: number, weekday: number, occurrence: number): string {
|
||||
function nthWeekdayOfMonth(
|
||||
year: number,
|
||||
month: number,
|
||||
weekday: number,
|
||||
occurrence: number,
|
||||
): string {
|
||||
const firstDay = dateUtc(year, month, 1);
|
||||
const delta = (weekday - firstDay.getUTCDay() + 7) % 7;
|
||||
const day = 1 + delta + ((occurrence - 1) * 7);
|
||||
const day = 1 + delta + (occurrence - 1) * 7;
|
||||
return toIsoDate(dateUtc(year, month, day));
|
||||
}
|
||||
|
||||
@@ -90,7 +95,10 @@ function observedUsFixedHoliday(year: number, month: number, day: number): strin
|
||||
return toIsoDate(holiday);
|
||||
}
|
||||
|
||||
function buildEntries(years: number[], definitions: SimpleHolidayDefinition[]): HolidayCalendarSeedEntry[] {
|
||||
function buildEntries(
|
||||
years: number[],
|
||||
definitions: SimpleHolidayDefinition[],
|
||||
): HolidayCalendarSeedEntry[] {
|
||||
const entries = new Map<string, HolidayCalendarSeedEntry>();
|
||||
|
||||
for (const year of years) {
|
||||
@@ -139,7 +147,10 @@ function buildSpanishCountryEntries(years: number[]): HolidayCalendarSeedEntry[]
|
||||
return buildEntries(years, [
|
||||
{ name: "Ano Nuevo", resolveDate: (year) => toIsoDate(dateUtc(year, 1, 1)) },
|
||||
{ name: "Epifania del Senor", resolveDate: (year) => toIsoDate(dateUtc(year, 1, 6)) },
|
||||
{ name: "Viernes Santo", resolveDate: (year) => toIsoDate(addDays(computeEasterSunday(year), -2)) },
|
||||
{
|
||||
name: "Viernes Santo",
|
||||
resolveDate: (year) => toIsoDate(addDays(computeEasterSunday(year), -2)),
|
||||
},
|
||||
{ name: "Fiesta del Trabajo", resolveDate: (year) => toIsoDate(dateUtc(year, 5, 1)) },
|
||||
{ name: "Asuncion de la Virgen", resolveDate: (year) => toIsoDate(dateUtc(year, 8, 15)) },
|
||||
{ name: "Fiesta Nacional de Espana", resolveDate: (year) => toIsoDate(dateUtc(year, 10, 12)) },
|
||||
@@ -153,7 +164,10 @@ function buildSpanishCountryEntries(years: number[]): HolidayCalendarSeedEntry[]
|
||||
function buildIndianCountryEntries(years: number[]): HolidayCalendarSeedEntry[] {
|
||||
return buildEntries(years, [
|
||||
{ name: "Republic Day", resolveDate: (year) => toIsoDate(dateUtc(year, 1, 26)) },
|
||||
{ name: "Good Friday", resolveDate: (year) => toIsoDate(addDays(computeEasterSunday(year), -2)) },
|
||||
{
|
||||
name: "Good Friday",
|
||||
resolveDate: (year) => toIsoDate(addDays(computeEasterSunday(year), -2)),
|
||||
},
|
||||
{ name: "Independence Day", resolveDate: (year) => toIsoDate(dateUtc(year, 8, 15)) },
|
||||
{ name: "Gandhi Jayanti", resolveDate: (year) => toIsoDate(dateUtc(year, 10, 2)) },
|
||||
]);
|
||||
@@ -175,7 +189,9 @@ function normalizeCountryCodes(countryCodes: string[]): Set<string> {
|
||||
return new Set(countryCodes.map((countryCode) => countryCode.trim().toUpperCase()));
|
||||
}
|
||||
|
||||
function normalizeCityLookup(availableCitiesByCountry: Record<string, string[]>): Map<string, Set<string>> {
|
||||
function normalizeCityLookup(
|
||||
availableCitiesByCountry: Record<string, string[]>,
|
||||
): Map<string, Set<string>> {
|
||||
const lookup = new Map<string, Set<string>>();
|
||||
|
||||
for (const [countryCode, cityNames] of Object.entries(availableCitiesByCountry)) {
|
||||
@@ -185,7 +201,11 @@ function normalizeCityLookup(availableCitiesByCountry: Record<string, string[]>)
|
||||
return lookup;
|
||||
}
|
||||
|
||||
function hasCity(cityLookup: Map<string, Set<string>>, countryCode: string, cityName: string): boolean {
|
||||
function hasCity(
|
||||
cityLookup: Map<string, Set<string>>,
|
||||
countryCode: string,
|
||||
cityName: string,
|
||||
): boolean {
|
||||
return cityLookup.get(countryCode)?.has(cityName) ?? false;
|
||||
}
|
||||
|
||||
@@ -204,7 +224,10 @@ function germanStateDisplayName(stateCode: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function buildCityEntries(years: number[], definitions: SimpleHolidayDefinition[]): HolidayCalendarSeedEntry[] {
|
||||
function buildCityEntries(
|
||||
years: number[],
|
||||
definitions: SimpleHolidayDefinition[],
|
||||
): HolidayCalendarSeedEntry[] {
|
||||
return buildEntries(years, definitions);
|
||||
}
|
||||
|
||||
@@ -253,7 +276,10 @@ export function buildHolidayCalendarSeedDefinitions(
|
||||
cityName: "Augsburg",
|
||||
priority: CITY_PRIORITY,
|
||||
entries: buildCityEntries(context.years, [
|
||||
{ name: "Augsburger Friedensfest", resolveDate: (year) => toIsoDate(dateUtc(year, 8, 8)) },
|
||||
{
|
||||
name: "Augsburger Friedensfest",
|
||||
resolveDate: (year) => toIsoDate(dateUtc(year, 8, 8)),
|
||||
},
|
||||
]),
|
||||
});
|
||||
}
|
||||
@@ -277,7 +303,10 @@ export function buildHolidayCalendarSeedDefinitions(
|
||||
priority: CITY_PRIORITY,
|
||||
entries: buildEntries(context.years, [
|
||||
{ name: "San Isidro", resolveDate: (year) => toIsoDate(dateUtc(year, 5, 15)) },
|
||||
{ name: "Nuestra Senora de la Almudena", resolveDate: (year) => toIsoDate(dateUtc(year, 11, 9)) },
|
||||
{
|
||||
name: "Nuestra Senora de la Almudena",
|
||||
resolveDate: (year) => toIsoDate(dateUtc(year, 11, 9)),
|
||||
},
|
||||
]),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user