Socket
Socket
Sign inDemoInstall

alfred-link

Package Overview
Dependencies
64
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.1.4

lib/link.js

7

cli.js

@@ -5,3 +5,5 @@ #!/usr/bin/env node

if (process.env.npm_config_global === '') {
const npmGlobal = process.env.npm_config_global;
if (npmGlobal === '') {
// Prevent linking if the script was part of a non-global npm (install) command

@@ -11,5 +13,6 @@ process.exit(0);

alfyLink().catch(err => {
// Only transform if `alfred-link` is called from `npm -g`
alfyLink({transform: npmGlobal}).catch(err => {
console.error(err);
process.exit(1);
});
'use strict';
const path = require('path');
const fs = require('fs');
const pathExists = require('path-exists');
const pkgUp = require('pkg-up');
const pify = require('pify');
const del = require('del');
const readPkgUp = require('read-pkg-up');
const resolveAlfredPrefs = require('resolve-alfred-prefs');
const plistTransform = require('./lib/plist-transform');
const link = require('./lib/link');
const fsP = pify(fs);
module.exports = opts => {
const options = Object.assign({
transform: true
}, opts);
module.exports = () => {
const cwd = process.cwd();

@@ -29,6 +29,7 @@

return pkgUp(cwd);
return readPkgUp(cwd);
})
.then(filePath => {
const pkg = require(filePath);
.then(result => {
const pkg = result.pkg;
const filePath = result.path;

@@ -38,6 +39,9 @@ const src = path.dirname(filePath);

if (!options.transform) {
return link(src, dest);
}
return plistTransform(path.dirname(filePath), pkg)
.then(() => del(dest, {force: true}))
.then(() => fsP.symlink(src, dest));
.then(() => link(src, dest));
});
};

@@ -33,13 +33,9 @@ 'use strict';

const data = fix(plist.parse(content));
data.version = pkg.version;
data.description = pkg.description;
data.name = pkg.name.replace(/^alfred\-/, '');
data.version = pkg.version || '';
data.description = pkg.description || '';
data.webaddress = pkg.homepage || pkg.author.url || '';
data.createdby = pkg.author.name || '';
if (pkg.author && typeof pkg.author === 'object') {
data.createdby = pkg.author.name;
data.webaddress = pkg.author.url;
}
return fsP.writeFile(file, plist.build(data));
});
};
{
"name": "alfred-link",
"version": "0.1.3",
"version": "0.1.4",
"description": "Make your Alfred workflows installable from npm",

@@ -43,4 +43,4 @@ "license": "MIT",

"pify": "^2.3.0",
"pkg-up": "^1.0.0",
"plist": "^2.0.1",
"read-pkg-up": "^1.0.1",
"resolve-alfred-prefs": "^1.0.0"

@@ -47,0 +47,0 @@ },

@@ -41,11 +41,17 @@ # alfred-link [![Build Status](https://travis-ci.org/SamVerschueren/alfred-link.svg?branch=master)](https://travis-ci.org/SamVerschueren/alfred-link)

|-------------|--------------|
| name | name |
| version | version |
| description | description |
| webaddress | homepage |
| createdby | author.name |
| webaddress | author.url |
> Note: If the workflow is prefixed by `alfred-`, that prefix is being removed in the name of `info.plist`. For example, `alfred-unicorn` becomes `unicorn`.
## Development
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`.
```
$ ./node_modules/.bin/alfred-link
```
## Related

@@ -52,0 +58,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc