bundle-name
Advanced tools
Comparing version 1.0.1 to 2.0.0
15
index.js
'use strict'; | ||
var runApplescript = require('run-applescript'); | ||
const runApplescript = require('run-applescript'); | ||
module.exports = function (bundleId, cb) { | ||
var script = '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")'; | ||
runApplescript(script, function (err, res) { | ||
if (err) { | ||
cb(err); | ||
return; | ||
} | ||
cb(null, res); | ||
}); | ||
}; | ||
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")`); |
{ | ||
"name": "bundle-name", | ||
"version": "1.0.1", | ||
"description": "Get bundle name from a bundle identifier (OS X): com.apple.Safari => Safari", | ||
"version": "2.0.0", | ||
"description": "Get bundle name from a bundle identifier (OS X): com.apple.Safari → Safari", | ||
"license": "MIT", | ||
"bin": { | ||
"bundle-name": "cli.js" | ||
}, | ||
"repository": "sindresorhus/bundle-name", | ||
@@ -13,3 +10,3 @@ "author": { | ||
"email": "sindresorhus@gmail.com", | ||
"url": "http://sindresorhus.com" | ||
"url": "sindresorhus.com" | ||
}, | ||
@@ -19,15 +16,10 @@ "engines": { | ||
}, | ||
"os": [ | ||
"darwin" | ||
], | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"osx", | ||
"mac", | ||
"plist", | ||
@@ -42,12 +34,15 @@ "applescript", | ||
"CFBundleIdentifier", | ||
"uti", | ||
"cli", | ||
"bin" | ||
"uti" | ||
], | ||
"dependencies": { | ||
"run-applescript": "^1.0.0" | ||
"meow": "^3.4.2", | ||
"run-applescript": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
"ava": "*", | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
} |
# bundle-name [![Build Status](https://travis-ci.org/sindresorhus/bundle-name.png?branch=master)](http://travis-ci.org/sindresorhus/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) (OS X): `com.apple.Safari` → `Safari` | ||
@@ -8,3 +8,3 @@ | ||
```sh | ||
``` | ||
$ npm install --save bundle-name | ||
@@ -17,7 +17,7 @@ ``` | ||
```js | ||
var bundleName = require('bundle-name'); | ||
const bundleName = require('bundle-name'); | ||
bundleName('com.apple.Safari', function (err, name) { | ||
bundleName('com.apple.Safari').then(name => { | ||
console.log(name); | ||
//=> Safari | ||
//=> 'Safari' | ||
}); | ||
@@ -27,23 +27,6 @@ ``` | ||
## CLI | ||
```sh | ||
$ npm install --global bundle-name | ||
``` | ||
```sh | ||
$ bundle-name --help | ||
Usage | ||
bundle-name <bundle-id> | ||
Example | ||
bundle-name com.apple.Safari | ||
Safari | ||
``` | ||
## Related | ||
See [bundle-id](https://github.com/sindresorhus/bundle-id) for the inverse. | ||
- [bundle-name-cli](https://github.com/sindresorhus/bundle-name-cli) - CLI for this module | ||
- [bundle-id](https://github.com/sindresorhus/bundle-id) - Get bundle identifier from a bundle name | ||
@@ -50,0 +33,0 @@ |
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
3327
2
2
3
34
1
+ Addedmeow@^3.4.2
+ Addedarray-find-index@1.0.2(transitive)
+ Addedcamelcase@2.1.1(transitive)
+ Addedcamelcase-keys@2.1.0(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@1.1.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedindent-string@2.1.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedis-utf8@0.2.1(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedmap-obj@1.0.1(transitive)
+ Addedmeow@3.7.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedread-pkg-up@1.0.1(transitive)
+ Addedredent@1.0.0(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedrun-applescript@2.1.0(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@2.0.0(transitive)
+ Addedstrip-indent@1.0.1(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
- Removedrun-applescript@1.0.1(transitive)
Updatedrun-applescript@^2.0.0