@togatherlabs/shared-utils 1.0.1 → 1.0.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.
@@ -1,3 +1,3 @@
1
- import type { UserConfig } from '@commitlint/types';
1
+ import type { UserConfig } from "@commitlint/types";
2
2
  declare const config: UserConfig;
3
3
  export default config;
@@ -1,89 +1,89 @@
1
1
  // This config follows the project guidelines
2
2
  // (https://docs.google.com/document/d/1psbMtN-PIF4oBbNc_pW_mtDPPAa_yPdV_apf-wq5spM/edit?tab=t.0)
3
3
  const config = {
4
- extends: ['@commitlint/config-conventional'],
4
+ extends: ["@commitlint/config-conventional"],
5
5
  rules: {
6
- 'scope-empty': [2, 'never'],
7
- 'scope-max-length': [2, 'always', 20],
6
+ "scope-empty": [2, "never"],
7
+ "scope-max-length": [2, "always", 20],
8
8
  // Subject rules
9
- 'subject-max-length': [2, 'always', 50],
10
- 'subject-case': [2, 'always', 'sentence-case'],
11
- 'subject-full-stop': [2, 'never', '.'],
9
+ "subject-max-length": [2, "always", 50],
10
+ "subject-case": [2, "always", "sentence-case"],
11
+ "subject-full-stop": [2, "never", "."],
12
12
  // Body rules
13
- 'body-empty': [0],
14
- 'body-max-line-length': [2, 'always', 72],
13
+ "body-empty": [0],
14
+ "body-max-line-length": [2, "always", 72],
15
15
  // Footer (optional)
16
- 'footer-max-line-length': [2, 'always', 72],
16
+ "footer-max-line-length": [2, "always", 72],
17
17
  },
18
18
  prompt: {
19
19
  settings: {
20
20
  enableMultipleScopes: false,
21
21
  },
22
22
  messages: {
23
- skip: ':skip (press enter to skip)',
24
- max: 'Max %d characters',
25
- min: 'Min %d characters',
26
- emptyWarning: 'This field cannot be empty',
27
- upperLimitWarning: 'Character limit exceeded',
28
- lowerLimitWarning: 'Too few characters',
23
+ skip: ":skip (press enter to skip)",
24
+ max: "Max %d characters",
25
+ min: "Min %d characters",
26
+ emptyWarning: "This field cannot be empty",
27
+ upperLimitWarning: "Character limit exceeded",
28
+ lowerLimitWarning: "Too few characters",
29
29
  },
30
30
  questions: {
31
31
  type: {
32
32
  description: "Select the type of change you're committing:",
33
33
  enum: {
34
34
  feat: {
35
- description: '✨ A new feature',
36
- title: 'Feature',
37
- emoji: '',
35
+ description: "✨ A new feature",
36
+ title: "Feature",
37
+ emoji: "",
38
38
  },
39
39
  fix: {
40
- description: '🐛 A bug fix',
41
- title: 'Bug Fix',
42
- emoji: '🐛',
40
+ description: "🐛 A bug fix",
41
+ title: "Bug Fix",
42
+ emoji: "🐛",
43
43
  },
44
44
  docs: {
45
- description: '📚 Documentation only changes',
46
- title: 'Documentation',
47
- emoji: '📚',
45
+ description: "📚 Documentation only changes",
46
+ title: "Documentation",
47
+ emoji: "📚",
48
48
  },
49
49
  style: {
50
- description: '💅 Changes that do not affect code meaning (formatting, etc.)',
51
- title: 'Style',
52
- emoji: '💅',
50
+ description: "💅 Changes that do not affect code meaning (formatting, etc.)",
51
+ title: "Style",
52
+ emoji: "💅",
53
53
  },
54
54
  refactor: {
55
- description: '🔧 Code change that neither fixes a bug nor adds a feature',
56
- title: 'Refactor',
57
- emoji: '🔧',
55
+ description: "🔧 Code change that neither fixes a bug nor adds a feature",
56
+ title: "Refactor",
57
+ emoji: "🔧",
58
58
  },
59
59
  test: {
60
- description: '✅ Adding or updating tests',
61
- title: 'Test',
62
- emoji: '',
60
+ description: "✅ Adding or updating tests",
61
+ title: "Test",
62
+ emoji: "",
63
63
  },
64
64
  chore: {
65
- description: '🛠 Maintenance tasks (e.g., tooling, dependencies)',
66
- title: 'Chore',
67
- emoji: '🛠',
65
+ description: "🛠 Maintenance tasks (e.g., tooling, dependencies)",
66
+ title: "Chore",
67
+ emoji: "🛠",
68
68
  },
69
- perf: { description: '⚡ Performance improvement', title: 'Performance', emoji: '' },
69
+ perf: { description: "⚡ Performance improvement", title: "Performance", emoji: "" },
70
70
  build: {
71
- description: '🏗 Build system or dependency changes',
72
- title: 'Build',
73
- emoji: '🏗',
71
+ description: "🏗 Build system or dependency changes",
72
+ title: "Build",
73
+ emoji: "🏗",
74
74
  },
75
- ci: { description: '🔁 CI/CD configuration', title: 'CI', emoji: '🔁' },
76
- revert: { description: '⏪ Reverts a previous commit', title: 'Revert', emoji: '' },
75
+ ci: { description: "🔁 CI/CD configuration", title: "CI", emoji: "🔁" },
76
+ revert: { description: "⏪ Reverts a previous commit", title: "Revert", emoji: "" },
77
77
  },
78
78
  },
79
79
  scope: {
80
- description: 'Scope of this change (e.g., auth, ui, api)',
80
+ description: "Scope of this change (e.g., auth, ui, api)",
81
81
  },
82
82
  subject: {
83
- description: 'Write a short, imperative description (max 50 chars, e.g., Add login validation)',
83
+ description: "Write a short, imperative description (max 50 chars, e.g., Add login validation)",
84
84
  },
85
85
  body: {
86
- description: 'Provide a detailed description of what changed, why, and how (optional)',
86
+ description: "Provide a detailed description of what changed, why, and how (optional)",
87
87
  },
88
88
  },
89
89
  },
@@ -1 +1 @@
1
- export * from './sample';
1
+ export * from "./sample";
@@ -1 +1 @@
1
- export * from './sample';
1
+ export * from "./sample";
@@ -1,3 +1,3 @@
1
1
  export const SAMPLE = {
2
- Char: 'A'
2
+ Char: "A",
3
3
  };
@@ -1,10 +1,10 @@
1
- export function formatDate(date, locale = 'en-IN') {
2
- if (!(date instanceof Date) || isNaN(date.getTime())) {
3
- throw new Error('Invalid Date');
1
+ export function formatDate(date, locale = "en-IN") {
2
+ if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
3
+ throw new Error("Invalid Date");
4
4
  }
5
5
  return date.toLocaleDateString(locale, {
6
- year: 'numeric',
7
- month: 'short',
8
- day: 'numeric',
6
+ year: "numeric",
7
+ month: "short",
8
+ day: "numeric",
9
9
  });
10
10
  }
@@ -1 +1 @@
1
- export * from './formatDate';
1
+ export * from "./formatDate";
@@ -1 +1 @@
1
- export * from './formatDate';
1
+ export * from "./formatDate";
@@ -1,3 +1,3 @@
1
- export * from './helpers';
2
- export * from './constants';
3
- export * from './types';
1
+ export * from "./constants";
2
+ export * from "./helpers";
3
+ export * from "./types";
package/dist/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './helpers';
2
- export * from './constants';
3
- export * from './types';
1
+ export * from "./constants";
2
+ export * from "./helpers";
3
+ export * from "./types";
@@ -1 +1 @@
1
- export * from './user';
1
+ export * from "./user";
@@ -1 +1 @@
1
- export * from './user';
1
+ export * from "./user";
@@ -1,7 +1,7 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as constants from '../../../src/constants/sample';
3
- describe('sample constants', () => {
4
- it('should export constants correctly', () => {
1
+ import { describe, expect, it } from "vitest";
2
+ import * as constants from "../../../src/constants/sample";
3
+ describe("sample constants", () => {
4
+ it("should export constants correctly", () => {
5
5
  expect(constants).toBeDefined();
6
6
  });
7
7
  });
@@ -1,18 +1,18 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { formatDate } from '../../../src/helpers/formatDate';
3
- describe('formatDate helper', () => {
4
- it('should format a valid date correctly', () => {
5
- const date = new Date('2025-10-14T00:00:00Z');
1
+ import { describe, expect, it } from "vitest";
2
+ import { formatDate } from "../../../src/helpers/formatDate";
3
+ describe("formatDate helper", () => {
4
+ it("should format a valid date correctly", () => {
5
+ const date = new Date("2025-10-14T00:00:00Z");
6
6
  const formatted = formatDate(date);
7
- expect(formatted).toBe('14 Oct 2025');
7
+ expect(formatted).toBe("14 Oct 2025");
8
8
  });
9
- it('should format date in custom locale', () => {
10
- const date = new Date('2025-10-14T00:00:00Z');
11
- const formatted = formatDate(date, 'en-US');
9
+ it("should format date in custom locale", () => {
10
+ const date = new Date("2025-10-14T00:00:00Z");
11
+ const formatted = formatDate(date, "en-US");
12
12
  expect(formatted).toMatch(/Oct/);
13
13
  });
14
- it('should throw an error for invalid date', () => {
14
+ it("should throw an error for invalid date", () => {
15
15
  // @ts-expect-error testing invalid date
16
- expect(() => formatDate('not-a-date')).toThrowError('Invalid Date');
16
+ expect(() => formatDate("not-a-date")).toThrowError("Invalid Date");
17
17
  });
18
18
  });
@@ -1,7 +1,7 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as utils from '../../src';
3
- describe('index.ts', () => {
4
- it('should export all modules correctly', () => {
1
+ import { describe, expect, it } from "vitest";
2
+ import * as utils from "../../src";
3
+ describe("index.ts", () => {
4
+ it("should export all modules correctly", () => {
5
5
  expect(utils).toBeDefined();
6
6
  expect(utils.formatDate).toBeInstanceOf(Function); // Example for a helper
7
7
  });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@togatherlabs/shared-utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Shared utility functions, constants, and types for ToGather microservices",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
8
  "files": [
9
9
  "dist"
10
10
  ],