Skip to content

Commit 76247c2

Browse files
committed
Updated to use proper JSON module import syntax from node.js v18+ (https://nodejs.org/docs/latest-v18.x/api/esm.html#json-modules), plus minor code clean-up
1 parent 66da194 commit 76247c2

7 files changed

Lines changed: 13 additions & 16 deletions

File tree

.github/workflows/test-linux-and-macos.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
os: [ubuntu-latest, macOS-latest]
18-
node: [10, 12, 14, 16, 18, 20]
19-
exclude:
20-
- os: macOS-latest
21-
node: 16
18+
node: [18, 20, 22]
2219

2320
steps:
2421
- name: Checkout repository

.github/workflows/test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: windows-latest
1414
strategy:
1515
matrix:
16-
node: [16, 18, 20]
16+
node: [18, 20, 22]
1717

1818
steps:
1919
- name: Checkout repository

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# disk-space-monitor
22
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-yellow)](https://raw.githubusercontent.com/blu3mania/disk-space-monitor/main/LICENSE)
3-
[![node.js 10+](https://img.shields.io/badge/node.js-10.16.3-blue?logo=node.js)](https://nodejs.org/en/)
3+
[![node.js 18+](https://img.shields.io/badge/node.js-18.0.0-blue?logo=node.js)](https://nodejs.org/en/)
44
[![Latest Release](https://img.shields.io/github/v/release/blu3mania/disk-space-monitor)](https://github.com/blu3mania/disk-space-monitor/releases/latest)
55

66
Monitor disk space usage and notify user by email or system notification.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
"url": "https://github.com/blu3mania/disk-space-monitor.git"
2626
},
2727
"dependencies": {
28-
"chalk": "^5.0.1",
29-
"diskusage": "^1.1.3",
28+
"chalk": "^5.3.0",
29+
"diskusage": "^1.2.0",
3030
"node-notifier": "^10.0.1",
31-
"nodemailer": "^6.7.8"
31+
"node-windows": "^1.0.0-beta.8",
32+
"nodemailer": "^6.9.13",
33+
"npm-platform-dependencies": "^0.1.0"
3234
},
3335
"win32Dependencies": {
3436
"node-windows": "^1.0.0-beta.8"
@@ -38,6 +40,5 @@
3840
},
3941
"linuxDependencies": {
4042
"node-linux": "^0.1.12"
41-
},
42-
"devDependencies": {}
43+
}
4344
}

src/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
warning,
1212
info,
1313
verbose } from './print.js';
14-
import settings from './settings.json' assert {type: 'json'};
14+
import settings from './settings.json' with {type: 'json'};
1515

1616
const NotificationType = {
1717
Email: 'email',
@@ -152,12 +152,11 @@ function checkDiskFreeSpace(disk, diskInfo) {
152152
if (diskInfo.free < disk.thresholdInBytes) {
153153
if (!disk.notificationTriggered) {
154154
disk.notificationTriggered = true;
155+
warning(replaceMacro('Free space on disk {DISK} has dropped under {THRESHOLD}!', disk, diskInfo));
155156
if (settings.notificationTypes.find(type => type.toLowerCase() === NotificationType.Email)) {
156-
warning(replaceMacro('Free space on disk {DISK} has dropped under {THRESHOLD}! Sending email notification...', disk, diskInfo));
157157
sendEmailNotification(disk, diskInfo);
158158
}
159159
if (settings.notificationTypes.find(type => type.toLowerCase() === NotificationType.Desktop)) {
160-
warning(replaceMacro('Free space on disk {DISK} has dropped under {THRESHOLD}! Showing desktop notification...', disk, diskInfo));
161160
sendDesktopNotification(disk, diskInfo);
162161
}
163162
}

src/install-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
warning,
66
info,
77
verbose } from './print.js';
8-
import settings from './settings.json' assert {type: 'json'};
8+
import settings from './settings.json' with {type: 'json'};
99

1010
main();
1111

src/uninstall-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import url from 'url';
44
import {
55
info,
66
verbose } from './print.js';
7-
import settings from './settings.json' assert {type: 'json'};
7+
import settings from './settings.json' with {type: 'json'};
88

99
main();
1010

0 commit comments

Comments
 (0)