alfred-link
Advanced tools
Comparing version 0.2.1 to 0.3.0
22
index.js
'use strict'; | ||
const path = require('path'); | ||
const makeDir = require('make-dir'); | ||
const pathExists = require('path-exists'); | ||
@@ -17,10 +18,19 @@ const readPkgUp = require('read-pkg-up'); | ||
const readPkg = workflowDir => pathExists(workflowDir) | ||
.then(exists => { | ||
if (!exists) { | ||
throw new Error(`Workflow directory \`${workflowDir}\` does not exist`); | ||
.then(workflowDirExists => { | ||
if (workflowDirExists) { | ||
return; | ||
} | ||
return readPkgUp(); | ||
}); | ||
return resolveAlfredPrefs() | ||
.then(prefs => pathExists(prefs)) | ||
.then(prefsExists => { | ||
if (!prefsExists) { | ||
throw new Error('`Alfred.alfredpreferences` package does not exist'); | ||
} | ||
return makeDir(workflowDir); | ||
}); | ||
}) | ||
.then(() => readPkgUp()); | ||
exports.link = opts => { | ||
@@ -40,3 +50,3 @@ const options = Object.assign({ | ||
.then(result => { | ||
const pkg = result.pkg; | ||
const {pkg} = result; | ||
const filePath = result.path; | ||
@@ -43,0 +53,0 @@ |
#!/usr/bin/env node | ||
'use strict'; | ||
const alfredLink = require('./'); | ||
const alfredLink = require('.'); | ||
@@ -13,5 +13,5 @@ const npmGlobal = process.env.npm_config_global; | ||
// Only transform if `alfred-link` is called from `npm -g` | ||
alfredLink.link({transform: npmGlobal}).catch(err => { | ||
console.error(err); | ||
alfredLink.link({transform: npmGlobal}).catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
112
package.json
{ | ||
"name": "alfred-link", | ||
"version": "0.2.1", | ||
"description": "Make your Alfred workflows installable from npm", | ||
"license": "MIT", | ||
"repository": "SamVerschueren/alfred-link", | ||
"author": { | ||
"name": "Sam Verschueren", | ||
"email": "sam.verschueren@gmail.com", | ||
"url": "github.com/SamVerschueren" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
} | ||
], | ||
"bin": { | ||
"alfred-link": "link.js", | ||
"alfred-unlink": "unlink.js" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"link.js", | ||
"unlink.js", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"cli-app", | ||
"cli", | ||
"alfred", | ||
"link", | ||
"symlink", | ||
"packal" | ||
], | ||
"dependencies": { | ||
"del": "^2.2.2", | ||
"path-exists": "^3.0.0", | ||
"pify": "^2.3.0", | ||
"plist": "^2.0.1", | ||
"read-pkg-up": "^1.0.1", | ||
"resolve-alfred-prefs": "^1.0.0", | ||
"sudo-block": "^1.2.0", | ||
"user-home": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"xo": "*" | ||
}, | ||
"xo": { | ||
"esnext": true | ||
} | ||
"name": "alfred-link", | ||
"version": "0.3.0", | ||
"description": "Make your Alfred workflows installable from npm", | ||
"license": "MIT", | ||
"repository": "SamVerschueren/alfred-link", | ||
"author": { | ||
"name": "Sam Verschueren", | ||
"email": "sam.verschueren@gmail.com", | ||
"url": "github.com/SamVerschueren" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
} | ||
], | ||
"bin": { | ||
"alfred-link": "link.js", | ||
"alfred-unlink": "unlink.js" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"scripts": { | ||
"test": "xo" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"link.js", | ||
"unlink.js", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"cli-app", | ||
"cli", | ||
"alfred", | ||
"link", | ||
"symlink", | ||
"packal" | ||
], | ||
"dependencies": { | ||
"del": "^2.2.2", | ||
"make-dir": "^1.3.0", | ||
"path-exists": "^3.0.0", | ||
"pify": "^2.3.0", | ||
"plist": "^2.0.1", | ||
"read-pkg-up": "^1.0.1", | ||
"resolve-alfred-prefs": "^1.0.0", | ||
"sudo-block": "^1.2.0", | ||
"user-home": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"xo": "^0.23.0" | ||
} | ||
} |
@@ -20,3 +20,3 @@ # alfred-link [![Build Status](https://travis-ci.org/SamVerschueren/alfred-link.svg?branch=master)](https://travis-ci.org/SamVerschueren/alfred-link) | ||
"name": "alfred-unicorn", | ||
"scripts": { | ||
"scripts": { | ||
"postinstall": "alfred-link", | ||
@@ -51,12 +51,14 @@ "preuninstall": "alfred-unlink" | ||
When developing an Alfred workflow, you can call `alfred-link` directly from your cli. Either by installing `alfred-link` globally or by calling `alfred-link` from your `node_modules/.bin` directory. This will create a symlink in the Alfred workflows directory pointing to your development location without transforming `info.plist`. | ||
When developing an Alfred workflow, you can call `alfred-link` directly from your cli. Use `npx` to call the local installation of `alfred-link` and `alfred-unlink`. | ||
``` | ||
$ ./node_modules/.bin/alfred-link | ||
$ npx alfred-link | ||
``` | ||
This will create a symlink in the Alfred workflows directory pointing to your development location without transforming `info.plist`. | ||
To remove the symlink afterwards, you can call `alfred-unlink`. | ||
``` | ||
$ ./node_modules/.bin/alfred-unlink | ||
$ npx alfred-unlink | ||
``` | ||
@@ -63,0 +65,0 @@ |
#!/usr/bin/env node | ||
'use strict'; | ||
const alfredLink = require('./'); | ||
const alfredLink = require('.'); | ||
alfredLink.unlink().catch(err => { | ||
console.error(err); | ||
alfredLink.unlink().catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
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
8320
133
73
9
+ Addedmake-dir@^1.3.0
+ Addedmake-dir@1.3.0(transitive)
+ Addedpify@3.0.0(transitive)