@christopher-drifte/clock 1.1.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.
- package/.github/workflows/publish.yml +44 -0
- package/.release-please-manifest.json +1 -0
- package/CHANGELOG.md +23 -0
- package/README.md +41 -0
- package/data/date.json +1 -0
- package/jest.config.js +4 -0
- package/package.json +20 -0
- package/release-please-config.json +9 -0
- package/src/index.js +14 -0
- package/src/utils.js +9 -0
- package/test/index.test.js +7 -0
|
@@ -0,0 +1,44 @@
|
|
|
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 }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"1.1.1"}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.1.1](https://github.com/christopher-drifte/clock/compare/v1.1.0...v1.1.1) (2026-03-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add repository field to package.json for npm provenance ([66d927f](https://github.com/christopher-drifte/clock/commit/66d927f84d1bf0d6d520767541ae19e20d66847e))
|
|
9
|
+
|
|
10
|
+
## [1.1.0](https://github.com/christopher-drifte/clock/compare/v1.0.0...v1.1.0) (2026-03-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add npm version badge to README ([569f764](https://github.com/christopher-drifte/clock/commit/569f764ed07f962f89e7c32eab9733810a32521a))
|
|
16
|
+
|
|
17
|
+
## 1.0.0 (2026-03-12)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* Add GitHub Actions workflow for npm publishing on release ([782eea3](https://github.com/christopher-drifte/clock/commit/782eea34623bb6c26f81f831bcd67870394dc5e9))
|
|
23
|
+
* Add tests, organize project structure, and configure Jest for ES modules ([fdaab87](https://github.com/christopher-drifte/clock/commit/fdaab87384a5b1e9ea64c94c27486b1e56218028))
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Clock
|
|
2
|
+
|
|
3
|
+
A simple module to display today's date while adding the maximum amount of CO2 to the atmosphere.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@christopher-drifte/clock)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @christopher-drifte/clock
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { date } from "@christopher-drifte/clock";
|
|
17
|
+
|
|
18
|
+
// Get today's date
|
|
19
|
+
console.log(date);
|
|
20
|
+
// Output: "Today is 12 March 2026"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## API
|
|
24
|
+
|
|
25
|
+
### `date`
|
|
26
|
+
|
|
27
|
+
A string containing today's date formatted as "Today is [day] [month] [year]" (e.g., "Today is 12 March 2026").
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Install dependencies
|
|
33
|
+
npm install
|
|
34
|
+
|
|
35
|
+
# Run tests
|
|
36
|
+
npm test
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
ISC
|
package/data/date.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "date": "2026-03-12" }
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@christopher-drifte/clock",
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"description": "A simple module to display today's date while adding the maximum amount of CO2 to the atmosphere",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/christopher-drifte/clock.git"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"jest": "^30.3.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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
ADDED