@dana180597/date-time-logger 1.0.0
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 +42 -0
- package/.npmrc.bak +1 -0
- package/README.md +37 -0
- package/index.js +17 -0
- package/package.json +16 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
# Every Monday at 9:00 AM UTC
|
|
6
|
+
- cron: '0 9 * * 1'
|
|
7
|
+
workflow_dispatch: # Allow manual trigger
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout repository
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '18'
|
|
23
|
+
registry-url: 'https://registry.npmjs.org'
|
|
24
|
+
|
|
25
|
+
- name: Configure git
|
|
26
|
+
run: |
|
|
27
|
+
git config user.name "github-actions[bot]"
|
|
28
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
29
|
+
|
|
30
|
+
- name: Bump patch version
|
|
31
|
+
run: |
|
|
32
|
+
npm version patch -m "Bump version to %s"
|
|
33
|
+
|
|
34
|
+
- name: Push version bump
|
|
35
|
+
run: |
|
|
36
|
+
git push
|
|
37
|
+
git push --tags
|
|
38
|
+
|
|
39
|
+
- name: Publish to npm
|
|
40
|
+
run: npm publish --access public
|
|
41
|
+
env:
|
|
42
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.npmrc.bak
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# date-time-logger
|
|
2
|
+
|
|
3
|
+
A simple date/time utility for Node.js.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install date-time-logger
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const { now, ping } = require('date-time-logger');
|
|
15
|
+
|
|
16
|
+
// Get the current ISO timestamp
|
|
17
|
+
console.log(now());
|
|
18
|
+
// Output: "2024-01-15T10:30:00.000Z"
|
|
19
|
+
|
|
20
|
+
// Simple ping/pong
|
|
21
|
+
console.log(ping());
|
|
22
|
+
// Output: "pong"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
### `now()`
|
|
28
|
+
|
|
29
|
+
Returns the current date and time as an ISO 8601 timestamp string.
|
|
30
|
+
|
|
31
|
+
### `ping()`
|
|
32
|
+
|
|
33
|
+
Returns the string `"pong"`.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the current date and time as an ISO 8601 timestamp string.
|
|
3
|
+
* @returns {string} The current ISO timestamp
|
|
4
|
+
*/
|
|
5
|
+
function now() {
|
|
6
|
+
return new Date().toISOString();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A simple ping function.
|
|
11
|
+
* @returns {string} Returns "pong"
|
|
12
|
+
*/
|
|
13
|
+
function ping() {
|
|
14
|
+
return "pong";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = { now, ping };
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dana180597/date-time-logger",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A simple date/time utility",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"date",
|
|
9
|
+
"time",
|
|
10
|
+
"utility"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/danapriman/date-time-logger.git"
|
|
15
|
+
}
|
|
16
|
+
}
|