cron-human 1.1.1 → 1.1.2
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/dist/lib.js +7 -2
- package/dist/ui/app.js +3 -2
- package/dist/ui/components/PreviewSection.js +1 -1
- package/package.json +4 -1
package/dist/lib.js
CHANGED
|
@@ -26,10 +26,13 @@ function fieldCount(expr) {
|
|
|
26
26
|
function toJSDate(x) {
|
|
27
27
|
if (x instanceof Date)
|
|
28
28
|
return x;
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
if (x && typeof x.toDate === 'function')
|
|
30
31
|
return x.toDate();
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
33
|
if (x && typeof x.toJSDate === 'function')
|
|
32
34
|
return x.toJSDate();
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
36
|
if (x && typeof x.valueOf === 'function')
|
|
34
37
|
return new Date(x.valueOf());
|
|
35
38
|
const d = new Date(String(x));
|
|
@@ -71,7 +74,8 @@ export function validateCron(expression, options = {}) {
|
|
|
71
74
|
return null;
|
|
72
75
|
}
|
|
73
76
|
catch (err) {
|
|
74
|
-
|
|
77
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
78
|
+
return `Invalid cron expression: ${message}`;
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
export function explainCron(expression) {
|
|
@@ -107,6 +111,7 @@ export function getNextRuns(expression, count, timezone) {
|
|
|
107
111
|
return dates;
|
|
108
112
|
}
|
|
109
113
|
catch (err) {
|
|
110
|
-
|
|
114
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
115
|
+
throw new Error(`Failed to calculate next runs: ${message}`);
|
|
111
116
|
}
|
|
112
117
|
}
|
package/dist/ui/app.js
CHANGED
|
@@ -15,7 +15,7 @@ var FocusArea;
|
|
|
15
15
|
export const App = () => {
|
|
16
16
|
const { exit } = useApp();
|
|
17
17
|
const [expression, setExpression] = useState('');
|
|
18
|
-
const [timezone
|
|
18
|
+
const [timezone] = useState(undefined);
|
|
19
19
|
const [allowSeconds, setAllowSeconds] = useState(false);
|
|
20
20
|
const [focus, setFocus] = useState(FocusArea.Input);
|
|
21
21
|
const [history, setHistory] = useState([]);
|
|
@@ -84,7 +84,8 @@ export const App = () => {
|
|
|
84
84
|
clipboardy.write(history[historyIndex].expression).then(() => {
|
|
85
85
|
setNotification('Copied to clipboard!');
|
|
86
86
|
}).catch((err) => {
|
|
87
|
-
|
|
87
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
88
|
+
setNotification(`Copy failed: ${message}`);
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cron-human",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "A CLI that converts cron expressions to human-readable English and prints next run times",
|
|
5
5
|
"main": "dist/lib.js",
|
|
6
6
|
"types": "dist/lib.d.ts",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"cron-human": "dist/cli.js"
|
|
10
10
|
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=20"
|
|
13
|
+
},
|
|
11
14
|
"scripts": {
|
|
12
15
|
"build": "tsc -p tsconfig.build.json",
|
|
13
16
|
"start": "node dist/cli.js '*/5 * * * *'",
|