diff --git a/.prettierignore b/.prettierignore index d143ec4..c24330b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,2 @@ src/shared/* -!src/shared/analytics \ No newline at end of file +dist \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7f051aa..b15c29d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,4 @@ { - "recommendations": ["astro-build.astro-vscode", "antfu.iconify"], + "recommendations": ["astro-build.astro-vscode", "antfu.iconify", "esbenp.prettier-vscode"], "unwantedRecommendations": [] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 9a4c2b9..d720b65 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,11 @@ { "editor.rulers": [100], "editor.tabSize": 2, - "typescript.preferences.importModuleSpecifier": "non-relative" + "typescript.preferences.importModuleSpecifier": "non-relative", + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, .ncurc.*, .nvmrc, *.config.cjs, *.config.js, *.config.ts, *config.json, .*ignore", + ".env": ".env.*", + "README.md": "*.md" + } } diff --git a/package.json b/package.json index ade7927..ddfcad6 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,10 @@ "preview": "astro preview", "astro": "astro", "upgrade": "ncu", - "script:download-payload-sdk": "npm run scripts/download-payload-sdk.ts", - "script:download-currencies": "npm run scripts/download-currencies.ts", + "script:download-currencies": "node --env-file=.env scripts/download-currencies.mjs", "script:download-wording-keys": "npm run scripts/download-wording-keys.ts", "prettier": "prettier --write --list-different --plugin=prettier-plugin-astro .", - "precommit": "npm run script:download-currencies && npm run script:download-payload-sdk && npm run script:download-wording-keys && npm run prettier && npm run astro check" + "precommit": "npm run script:download-currencies && npm run script:download-wording-keys && npm run prettier && npm run astro check" }, "engines": { "npm": ">=10.0.0", diff --git a/scripts/download-currencies.ts b/scripts/download-currencies.mjs similarity index 84% rename from scripts/download-currencies.ts rename to scripts/download-currencies.mjs index ab19bdf..2101836 100644 --- a/scripts/download-currencies.ts +++ b/scripts/download-currencies.mjs @@ -1,6 +1,7 @@ +// @ts-check import { writeFileSync, readFileSync, existsSync } from "fs"; -const OPEN_EXCHANGE_FOLDER = `${process.cwd()}/src/shared/openExchange`; +const OPEN_EXCHANGE_FOLDER = `${process.cwd()}/src/dist/openExchange`; const RATE_JSON_PATH = `${OPEN_EXCHANGE_FOLDER}/rates.json`; const CURRENCIES_JSON_PATH = `${OPEN_EXCHANGE_FOLDER}/currencies.json`; const ONE_DAY_IN_MS = 1_000 * 60 * 60 * 24; @@ -17,11 +18,13 @@ if (existsSync(RATE_JSON_PATH)) { } } -const ratesUrl = `https://openexchangerates.org/api/latest.json?app_id=${ - import.meta.env.OER_APP_ID -}`; +if (!process.env.OER_APP_ID) { + throw new Error("Missing OER_APP_ID env variable"); +} + +const ratesUrl = `https://openexchangerates.org/api/latest.json?app_id=${process.env.OER_APP_ID}`; const currenciesUrl = `https://openexchangerates.org/api/currencies.json?app_id=${ - import.meta.env.OER_APP_ID + process.env.OER_APP_ID }`; const rates = await fetch(ratesUrl); diff --git a/src/components/Previews/FolderPreview.astro b/src/components/Previews/FolderPreview.astro index 00096ff..cf0837b 100644 --- a/src/components/Previews/FolderPreview.astro +++ b/src/components/Previews/FolderPreview.astro @@ -8,9 +8,7 @@ interface Props { folder: EndpointFolder; } -const { getLocalizedUrl, getLocalizedMatch, t } = await getI18n( - Astro.locals.currentLocale -); +const { getLocalizedUrl, getLocalizedMatch, t } = await getI18n(Astro.locals.currentLocale); const { folder: { translations, slug, files, sections, parentPages }, diff --git a/src/shared/openExchange/currencies.json b/src/shared/openExchange/currencies.json deleted file mode 100644 index 73b34a4..0000000 --- a/src/shared/openExchange/currencies.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "AED": "United Arab Emirates Dirham", - "AFN": "Afghan Afghani", - "ALL": "Albanian Lek", - "AMD": "Armenian Dram", - "ANG": "Netherlands Antillean Guilder", - "AOA": "Angolan Kwanza", - "ARS": "Argentine Peso", - "AUD": "Australian Dollar", - "AWG": "Aruban Florin", - "AZN": "Azerbaijani Manat", - "BAM": "Bosnia-Herzegovina Convertible Mark", - "BBD": "Barbadian Dollar", - "BDT": "Bangladeshi Taka", - "BGN": "Bulgarian Lev", - "BHD": "Bahraini Dinar", - "BIF": "Burundian Franc", - "BMD": "Bermudan Dollar", - "BND": "Brunei Dollar", - "BOB": "Bolivian Boliviano", - "BRL": "Brazilian Real", - "BSD": "Bahamian Dollar", - "BTC": "Bitcoin", - "BTN": "Bhutanese Ngultrum", - "BWP": "Botswanan Pula", - "BYN": "Belarusian Ruble", - "BZD": "Belize Dollar", - "CAD": "Canadian Dollar", - "CDF": "Congolese Franc", - "CHF": "Swiss Franc", - "CLF": "Chilean Unit of Account (UF)", - "CLP": "Chilean Peso", - "CNH": "Chinese Yuan (Offshore)", - "CNY": "Chinese Yuan", - "COP": "Colombian Peso", - "CRC": "Costa Rican Colón", - "CUC": "Cuban Convertible Peso", - "CUP": "Cuban Peso", - "CVE": "Cape Verdean Escudo", - "CZK": "Czech Republic Koruna", - "DJF": "Djiboutian Franc", - "DKK": "Danish Krone", - "DOP": "Dominican Peso", - "DZD": "Algerian Dinar", - "EGP": "Egyptian Pound", - "ERN": "Eritrean Nakfa", - "ETB": "Ethiopian Birr", - "EUR": "Euro", - "FJD": "Fijian Dollar", - "FKP": "Falkland Islands Pound", - "GBP": "British Pound Sterling", - "GEL": "Georgian Lari", - "GGP": "Guernsey Pound", - "GHS": "Ghanaian Cedi", - "GIP": "Gibraltar Pound", - "GMD": "Gambian Dalasi", - "GNF": "Guinean Franc", - "GTQ": "Guatemalan Quetzal", - "GYD": "Guyanaese Dollar", - "HKD": "Hong Kong Dollar", - "HNL": "Honduran Lempira", - "HRK": "Croatian Kuna", - "HTG": "Haitian Gourde", - "HUF": "Hungarian Forint", - "IDR": "Indonesian Rupiah", - "ILS": "Israeli New Sheqel", - "IMP": "Manx pound", - "INR": "Indian Rupee", - "IQD": "Iraqi Dinar", - "IRR": "Iranian Rial", - "ISK": "Icelandic Króna", - "JEP": "Jersey Pound", - "JMD": "Jamaican Dollar", - "JOD": "Jordanian Dinar", - "JPY": "Japanese Yen", - "KES": "Kenyan Shilling", - "KGS": "Kyrgystani Som", - "KHR": "Cambodian Riel", - "KMF": "Comorian Franc", - "KPW": "North Korean Won", - "KRW": "South Korean Won", - "KWD": "Kuwaiti Dinar", - "KYD": "Cayman Islands Dollar", - "KZT": "Kazakhstani Tenge", - "LAK": "Laotian Kip", - "LBP": "Lebanese Pound", - "LKR": "Sri Lankan Rupee", - "LRD": "Liberian Dollar", - "LSL": "Lesotho Loti", - "LYD": "Libyan Dinar", - "MAD": "Moroccan Dirham", - "MDL": "Moldovan Leu", - "MGA": "Malagasy Ariary", - "MKD": "Macedonian Denar", - "MMK": "Myanma Kyat", - "MNT": "Mongolian Tugrik", - "MOP": "Macanese Pataca", - "MRU": "Mauritanian Ouguiya", - "MUR": "Mauritian Rupee", - "MVR": "Maldivian Rufiyaa", - "MWK": "Malawian Kwacha", - "MXN": "Mexican Peso", - "MYR": "Malaysian Ringgit", - "MZN": "Mozambican Metical", - "NAD": "Namibian Dollar", - "NGN": "Nigerian Naira", - "NIO": "Nicaraguan Córdoba", - "NOK": "Norwegian Krone", - "NPR": "Nepalese Rupee", - "NZD": "New Zealand Dollar", - "OMR": "Omani Rial", - "PAB": "Panamanian Balboa", - "PEN": "Peruvian Nuevo Sol", - "PGK": "Papua New Guinean Kina", - "PHP": "Philippine Peso", - "PKR": "Pakistani Rupee", - "PLN": "Polish Zloty", - "PYG": "Paraguayan Guarani", - "QAR": "Qatari Rial", - "RON": "Romanian Leu", - "RSD": "Serbian Dinar", - "RUB": "Russian Ruble", - "RWF": "Rwandan Franc", - "SAR": "Saudi Riyal", - "SBD": "Solomon Islands Dollar", - "SCR": "Seychellois Rupee", - "SDG": "Sudanese Pound", - "SEK": "Swedish Krona", - "SGD": "Singapore Dollar", - "SHP": "Saint Helena Pound", - "SLL": "Sierra Leonean Leone", - "SOS": "Somali Shilling", - "SRD": "Surinamese Dollar", - "SSP": "South Sudanese Pound", - "STD": "São Tomé and Príncipe Dobra (pre-2018)", - "STN": "São Tomé and Príncipe Dobra", - "SVC": "Salvadoran Colón", - "SYP": "Syrian Pound", - "SZL": "Swazi Lilangeni", - "THB": "Thai Baht", - "TJS": "Tajikistani Somoni", - "TMT": "Turkmenistani Manat", - "TND": "Tunisian Dinar", - "TOP": "Tongan Pa'anga", - "TRY": "Turkish Lira", - "TTD": "Trinidad and Tobago Dollar", - "TWD": "New Taiwan Dollar", - "TZS": "Tanzanian Shilling", - "UAH": "Ukrainian Hryvnia", - "UGX": "Ugandan Shilling", - "USD": "United States Dollar", - "UYU": "Uruguayan Peso", - "UZS": "Uzbekistan Som", - "VEF": "Venezuelan Bolívar Fuerte (Old)", - "VES": "Venezuelan Bolívar Soberano", - "VND": "Vietnamese Dong", - "VUV": "Vanuatu Vatu", - "WST": "Samoan Tala", - "XAF": "CFA Franc BEAC", - "XAG": "Silver Ounce", - "XAU": "Gold Ounce", - "XCD": "East Caribbean Dollar", - "XDR": "Special Drawing Rights", - "XOF": "CFA Franc BCEAO", - "XPD": "Palladium Ounce", - "XPF": "CFP Franc", - "XPT": "Platinum Ounce", - "YER": "Yemeni Rial", - "ZAR": "South African Rand", - "ZMW": "Zambian Kwacha", - "ZWL": "Zimbabwean Dollar" -} \ No newline at end of file diff --git a/src/shared/openExchange/rates.json b/src/shared/openExchange/rates.json deleted file mode 100644 index dbac770..0000000 --- a/src/shared/openExchange/rates.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "disclaimer": "Usage subject to terms: https://openexchangerates.org/terms", - "license": "https://openexchangerates.org/license", - "timestamp": 1720861211, - "base": "USD", - "rates": { - "AED": 3.67297, - "AFN": 70.829596, - "ALL": 92.094295, - "AMD": 388.376588, - "ANG": 1.799437, - "AOA": 875.5, - "ARS": 918.5853, - "AUD": 1.477978, - "AWG": 1.8015, - "AZN": 1.7, - "BAM": 1.799314, - "BBD": 2, - "BDT": 117.502271, - "BGN": 1.79346, - "BHD": 0.376597, - "BIF": 2874.488982, - "BMD": 1, - "BND": 1.345115, - "BOB": 6.909058, - "BRL": 5.4292, - "BSD": 1, - "BTC": 0.00001724872, - "BTN": 83.39403, - "BWP": 13.466464, - "BYN": 3.266865, - "BZD": 2.012487, - "CAD": 1.36465, - "CDF": 2867.5, - "CHF": 0.895215, - "CLF": 0.03299, - "CLP": 905.89, - "CNH": 7.27771, - "CNY": 7.2504, - "COP": 3963.67177, - "CRC": 521.852449, - "CUC": 1, - "CUP": 25.75, - "CVE": 101.875, - "CZK": 23.2206, - "DJF": 177.5, - "DKK": 6.8409, - "DOP": 59.015517, - "DZD": 134.325493, - "EGP": 47.974539, - "ERN": 15, - "ETB": 57.680635, - "EUR": 0.915625, - "FJD": 2.2208, - "FKP": 0.770475, - "GBP": 0.770475, - "GEL": 2.73, - "GGP": 0.770475, - "GHS": 15.41, - "GIP": 0.770475, - "GMD": 67.75, - "GNF": 8595.1494, - "GTQ": 7.762935, - "GYD": 209.09875, - "HKD": 7.80815, - "HNL": 24.72931, - "HRK": 6.90795, - "HTG": 131.964253, - "HUF": 359.207038, - "IDR": 16114.55, - "ILS": 3.612735, - "IMP": 0.770475, - "INR": 83.518236, - "IQD": 1309.830026, - "IRR": 42087.5, - "ISK": 136.88, - "JEP": 0.770475, - "JMD": 156.537319, - "JOD": 0.7087, - "JPY": 157.845, - "KES": 129, - "KGS": 85.3, - "KHR": 4099.068562, - "KMF": 454.150242, - "KPW": 900, - "KRW": 1375.1, - "KWD": 0.30578, - "KYD": 0.833219, - "KZT": 473.654208, - "LAK": 22138.882931, - "LBP": 89406.331549, - "LKR": 302.451162, - "LRD": 194.695295, - "LSL": 17.960925, - "LYD": 4.842628, - "MAD": 9.81451, - "MDL": 17.642151, - "MGA": 4464.955799, - "MKD": 56.406141, - "MMK": 2203.340001, - "MNT": 3450, - "MOP": 8.040857, - "MRU": 39.72, - "MUR": 46.680002, - "MVR": 15.46, - "MWK": 1731.234794, - "MXN": 17.620801, - "MYR": 4.692, - "MZN": 63.899991, - "NAD": 17.987146, - "NGN": 1406, - "NIO": 36.755033, - "NOK": 10.7223, - "NPR": 133.431752, - "NZD": 1.63372, - "OMR": 0.38496, - "PAB": 1, - "PEN": 3.759996, - "PGK": 3.90654, - "PHP": 58.413497, - "PKR": 277.958449, - "PLN": 3.90027, - "PYG": 7528.009851, - "QAR": 3.64125, - "RON": 4.5572, - "RSD": 107.291, - "RUB": 87.803767, - "RWF": 1308.020546, - "SAR": 3.750791, - "SBD": 8.43942, - "SCR": 13.954, - "SDG": 601, - "SEK": 10.66064, - "SGD": 1.3416, - "SHP": 0.770475, - "SLL": 20969.5, - "SOS": 570.627284, - "SRD": 29.712, - "SSP": 130.26, - "STD": 22281.8, - "STN": 22.75, - "SVC": 8.75023, - "SYP": 2512.53, - "SZL": 17.969617, - "THB": 36.147965, - "TJS": 10.648579, - "TMT": 3.5, - "TND": 3.1275, - "TOP": 2.356469, - "TRY": 33.0504, - "TTD": 6.786944, - "TWD": 32.5333, - "TZS": 2675.731, - "UAH": 40.954957, - "UGX": 3699.224291, - "USD": 1, - "UYU": 40.038192, - "UZS": 12653.245019, - "VES": 36.478534, - "VND": 25416.190524, - "VUV": 118.722, - "WST": 2.8, - "XAF": 600.610733, - "XAG": 0.03247755, - "XAU": 0.00041469, - "XCD": 2.70255, - "XDR": 0.757288, - "XOF": 600.610733, - "XPD": 0.00104003, - "XPF": 109.263146, - "XPT": 0.00099959, - "YER": 250.350066, - "ZAR": 17.95403, - "ZMW": 25.534042, - "ZWL": 322 - } -} \ No newline at end of file