bundle-name
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -1,4 +0,5 @@ | ||
'use strict'; | ||
const runApplescript = require('run-applescript'); | ||
import {runAppleScriptAsync} from 'run-applescript'; | ||
module.exports = bundleId => runApplescript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`); | ||
export default async function bundleName(bundleId) { | ||
return runAppleScriptAsync(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`); | ||
} |
{ | ||
"name": "bundle-name", | ||
"version": "2.0.1", | ||
"description": "Get bundle name from a bundle identifier (OS X): com.apple.Safari → Safari", | ||
"license": "MIT", | ||
"repository": "sindresorhus/bundle-name", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"osx", | ||
"plist", | ||
"applescript", | ||
"bundle", | ||
"bundleid", | ||
"bundlename", | ||
"id", | ||
"identifier", | ||
"CFBundleName", | ||
"CFBundleIdentifier", | ||
"uti" | ||
], | ||
"dependencies": { | ||
"run-applescript": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "bundle-name", | ||
"version": "3.0.0", | ||
"description": "Get bundle name from a bundle identifier (macOS): `com.apple.Safari` → `Safari`", | ||
"license": "MIT", | ||
"repository": "sindresorhus/bundle-name", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"macos", | ||
"plist", | ||
"applescript", | ||
"bundle", | ||
"bundleid", | ||
"bundlename", | ||
"id", | ||
"identifier", | ||
"CFBundleName", | ||
"CFBundleIdentifier", | ||
"uti" | ||
], | ||
"dependencies": { | ||
"run-applescript": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -1,25 +0,20 @@ | ||
# bundle-name [![Build Status](https://travis-ci.org/sindresorhus/bundle-name.png?branch=master)](http://travis-ci.org/sindresorhus/bundle-name) | ||
# bundle-name | ||
> Get [bundle name](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleName) from a [bundle identifier](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleIdentifier) (OS X): `com.apple.Safari` → `Safari` | ||
> Get [bundle name](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleName) from a [bundle identifier](https://developer.apple.com/library/Mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/plist/info/CFBundleIdentifier) (macOS): `com.apple.Safari` → `Safari` | ||
## Install | ||
``` | ||
$ npm install --save bundle-name | ||
$ npm install bundle-name | ||
``` | ||
## Usage | ||
```js | ||
const bundleName = require('bundle-name'); | ||
import bundleName from 'bundle-name'; | ||
bundleName('com.apple.Safari').then(name => { | ||
console.log(name); | ||
//=> 'Safari' | ||
}); | ||
console.log(await bundleName('com.apple.Safari')); | ||
//=> 'Safari' | ||
``` | ||
## Related | ||
@@ -29,6 +24,1 @@ | ||
- [bundle-id](https://github.com/sindresorhus/bundle-id) - Get bundle identifier from a bundle name | ||
## License | ||
MIT © [Sindre Sorhus](http://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
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
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
4
Yes
3134
24
+ Addedcross-spawn@7.0.3(transitive)
+ Addedexeca@5.1.1(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@2.1.0(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedrun-applescript@5.0.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedwhich@2.0.2(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedrun-applescript@2.1.0(transitive)
Updatedrun-applescript@^5.0.0