alex-c-line 2.12.2 → 2.12.4

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.
@@ -0,0 +1,32 @@
1
+ import { normaliseIndents } from "@alextheman/utility";
2
+ //#region src/cli/notifications/helpers/birthdays.ts
3
+ const birthdays = {
4
+ alex: {
5
+ date: Temporal.PlainDate.from({
6
+ day: 16,
7
+ month: 7,
8
+ year: 2003
9
+ }),
10
+ getMessage: (age) => {
11
+ return normaliseIndents`
12
+ Happy birthday to AlexMan123456, my creator! 🎉
13
+ He has turned ${age} years old today!
14
+ `;
15
+ }
16
+ },
17
+ "alex-c-line": {
18
+ date: Temporal.PlainDate.from({
19
+ day: 20,
20
+ month: 7,
21
+ year: 2025
22
+ }),
23
+ getMessage: (age) => {
24
+ return normaliseIndents`
25
+ Happy birthday to me, alex-c-line! 🎉
26
+ I have turned ${age} years old today!
27
+ `;
28
+ }
29
+ }
30
+ };
31
+ //#endregion
32
+ export { birthdays as default };
@@ -0,0 +1,32 @@
1
+ let _alextheman_utility = require("@alextheman/utility");
2
+ //#region src/cli/notifications/helpers/birthdays.ts
3
+ const birthdays = {
4
+ alex: {
5
+ date: Temporal.PlainDate.from({
6
+ day: 16,
7
+ month: 7,
8
+ year: 2003
9
+ }),
10
+ getMessage: (age) => {
11
+ return _alextheman_utility.normaliseIndents`
12
+ Happy birthday to AlexMan123456, my creator! 🎉
13
+ He has turned ${age} years old today!
14
+ `;
15
+ }
16
+ },
17
+ "alex-c-line": {
18
+ date: Temporal.PlainDate.from({
19
+ day: 20,
20
+ month: 7,
21
+ year: 2025
22
+ }),
23
+ getMessage: (age) => {
24
+ return _alextheman_utility.normaliseIndents`
25
+ Happy birthday to me, alex-c-line! 🎉
26
+ I have turned ${age} years old today!
27
+ `;
28
+ }
29
+ }
30
+ };
31
+ //#endregion
32
+ exports.default = birthdays;
package/dist/index.cjs CHANGED
@@ -1487,7 +1487,7 @@ function template(program) {
1487
1487
  //#endregion
1488
1488
  //#region package.json
1489
1489
  var name = "alex-c-line";
1490
- var version$1 = "2.12.2";
1490
+ var version$1 = "2.12.4";
1491
1491
  var description = "Command-line tool with commands to streamline the developer workflow.";
1492
1492
  //#endregion
1493
1493
  //#region src/cli/notifications/updates/checkUpdate.ts
@@ -1752,43 +1752,25 @@ async function sendBirthdayNotification(message) {
1752
1752
  console.info(messageWithArtwork);
1753
1753
  }
1754
1754
  //#endregion
1755
- //#region src/cli/notifications/helpers/birthdays.ts
1756
- const birthdays = {
1757
- alex: {
1758
- date: /* @__PURE__ */ new Date("2003-07-16T00:00:00.000Z"),
1759
- getMessage: (age) => {
1760
- return _alextheman_utility.normaliseIndents`
1761
- Happy birthday to AlexMan123456, my creator! 🎉
1762
- He has turned ${age} years old today!
1763
- `;
1764
- }
1765
- },
1766
- "alex-c-line": {
1767
- date: /* @__PURE__ */ new Date("2025-07-20T00:00:00.000Z"),
1768
- getMessage: (age) => {
1769
- return _alextheman_utility.normaliseIndents`
1770
- Happy birthday to me, alex-c-line! 🎉
1771
- I have turned ${age} years old today!
1772
- `;
1773
- }
1774
- }
1775
- };
1776
- //#endregion
1777
1755
  //#region src/cli/notifications/birthday/maybeSendBirthdayNotification.ts
1778
1756
  async function maybeSendBirthdayNotification() {
1779
1757
  try {
1758
+ if (typeof Temporal === "undefined") return;
1759
+ const birthdays = (await Promise.resolve().then(() => require("./birthdays-C_y68wAl.cjs"))).default;
1760
+ const currentDate = Temporal.Now.plainDateISO();
1780
1761
  const cacheData = await loadAlexCLineGlobalCache();
1781
- const currentDate = /* @__PURE__ */ new Date();
1782
1762
  for (const [birthdayId, birthdayData] of Object.entries(birthdays)) {
1783
1763
  const cacheKey = `${version$1}_${birthdayId}`;
1784
- const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? new Date(cacheData.birthdayChecks[cacheKey]) : void 0;
1785
- if ((lastChecked === void 0 || lastChecked.getFullYear() !== currentDate.getFullYear()) && (0, _alextheman_utility.isAnniversary)(currentDate, birthdayData.date)) {
1786
- await sendBirthdayNotification(birthdayData.getMessage(currentDate.getFullYear() - birthdayData.date.getFullYear()));
1764
+ const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? Temporal.PlainDate.from(cacheData.birthdayChecks[cacheKey]) : void 0;
1765
+ const thisYearsBirthday = birthdayData.date.with({ year: currentDate.year }, { overflow: "constrain" });
1766
+ const { years: age } = birthdayData.date.until(currentDate, { largestUnit: "years" });
1767
+ if ((lastChecked === void 0 || lastChecked.year !== currentDate.year) && thisYearsBirthday.equals(currentDate)) {
1768
+ await sendBirthdayNotification(birthdayData.getMessage(age));
1787
1769
  await createAlexCLineGlobalCache({
1788
1770
  ...cacheData ?? {},
1789
1771
  birthdayChecks: {
1790
1772
  ...cacheData?.birthdayChecks ?? {},
1791
- [cacheKey]: currentDate.toISOString()
1773
+ [cacheKey]: currentDate.toString()
1792
1774
  }
1793
1775
  });
1794
1776
  }
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";
@@ -1456,7 +1456,7 @@ function template(program) {
1456
1456
  //#endregion
1457
1457
  //#region package.json
1458
1458
  var name = "alex-c-line";
1459
- var version$1 = "2.12.2";
1459
+ var version$1 = "2.12.4";
1460
1460
  var description = "Command-line tool with commands to streamline the developer workflow.";
1461
1461
  //#endregion
1462
1462
  //#region src/cli/notifications/updates/checkUpdate.ts
@@ -1721,43 +1721,25 @@ async function sendBirthdayNotification(message) {
1721
1721
  console.info(messageWithArtwork);
1722
1722
  }
1723
1723
  //#endregion
1724
- //#region src/cli/notifications/helpers/birthdays.ts
1725
- const birthdays = {
1726
- alex: {
1727
- date: /* @__PURE__ */ new Date("2003-07-16T00:00:00.000Z"),
1728
- getMessage: (age) => {
1729
- return normaliseIndents`
1730
- Happy birthday to AlexMan123456, my creator! 🎉
1731
- He has turned ${age} years old today!
1732
- `;
1733
- }
1734
- },
1735
- "alex-c-line": {
1736
- date: /* @__PURE__ */ new Date("2025-07-20T00:00:00.000Z"),
1737
- getMessage: (age) => {
1738
- return normaliseIndents`
1739
- Happy birthday to me, alex-c-line! 🎉
1740
- I have turned ${age} years old today!
1741
- `;
1742
- }
1743
- }
1744
- };
1745
- //#endregion
1746
1724
  //#region src/cli/notifications/birthday/maybeSendBirthdayNotification.ts
1747
1725
  async function maybeSendBirthdayNotification() {
1748
1726
  try {
1727
+ if (typeof Temporal === "undefined") return;
1728
+ const birthdays = (await import("./birthdays-CWQxUfj-.js")).default;
1729
+ const currentDate = Temporal.Now.plainDateISO();
1749
1730
  const cacheData = await loadAlexCLineGlobalCache();
1750
- const currentDate = /* @__PURE__ */ new Date();
1751
1731
  for (const [birthdayId, birthdayData] of Object.entries(birthdays)) {
1752
1732
  const cacheKey = `${version$1}_${birthdayId}`;
1753
- const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? new Date(cacheData.birthdayChecks[cacheKey]) : void 0;
1754
- if ((lastChecked === void 0 || lastChecked.getFullYear() !== currentDate.getFullYear()) && isAnniversary(currentDate, birthdayData.date)) {
1755
- await sendBirthdayNotification(birthdayData.getMessage(currentDate.getFullYear() - birthdayData.date.getFullYear()));
1733
+ const lastChecked = cacheData?.birthdayChecks?.[cacheKey] ? Temporal.PlainDate.from(cacheData.birthdayChecks[cacheKey]) : void 0;
1734
+ const thisYearsBirthday = birthdayData.date.with({ year: currentDate.year }, { overflow: "constrain" });
1735
+ const { years: age } = birthdayData.date.until(currentDate, { largestUnit: "years" });
1736
+ if ((lastChecked === void 0 || lastChecked.year !== currentDate.year) && thisYearsBirthday.equals(currentDate)) {
1737
+ await sendBirthdayNotification(birthdayData.getMessage(age));
1756
1738
  await createAlexCLineGlobalCache({
1757
1739
  ...cacheData ?? {},
1758
1740
  birthdayChecks: {
1759
1741
  ...cacheData?.birthdayChecks ?? {},
1760
- [cacheKey]: currentDate.toISOString()
1742
+ [cacheKey]: currentDate.toString()
1761
1743
  }
1762
1744
  });
1763
1745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "2.12.2",
3
+ "version": "2.12.4",
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",