@christopher-drifte/clock 1.2.0 → 1.3.1

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,2 @@
1
+ export declare const date: string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI,QAA4B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { formatDate } from "./utils.js";
2
+ import dateData from "../data/date.json" with { type: "json" };
3
+ export const date = formatDate(dateData.date);
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,QAAQ,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const formatDate: (date: string | Date) => string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,GAAG,IAAI,KAAG,MAMhD,CAAC"}
package/dist/utils.js ADDED
@@ -0,0 +1,10 @@
1
+ // Internal utility function for formatting dates
2
+ // Not part of the public API
3
+ export const formatDate = (date) => {
4
+ return `Today is ${new Date(date).toLocaleDateString("en-GB", {
5
+ day: "numeric",
6
+ month: "long",
7
+ year: "numeric",
8
+ })}`;
9
+ };
10
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAmB,EAAU,EAAE;IACxD,OAAO,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC5D,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,SAAS;KAChB,CAAC,EAAE,CAAC;AACP,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@christopher-drifte/clock",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
- "main": "src/index.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "data"
10
+ ],
6
11
  "scripts": {
7
- "test": "NODE_OPTIONS=--experimental-vm-modules jest"
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build",
14
+ "test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest"
8
15
  },
9
16
  "keywords": [],
10
17
  "author": "",
@@ -15,6 +22,10 @@
15
22
  "url": "https://github.com/christopher-drifte/clock.git"
16
23
  },
17
24
  "devDependencies": {
18
- "jest": "^30.3.0"
25
+ "@types/jest": "^30.0.0",
26
+ "@types/node": "^25.5.0",
27
+ "jest": "^30.3.0",
28
+ "ts-jest": "^29.4.6",
29
+ "typescript": "^5.9.3"
19
30
  }
20
31
  }
@@ -1,44 +0,0 @@
1
- name: Release Please
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- permissions:
9
- contents: write
10
- pull-requests: write
11
- id-token: write
12
-
13
- jobs:
14
- release-please:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: googleapis/release-please-action@v4
18
- id: release
19
- with:
20
- release-type: node
21
-
22
- # Publish to npm only when a release is created
23
- - uses: actions/checkout@v4
24
- if: ${{ steps.release.outputs.release_created }}
25
-
26
- - uses: actions/setup-node@v4
27
- if: ${{ steps.release.outputs.release_created }}
28
- with:
29
- node-version: "20"
30
- registry-url: "https://registry.npmjs.org"
31
-
32
- - name: Install dependencies
33
- if: ${{ steps.release.outputs.release_created }}
34
- run: npm ci
35
-
36
- - name: Run tests
37
- if: ${{ steps.release.outputs.release_created }}
38
- run: npm test
39
-
40
- - name: Publish to npm
41
- if: ${{ steps.release.outputs.release_created }}
42
- run: npm publish --provenance --access public
43
- env:
44
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1 +0,0 @@
1
- {".":"1.2.0"}
package/CHANGELOG.md DELETED
@@ -1,30 +0,0 @@
1
- # Changelog
2
-
3
- ## [1.2.0](https://github.com/christopher-drifte/clock/compare/v1.1.1...v1.2.0) (2026-03-12)
4
-
5
-
6
- ### Features
7
-
8
- * Update date to 2026-03-12T11:48:04.770+01:00 ([3a83094](https://github.com/christopher-drifte/clock/commit/3a8309417a78f2e50d4c5788ea01d68591f735b4))
9
-
10
- ## [1.1.1](https://github.com/christopher-drifte/clock/compare/v1.1.0...v1.1.1) (2026-03-12)
11
-
12
-
13
- ### Bug Fixes
14
-
15
- * add repository field to package.json for npm provenance ([66d927f](https://github.com/christopher-drifte/clock/commit/66d927f84d1bf0d6d520767541ae19e20d66847e))
16
-
17
- ## [1.1.0](https://github.com/christopher-drifte/clock/compare/v1.0.0...v1.1.0) (2026-03-12)
18
-
19
-
20
- ### Features
21
-
22
- * add npm version badge to README ([569f764](https://github.com/christopher-drifte/clock/commit/569f764ed07f962f89e7c32eab9733810a32521a))
23
-
24
- ## 1.0.0 (2026-03-12)
25
-
26
-
27
- ### Features
28
-
29
- * Add GitHub Actions workflow for npm publishing on release ([782eea3](https://github.com/christopher-drifte/clock/commit/782eea34623bb6c26f81f831bcd67870394dc5e9))
30
- * Add tests, organize project structure, and configure Jest for ES modules ([fdaab87](https://github.com/christopher-drifte/clock/commit/fdaab87384a5b1e9ea64c94c27486b1e56218028))
package/jest.config.js DELETED
@@ -1,4 +0,0 @@
1
- export default {
2
- testEnvironment: "node",
3
- transform: {},
4
- };
@@ -1,9 +0,0 @@
1
- {
2
- "release-type": "node",
3
- "packages": {
4
- ".": {
5
- "release-type": "node",
6
- "package-name": "@christopher-drifte/clock"
7
- }
8
- }
9
- }
package/src/index.js DELETED
@@ -1,14 +0,0 @@
1
- import { dirname, join } from "path";
2
-
3
- import { fileURLToPath } from "url";
4
- import { formatDate } from "./utils.js";
5
- import { readFileSync } from "fs";
6
-
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- const json = JSON.parse(
11
- readFileSync(join(__dirname, "..", "data", "date.json"), "utf8")
12
- );
13
-
14
- export const date = formatDate(json.date);
package/src/utils.js DELETED
@@ -1,9 +0,0 @@
1
- // Internal utility function for formatting dates
2
- // Not part of the public API
3
- export const formatDate = (date) => {
4
- return `Today is ${new Date(date).toLocaleDateString("en-GB", {
5
- day: "numeric",
6
- month: "long",
7
- year: "numeric",
8
- })}`;
9
- };
@@ -1,7 +0,0 @@
1
- import { date } from "../src/index.js";
2
- import { formatDate } from "../src/utils.js";
3
-
4
- test("date export matches today's date", () => {
5
- const today = formatDate(new Date());
6
- expect(date).toBe(today);
7
- });