diff --git a/CHANGELOG.md b/CHANGELOG.md index 07826b0..3f0bb00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -345,7 +345,7 @@ notifier.notify({ sound: 'Morse' }); ### `v3.1.0` -1. Adds Growl as fallback for Mac OS X pre 10.8. +1. Adds Growl as fallback for Mac OS X pre 10.13. ### `v3.0.6` diff --git a/README.md b/README.md index 44885fa..58d8581 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ notifier.notify({ ## Requirements -- **macOS**: >= 10.8 for native notifications, or Growl if earlier. +- **macOS**: >= 10.13 for native notifications, or Growl if earlier. - **Linux**: `notify-osd` or `libnotify-bin` installed (Ubuntu should have this by default) - **Windows**: >= 8, or task bar balloons for Windows < 8. Growl as fallback. Growl takes precedence over Windows balloons. - **General Fallback**: Growl @@ -134,7 +134,7 @@ new nn.Growl(options).notify(options); Same usage and parameter setup as [**`terminal-notifier`**](https://github.com/julienXX/terminal-notifier). -Native Notification Center requires macOS version 10.8 or higher. If you have +Native Notification Center requires macOS version 10.13 or higher. If you have an earlier version, Growl will be the fallback. If Growl isn't installed, an error will be returned in the callback. @@ -158,7 +158,7 @@ but they aren't documented. const NotificationCenter = require('node-notifier').NotificationCenter; var notifier = new NotificationCenter({ - withFallback: false, // Use Growl Fallback if <= 10.8 + withFallback: false, // Use Growl Fallback if <= 10.13 customPath: undefined // Relative/Absolute path to binary if you want to use your own fork of terminal-notifier }); diff --git a/lib/utils.js b/lib/utils.js index fe4b164..b0fd1fd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -56,14 +56,13 @@ module.exports.command = function (notifier, options, cb) { console.info('[notifier options]', options.join(' ')); } - return cp.exec(notifier + ' ' + options.join(' '), function ( - error, - stdout, - stderr - ) { - if (error) return cb(error); - cb(stderr, stdout); - }); + return cp.exec( + notifier + ' ' + options.join(' '), + function (error, stdout, stderr) { + if (error) return cb(error); + cb(stderr, stdout); + } + ); }; module.exports.fileCommand = function (notifier, options, cb) { @@ -507,10 +506,10 @@ module.exports.isMac = function () { return os.type() === 'Darwin'; }; -module.exports.isMountainLion = function () { +module.exports.isHighSierraOrLater = function () { return ( os.type() === 'Darwin' && - semver.satisfies(garanteeSemverFormat(os.release()), '>=12.0.0') + semver.satisfies(garanteeSemverFormat(os.release()), '>=17.0.0') ); }; diff --git a/notifiers/notificationcenter.js b/notifiers/notificationcenter.js index 966997b..c0b6e18 100644 --- a/notifiers/notificationcenter.js +++ b/notifiers/notificationcenter.js @@ -13,7 +13,7 @@ const EventEmitter = require('events').EventEmitter; const util = require('util'); const errorMessageOsX = - 'You need Mac OS X 10.8 or above to use NotificationCenter,' + + 'You need Mac OS X 10.13 or above to use NotificationCenter,' + ' or use Growl fallback with constructor option {withFallback: true}.'; module.exports = NotificationCenter; @@ -53,7 +53,7 @@ function notifyRaw(options, callback) { this, options, callback, - function(data) { + function (data) { if (activeId !== id) return false; if (data === 'activate') { @@ -77,7 +77,7 @@ function notifyRaw(options, callback) { } const argsList = utils.constructArgumentList(options); - if (utils.isMountainLion()) { + if (utils.isHighSierraOrLater()) { utils.fileCommandJson( this.options.customPath || notifier, argsList, @@ -96,7 +96,7 @@ function notifyRaw(options, callback) { } Object.defineProperty(NotificationCenter.prototype, 'notify', { - get: function() { + get: function () { if (!this._notify) this._notify = notifyRaw.bind(this); return this._notify; } diff --git a/package.json b/package.json index 8e097be..ed424a4 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "keywords": [ "notification center", - "mac os x 10.8", + "mac os x 10.13", "notify", "terminal-notifier", "notify-send", diff --git a/test/terminal-notifier.js b/test/terminal-notifier.js index fa8325b..e9273fe 100644 --- a/test/terminal-notifier.js +++ b/test/terminal-notifier.js @@ -8,20 +8,20 @@ const testUtils = require('./_test-utils'); let notifier = null; const originalUtils = utils.fileCommandJson; -const originalMacVersion = utils.isMountainLion; +const originalMacVersion = utils.isHighSierraOrLater; const originalType = os.type; describe('Mac fallback', function () { - const original = utils.isMountainLion; + const original = utils.isHighSierraOrLater; const originalMac = utils.isMac; afterEach(function () { - utils.isMountainLion = original; + utils.isHighSierraOrLater = original; utils.isMac = originalMac; }); - it('should default to Growl notification if older Mac OSX than 10.8', function (done) { - utils.isMountainLion = function () { + it('should default to Growl notification if older Mac OSX than 10.13', function (done) { + utils.isHighSierraOrLater = function () { return false; }; utils.isMac = function () { @@ -35,7 +35,7 @@ describe('Mac fallback', function () { }); it('should not fallback to Growl notification if withFallback is false', function (done) { - utils.isMountainLion = function () { + utils.isHighSierraOrLater = function () { return false; }; utils.isMac = function () { @@ -56,7 +56,7 @@ describe('terminal-notifier', function () { return 'Darwin'; }; - utils.isMountainLion = function () { + utils.isHighSierraOrLater = function () { return true; }; }); @@ -67,7 +67,7 @@ describe('terminal-notifier', function () { afterEach(function () { os.type = originalType; - utils.isMountainLion = originalMacVersion; + utils.isHighSierraOrLater = originalMacVersion; }); // Simulate async operation, move to end of message queue. diff --git a/vendor/mac.noindex/terminal-notifier.app/Contents/CodeResources b/vendor/mac.noindex/terminal-notifier.app/Contents/CodeResources new file mode 100644 index 0000000..a2e24b3 Binary files /dev/null and b/vendor/mac.noindex/terminal-notifier.app/Contents/CodeResources differ diff --git a/vendor/mac.noindex/terminal-notifier.app/Contents/Info.plist b/vendor/mac.noindex/terminal-notifier.app/Contents/Info.plist index 9e6ad8f..26715bd 100644 --- a/vendor/mac.noindex/terminal-notifier.app/Contents/Info.plist +++ b/vendor/mac.noindex/terminal-notifier.app/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 16E195 + 23E224 CFBundleDevelopmentRegion en CFBundleExecutable @@ -31,19 +31,21 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8B62 + + DTPlatformName + macosx DTPlatformVersion - GM + 14.4 DTSDKBuild - 16B2649 + 23E208 DTSDKName - macosx10.12 + macosx14.4 DTXcode - 0810 + 1530 DTXcodeBuild - 8B62 + 15E204a LSMinimumSystemVersion - 10.8 + 10.13 LSUIElement NSAppTransportSecurity diff --git a/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier b/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier index dc1127a..65df3c1 100755 Binary files a/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier and b/vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier differ diff --git a/vendor/mac.noindex/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib b/vendor/mac.noindex/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib index b19d0fc..b3cbbd8 100644 Binary files a/vendor/mac.noindex/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib and b/vendor/mac.noindex/terminal-notifier.app/Contents/Resources/en.lproj/MainMenu.nib differ diff --git a/vendor/mac.noindex/terminal-notifier.app/Contents/_CodeSignature/CodeResources b/vendor/mac.noindex/terminal-notifier.app/Contents/_CodeSignature/CodeResources new file mode 100644 index 0000000..fe9fcdc --- /dev/null +++ b/vendor/mac.noindex/terminal-notifier.app/Contents/_CodeSignature/CodeResources @@ -0,0 +1,182 @@ + + + + + files + + Resources/Terminal.icns + + Oq9GtJM1DqcGF1JCHiEgb0hoN6I= + + Resources/en.lproj/Credits.rtf + + hash + + YKJIFIsxneJuNkJNJQIcJIjiPOg= + + optional + + + Resources/en.lproj/InfoPlist.strings + + hash + + MiLKDDnrUKr4EmuvhS5VQwxHGK8= + + optional + + + Resources/en.lproj/MainMenu.nib + + hash + + ks63ht6nCtcvf9VjUbrnRAck+t8= + + optional + + + + files2 + + Resources/Terminal.icns + + hash2 + + zPwPRX277SsWSp9wjhoAAPrY+Jaw1TMrN24rdI8/9SU= + + + Resources/en.lproj/Credits.rtf + + hash2 + + tDhv4c72XNkebI7MBl0RcIkIP5G3ytvww+Xq4g6LlkA= + + optional + + + Resources/en.lproj/InfoPlist.strings + + hash2 + + Oc8u4Ht7Mz58F50L9NeYpbcq9qTlhPUeZCcDu/pPyCg= + + optional + + + Resources/en.lproj/MainMenu.nib + + hash2 + + T28xZ3pEIF+z1AwdptRqPpSBbjWA+HVFDrMmTQ6sosQ= + + optional + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + +