FIX: Fix constants task and run update it (#153)

Task was broken due to https://github.com/discourse/discourse/pull/10649
and I had to run it due to https://github.com/discourse/discourse-calendar/pull/152
This commit is contained in:
Rafael dos Santos Silva 2021-07-08 14:39:26 -03:00 committed by GitHub
parent 8e4c469191
commit db358d7a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -21,6 +21,8 @@ export const HOLIDAY_REGIONS = [
"be_fr",
"be_nl",
"br",
"br_spcapital",
"br_sp",
"bg_en",
"bg_bg",
"ca",
@ -148,6 +150,7 @@ export const HOLIDAY_REGIONS = [
"it_bl",
"it_ro",
"kr",
"kz",
"li",
"lt",
"lv",
@ -270,7 +273,6 @@ export const TIME_ZONE_TO_REGION = {
"Australia/Lord_Howe": "au",
"Antarctica/Macquarie": "au",
"Australia/Hobart": "au",
"Australia/Currie": "au",
"Australia/Melbourne": "au",
"Australia/Sydney": "au",
"Australia/Broken_Hill": "au",
@ -321,9 +323,9 @@ export const TIME_ZONE_TO_REGION = {
"America/Creston": "ca",
"America/Dawson_Creek": "ca",
"America/Fort_Nelson": "ca",
"America/Vancouver": "ca",
"America/Whitehorse": "ca",
"America/Dawson": "ca",
"America/Vancouver": "ca",
"Europe/Zurich": "ch",
"America/Santiago": "cl",
"America/Punta_Arenas": "cl",
@ -349,6 +351,13 @@ export const TIME_ZONE_TO_REGION = {
"Europe/Rome": "it",
"Asia/Tokyo": "jp",
"Asia/Seoul": "kr",
"Asia/Almaty": "kz",
"Asia/Qyzylorda": "kz",
"Asia/Qostanay": "kz",
"Asia/Aqtobe": "kz",
"Asia/Aqtau": "kz",
"Asia/Atyrau": "kz",
"Asia/Oral": "kz",
"Europe/Vilnius": "lt",
"Europe/Luxembourg": "lu",
"Europe/Riga": "lv",
@ -382,8 +391,8 @@ export const TIME_ZONE_TO_REGION = {
"Europe/Moscow": "ru",
"Europe/Simferopol": "ru",
"Europe/Kirov": "ru",
"Europe/Astrakhan": "ru",
"Europe/Volgograd": "ru",
"Europe/Astrakhan": "ru",
"Europe/Saratov": "ru",
"Europe/Ulyanovsk": "ru",
"Europe/Samara": "ru",

View File

@ -5,6 +5,8 @@ UNUSED_REGIONS = ["ecbtarget", "federalreserve", "federalreservebanks", "fedex",
HOLIDAYS_COUNTRY_OVERRIDES = { "gr" => "el" }
task 'javascript:update_constants' => :environment do
require 'holidays' if !defined?(Holidays)
holiday_regions = Holidays.available_regions.map(&:to_s) - UNUSED_REGIONS
time_zone_to_region = {}
@ -19,7 +21,7 @@ task 'javascript:update_constants' => :environment do
time_zone_to_region[timezone] = country_code
end
write_template("../../../plugins/discourse-calendar/assets/javascripts/lib/regions.js.es6", <<~JS)
write_template("../../../plugins/discourse-calendar/assets/javascripts/lib/regions.js.es6", 'update_constants', <<~JS)
export const HOLIDAY_REGIONS = #{holiday_regions.to_json};
export const TIME_ZONE_TO_REGION = #{time_zone_to_region.to_json};