Skip to content

Commit 129a108

Browse files
committed
Require Node.js 12.20
1 parent 0617b87 commit 129a108

File tree

7 files changed

+28
-38
lines changed

7 files changed

+28
-38
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.github/workflows/main.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13-
- 14
14-
- 12
15-
- 10
16-
- 8
13+
- 16
1714
steps:
1815
- uses: actions/checkout@v2
19-
- uses: actions/setup-node@v1
16+
- uses: actions/setup-node@v2
2017
with:
2118
node-version: ${{ matrix.node-version }}
2219
- run: npm install

cli.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env node
2-
'use strict';
3-
const meow = require('meow');
4-
const formatter = require('date-fns/format');
5-
const terminalLink = require('terminal-link');
2+
import meow from 'meow';
3+
import {format as formatter} from 'date-fns';
4+
import terminalLink from 'terminal-link';
65

7-
const link = terminalLink('date-fns', 'https://date-fns.org/v1.29.0/docs/format');
6+
const link = terminalLink('date-fns', 'https://date-fns.org/docs/format');
87

98
const cli = meow(`
109
Usage
@@ -16,17 +15,18 @@ const cli = meow(`
1615
Examples
1716
$ date-now
1817
1524733860619
19-
$ date-now --format='DD.MM.YYYY'
20-
26.04.2018
18+
$ date-now --format='dd.MM.yyyy'
19+
11.08.2021
2120
2221
See the ${link} docs for supported formats
2322
`, {
23+
importMeta: import.meta,
2424
flags: {
2525
format: {
2626
type: 'string',
27-
alias: 'f'
28-
}
29-
}
27+
alias: 'f',
28+
},
29+
},
3030
});
3131

3232
const {format} = cli.flags;

license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
"description": "Prints the current date and time as a UNIX timestamp or custom format",
55
"license": "MIT",
66
"repository": "sindresorhus/date-now-cli",
7+
"funding": "https://github.com/sponsors/sindresorhus",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "sindresorhus@gmail.com",
10-
"url": "sindresorhus.com"
11+
"url": "https://sindresorhus.com"
1112
},
13+
"type": "module",
1214
"bin": {
13-
"date-now": "cli.js"
15+
"date-now": "./cli.js"
1416
},
1517
"engines": {
16-
"node": ">=8"
18+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
1719
},
1820
"scripts": {
1921
"test": "xo && ava"
@@ -35,13 +37,13 @@
3537
"moment"
3638
],
3739
"dependencies": {
38-
"date-fns": "^1.29.0",
39-
"meow": "^5.0.0",
40-
"terminal-link": "^1.1.0"
40+
"date-fns": "^2.23.0",
41+
"meow": "^10.1.1",
42+
"terminal-link": "^3.0.0"
4143
},
4244
"devDependencies": {
43-
"ava": "*",
44-
"execa": "^0.10.0",
45-
"xo": "*"
45+
"ava": "^3.15.0",
46+
"execa": "^5.1.1",
47+
"xo": "^0.44.0"
4648
}
4749
}

readme.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
Similar to the `date +%s` command, but cross-platform and prints milliseconds instead of seconds.
66

7-
87
## Install
98

109
```
@@ -17,7 +16,6 @@ Or for a one-time run:
1716
$ npx date-now-cli
1817
```
1918

20-
2119
## Usage
2220

2321
```
@@ -32,18 +30,12 @@ $ date-now --help
3230
Examples
3331
$ date-now
3432
1524733860619
35-
$ date-now --format='DD.MM.YYYY'
36-
26.04.2018
33+
$ date-now --format='dd.MM.yyyy'
34+
11.08.2021
3735
3836
See the date-fns docs for supported formats
3937
```
4038

41-
4239
## Related
4340

4441
- [delay-cli](https://github.com/sindresorhus/delay-cli) - Delay execution for a given amount of seconds
45-
46-
47-
## License
48-
49-
MIT © [Sindre Sorhus](https://sindresorhus.com)

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('main', async t => {
77
});
88

99
test('format option', async t => {
10-
const {stdout} = await execa('./cli.js', ['--format', 'YYYY']);
10+
const {stdout} = await execa('./cli.js', ['--format', 'yyyy']);
1111
const expectedOut = new Date().getFullYear();
1212
t.is(Number(stdout), expectedOut);
1313
});

0 commit comments

Comments
 (0)