alex-c-line 2.12.1 → 2.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1131,7 +1131,9 @@ function replaceMarkdownPlaceholders(rawContent, templateVariables) {
1131
1131
  let finalContent = content;
1132
1132
  for (const placeholder of placeholders) {
1133
1133
  if (!(placeholder in templateVariables)) throw new _alextheman_utility_v6.DataError({ placeholder }, "INVALID_PLACEHOLDER", "The placeholder found in frontmatter can not be found in the metadata.");
1134
- finalContent = finalContent.replaceAll(`{{${placeholder}}}`, templateVariables[placeholder]);
1134
+ finalContent = finalContent.replaceAll(`{{${placeholder}}}`, () => {
1135
+ return templateVariables[placeholder];
1136
+ });
1135
1137
  }
1136
1138
  return finalContent;
1137
1139
  }
@@ -1485,7 +1487,7 @@ function template(program) {
1485
1487
  //#endregion
1486
1488
  //#region package.json
1487
1489
  var name = "alex-c-line";
1488
- var version$1 = "2.12.1";
1490
+ var version$1 = "2.12.3";
1489
1491
  var description = "Command-line tool with commands to streamline the developer workflow.";
1490
1492
  //#endregion
1491
1493
  //#region src/cli/notifications/updates/checkUpdate.ts
@@ -1753,7 +1755,11 @@ async function sendBirthdayNotification(message) {
1753
1755
  //#region src/cli/notifications/helpers/birthdays.ts
1754
1756
  const birthdays = {
1755
1757
  alex: {
1756
- date: /* @__PURE__ */ new Date("2003-07-16T00:00:00.000Z"),
1758
+ date: Temporal.PlainDate.from({
1759
+ day: 16,
1760
+ month: 7,
1761
+ year: 2003
1762
+ }),
1757
1763
  getMessage: (age) => {
1758
1764
  return _alextheman_utility.normaliseIndents`
1759
1765
  Happy birthday to AlexMan123456, my creator! 🎉
@@ -1762,7 +1768,11 @@ const birthdays = {
1762
1768
  }
1763
1769
  },
1764
1770
  "alex-c-line": {
1765
- date: /* @__PURE__ */ new Date("2025-07-20T00:00:00.000Z"),
1771
+ date: Temporal.PlainDate.from({
1772
+ day: 20,
1773
+ month: 7,
1774
+ year: 2025
1775
+ }),
1766
1776
  getMessage: (age) => {
1767
1777
  return _alextheman_utility.normaliseIndents`
1768
1778
  Happy birthday to me, alex-c-line! 🎉
@@ -1775,18 +1785,21 @@ const birthdays = {
1775
1785
  //#region src/cli/notifications/birthday/maybeSendBirthdayNotification.ts
1776
1786
  async function maybeSendBirthdayNotification() {
1777
1787
  try {
1788
+ if (typeof Temporal === "undefined") return;
1789
+ const currentDate = Temporal.Now.plainDateISO();
1778
1790
  const cacheData = await loadAlexCLineGlobalCache();
1779
- const currentDate = /* @__PURE__ */ new Date();
1780
1791
  for (const [birthdayId, birthdayData] of Object.entries(birthdays)) {
1781
1792
  const cacheKey = `${version$1}_${birthdayId}`;
1782
- const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? new Date(cacheData.birthdayChecks[cacheKey]) : void 0;
1783
- if ((lastChecked === void 0 || lastChecked.getFullYear() !== currentDate.getFullYear()) && (0, _alextheman_utility.isAnniversary)(currentDate, birthdayData.date)) {
1784
- await sendBirthdayNotification(birthdayData.getMessage(currentDate.getFullYear() - birthdayData.date.getFullYear()));
1793
+ const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? Temporal.PlainDate.from(cacheData.birthdayChecks[cacheKey]) : void 0;
1794
+ const thisYearsBirthday = birthdayData.date.with({ year: currentDate.year }, { overflow: "constrain" });
1795
+ const { years: age } = birthdayData.date.until(currentDate, { largestUnit: "years" });
1796
+ if ((lastChecked === void 0 || lastChecked.year !== currentDate.year) && thisYearsBirthday.equals(currentDate)) {
1797
+ await sendBirthdayNotification(birthdayData.getMessage(age));
1785
1798
  await createAlexCLineGlobalCache({
1786
1799
  ...cacheData ?? {},
1787
1800
  birthdayChecks: {
1788
1801
  ...cacheData?.birthdayChecks ?? {},
1789
- [cacheKey]: currentDate.toISOString()
1802
+ [cacheKey]: currentDate.toString()
1790
1803
  }
1791
1804
  });
1792
1805
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import boxen from "boxen";
7
7
  import figlet from "figlet";
8
8
  import envPaths from "env-paths";
9
9
  import path from "node:path";
10
- import { ONE_DAY_IN_MILLISECONDS, VersionNumber, az, escapeHTML, escapeRegexPattern, fillArray, getStringsAndInterpolations, interpolate, isAnniversary, isTemplateStringsArray, kebabToCamel, normaliseIndents, omitProperties, parseBoolean, parseIntStrict, parseVersionType, removeDuplicates, removeUndefinedFromObject, sortBy, stringifyDotenv } from "@alextheman/utility";
10
+ import { ONE_DAY_IN_MILLISECONDS, VersionNumber, az, escapeHTML, escapeRegexPattern, fillArray, getStringsAndInterpolations, interpolate, isTemplateStringsArray, kebabToCamel, normaliseIndents, omitProperties, parseBoolean, parseIntStrict, parseVersionType, removeDuplicates, removeUndefinedFromObject, sortBy, stringifyDotenv } from "@alextheman/utility";
11
11
  import { confirm, input, password, select } from "@inquirer/prompts";
12
12
  import { access, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
13
13
  import { parse } from "dotenv";
@@ -1100,7 +1100,9 @@ function replaceMarkdownPlaceholders(rawContent, templateVariables) {
1100
1100
  let finalContent = content;
1101
1101
  for (const placeholder of placeholders) {
1102
1102
  if (!(placeholder in templateVariables)) throw new DataError({ placeholder }, "INVALID_PLACEHOLDER", "The placeholder found in frontmatter can not be found in the metadata.");
1103
- finalContent = finalContent.replaceAll(`{{${placeholder}}}`, templateVariables[placeholder]);
1103
+ finalContent = finalContent.replaceAll(`{{${placeholder}}}`, () => {
1104
+ return templateVariables[placeholder];
1105
+ });
1104
1106
  }
1105
1107
  return finalContent;
1106
1108
  }
@@ -1454,7 +1456,7 @@ function template(program) {
1454
1456
  //#endregion
1455
1457
  //#region package.json
1456
1458
  var name = "alex-c-line";
1457
- var version$1 = "2.12.1";
1459
+ var version$1 = "2.12.3";
1458
1460
  var description = "Command-line tool with commands to streamline the developer workflow.";
1459
1461
  //#endregion
1460
1462
  //#region src/cli/notifications/updates/checkUpdate.ts
@@ -1722,7 +1724,11 @@ async function sendBirthdayNotification(message) {
1722
1724
  //#region src/cli/notifications/helpers/birthdays.ts
1723
1725
  const birthdays = {
1724
1726
  alex: {
1725
- date: /* @__PURE__ */ new Date("2003-07-16T00:00:00.000Z"),
1727
+ date: Temporal.PlainDate.from({
1728
+ day: 16,
1729
+ month: 7,
1730
+ year: 2003
1731
+ }),
1726
1732
  getMessage: (age) => {
1727
1733
  return normaliseIndents`
1728
1734
  Happy birthday to AlexMan123456, my creator! 🎉
@@ -1731,7 +1737,11 @@ const birthdays = {
1731
1737
  }
1732
1738
  },
1733
1739
  "alex-c-line": {
1734
- date: /* @__PURE__ */ new Date("2025-07-20T00:00:00.000Z"),
1740
+ date: Temporal.PlainDate.from({
1741
+ day: 20,
1742
+ month: 7,
1743
+ year: 2025
1744
+ }),
1735
1745
  getMessage: (age) => {
1736
1746
  return normaliseIndents`
1737
1747
  Happy birthday to me, alex-c-line! 🎉
@@ -1744,18 +1754,21 @@ const birthdays = {
1744
1754
  //#region src/cli/notifications/birthday/maybeSendBirthdayNotification.ts
1745
1755
  async function maybeSendBirthdayNotification() {
1746
1756
  try {
1757
+ if (typeof Temporal === "undefined") return;
1758
+ const currentDate = Temporal.Now.plainDateISO();
1747
1759
  const cacheData = await loadAlexCLineGlobalCache();
1748
- const currentDate = /* @__PURE__ */ new Date();
1749
1760
  for (const [birthdayId, birthdayData] of Object.entries(birthdays)) {
1750
1761
  const cacheKey = `${version$1}_${birthdayId}`;
1751
- const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? new Date(cacheData.birthdayChecks[cacheKey]) : void 0;
1752
- if ((lastChecked === void 0 || lastChecked.getFullYear() !== currentDate.getFullYear()) && isAnniversary(currentDate, birthdayData.date)) {
1753
- await sendBirthdayNotification(birthdayData.getMessage(currentDate.getFullYear() - birthdayData.date.getFullYear()));
1762
+ const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? Temporal.PlainDate.from(cacheData.birthdayChecks[cacheKey]) : void 0;
1763
+ const thisYearsBirthday = birthdayData.date.with({ year: currentDate.year }, { overflow: "constrain" });
1764
+ const { years: age } = birthdayData.date.until(currentDate, { largestUnit: "years" });
1765
+ if ((lastChecked === void 0 || lastChecked.year !== currentDate.year) && thisYearsBirthday.equals(currentDate)) {
1766
+ await sendBirthdayNotification(birthdayData.getMessage(age));
1754
1767
  await createAlexCLineGlobalCache({
1755
1768
  ...cacheData ?? {},
1756
1769
  birthdayChecks: {
1757
1770
  ...cacheData?.birthdayChecks ?? {},
1758
- [cacheKey]: currentDate.toISOString()
1771
+ [cacheKey]: currentDate.toString()
1759
1772
  }
1760
1773
  });
1761
1774
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "2.12.1",
3
+ "version": "2.12.3",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "templates"
35
35
  ],
36
36
  "dependencies": {
37
- "@alextheman/utility": "5.23.1",
37
+ "@alextheman/utility": "5.25.0",
38
38
  "@inquirer/prompts": "8.5.2",
39
39
  "axios": "1.18.1",
40
40
  "boxen": "8.0.1",