run-applescript
Advanced tools
Comparing version 3.0.0 to 3.1.0
14
index.js
'use strict'; | ||
const execa = require('execa'); | ||
module.exports = str => { | ||
module.exports = script => { | ||
if (process.platform !== 'darwin') { | ||
return Promise.reject(new Error('Only OS X is supported')); | ||
return Promise.reject(new Error('macOS only')); | ||
} | ||
return execa.stdout('osascript', ['-e', str]); | ||
return execa.stdout('osascript', ['-e', script]); | ||
}; | ||
module.exports.sync = script => { | ||
if (process.platform !== 'darwin') { | ||
throw new Error('macOS only'); | ||
} | ||
return execa.sync('osascript', ['-e', script]).stdout; | ||
}; |
{ | ||
"name": "run-applescript", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Run AppleScript and get the result", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
"keywords": [ | ||
"osx", | ||
"macos", | ||
"mac", | ||
@@ -31,3 +31,3 @@ "applescript", | ||
"dependencies": { | ||
"execa": "^0.4.0" | ||
"execa": "^0.8.0" | ||
}, | ||
@@ -37,6 +37,3 @@ "devDependencies": { | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
@@ -9,3 +9,3 @@ # run-applescript [![Build Status](https://travis-ci.org/sindresorhus/run-applescript.svg?branch=master)](https://travis-ci.org/sindresorhus/run-applescript) | ||
``` | ||
$ npm install --save run-applescript | ||
$ npm install run-applescript | ||
``` | ||
@@ -19,11 +19,29 @@ | ||
runApplescript('return "unicorn"').then(result => { | ||
(async () => { | ||
const result = await runApplescript('return "unicorn"'); | ||
console.log(result); | ||
//=> 'unicorn' | ||
}); | ||
})(); | ||
``` | ||
## API | ||
### runAppleScript(script) | ||
Returns a `Promise<string>` with the script result. | ||
### runAppleScript.sync(script) | ||
Returns a `string` with the script result. | ||
## Related | ||
- [run-jxa](https://github.com/sindresorhus/run-jxa) - Run JXA code and get the result | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2891
14
46
0
+ Addedcross-spawn@5.1.0(transitive)
+ Addedexeca@0.8.0(transitive)
+ Addedget-stream@3.0.0(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
- Removedcross-spawn-async@2.2.5(transitive)
- Removedexeca@0.4.0(transitive)
- Removednpm-run-path@1.0.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpath-key@1.0.0(transitive)
Updatedexeca@^0.8.0