alfred-link
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -15,3 +15,3 @@ 'use strict'; | ||
const getWorkflowDir = () => resolveAlfredPrefs().then(prefs => path.join(prefs, 'workflows')); | ||
const getWorkflowDir = () => resolveAlfredPrefs().then(prefs => path.join(prefs.path, 'workflows')); | ||
@@ -25,3 +25,3 @@ const readPkg = workflowDir => pathExists(workflowDir) | ||
return resolveAlfredPrefs() | ||
.then(prefs => pathExists(prefs)) | ||
.then(prefs => pathExists(prefs.path)) | ||
.then(prefsExists => { | ||
@@ -28,0 +28,0 @@ if (!prefsExists) { |
@@ -8,2 +8,3 @@ /* eslint-disable indent */ | ||
const userHome = require('user-home'); | ||
const resolveAlfredPrefs = require('resolve-alfred-prefs'); | ||
@@ -14,2 +15,19 @@ const fsP = pify(fs); | ||
const dirMap = new Map([ | ||
[ | ||
3, | ||
[ | ||
'Library/Application Support/Alfred 3/Workflow Data', | ||
'Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data' | ||
] | ||
], | ||
[ | ||
'default', | ||
[ | ||
'Library/Application Support/Alfred/Workflow Data', | ||
'Library/Caches/com.runningwithcrayons.Alfred/Workflow Data' | ||
] | ||
] | ||
]); | ||
// Remove the symlink | ||
@@ -21,8 +39,10 @@ const unlink = dir => del(path.join(dir), {force: true}); | ||
.then(content => idRegexp.exec(content)[1]) | ||
.then(bundleid => Promise.all([ | ||
unlink(path.join(userHome, 'Library/Application Support/Alfred 3/Workflow Data', bundleid)), | ||
unlink(path.join(userHome, 'Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data', bundleid)) | ||
])); | ||
.then(bundleid => { | ||
return resolveAlfredPrefs().then(prefs => { | ||
const dirs = dirMap.get(prefs.version || 'default'); | ||
return Promise.all(dirs.map(dir => unlink(path.join(userHome, dir, bundleid)))); | ||
}); | ||
}); | ||
module.exports = dir => cleanup(dir) | ||
.then(unlink(dir)); |
{ | ||
"name": "alfred-link", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Make your Alfred workflows installable from npm", | ||
@@ -50,3 +50,3 @@ "license": "MIT", | ||
"read-pkg-up": "^1.0.1", | ||
"resolve-alfred-prefs": "^1.0.0", | ||
"resolve-alfred-prefs": "^2.0.0", | ||
"sudo-block": "^1.2.0", | ||
@@ -53,0 +53,0 @@ "user-home": "^2.0.0" |
@@ -13,2 +13,10 @@ # alfred-link [![Build Status](https://travis-ci.org/SamVerschueren/alfred-link.svg?branch=master)](https://travis-ci.org/SamVerschueren/alfred-link) | ||
## Supporting Versions | ||
- Alfred 3 | ||
- Alfred 4 | ||
This package will only affect the latest one if you have multiple versions in your system. | ||
## Usage | ||
@@ -21,3 +29,3 @@ | ||
"name": "alfred-unicorn", | ||
"scripts": { | ||
"scripts": { | ||
"postinstall": "alfred-link", | ||
@@ -32,3 +40,3 @@ "preuninstall": "alfred-unlink" | ||
``` | ||
$ npm install -g alfred-unicorn. | ||
$ npm install -g alfred-unicorn | ||
``` | ||
@@ -35,0 +43,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
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
8830
152
81
+ Addedresolve-alfred-prefs@2.0.0(transitive)
- Removedresolve-alfred-prefs@1.0.0(transitive)
Updatedresolve-alfred-prefs@^2.0.0