Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alfred-figma

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alfred-figma - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

lib/removeTeam.js

53

index.js

@@ -25,5 +25,26 @@ const alfy = require('alfy')

return Promise.resolve(items.push({
uid: `${team.name}.${team.id}`,
title: team.name,
subtitle: `Open figma team.`,
arg: ''
subtitle: `Open team page.`,
arg: utils.getUrl(`/files/team/${team.id}/${team.name}`, 'app'),
text: {
copy: utils.getUrl(`/files/team/${team.id}/${team.name}`, 'browser'),
},
variables: {
action: 'browser'
},
mods: {
alt: {
subtitle: `Remove ${team.name} projects and files from search results.`,
arg: JSON.stringify({id: team.id, name: team.name}),
variables: {
action: 'remove',
notification: `${team.name} team’s projects and files removed from search results.`
}
},
cmd: {
subtitle: 'Open team page in a web browser',
arg: utils.getUrl(`/files/team/${team.id}/${team.name}`, 'browser')
}
}
}))

@@ -36,5 +57,15 @@ .then(() => utils.getResults(`/teams/${team.id}/projects`))

title: p.name,
subtitle: 'GitHub project',
subtitle: `Open project page for team ${team.name}.`,
arg: utils.getUrl(`/files/project/${p.id}/${p.name}`, 'app'),
text: {
copy: utils.getUrl(`/projects/${p.id}/${p.name}`, 'browser'),
copy: utils.getUrl(`/files/project/${p.id}/${p.name}`, 'browser'),
},
variables: {
action: 'browser'
},
mods: {
cmd: {
subtitle: 'Open project in web browser',
arg: utils.getUrl(`/files/project/${p.key}/${p.name}`, 'browser')
}
}

@@ -45,6 +76,9 @@ }))

return Promise.all(results.files.map((f) => {
// set the project name for formatting
f.project = p.name
f.team = team.name
return Promise.resolve(items.push({
uid: f.key,
title: f.name,
subtitle: utils.subtitle(f, ['modified']),
subtitle: utils.subtitle(f, ['team', 'project', 'modified']),
arg: utils.getUrl(`/file/${f.key}/${f.name}`, 'app'),

@@ -59,5 +93,9 @@ variables: {

mods: {
alt: {
subtitle: 'Duplicate file to your drafts.',
arg: utils.getUrl(`/file/${f.key}/${f.name}/duplicate`, 'browser')
},
cmd: {
subtitle: 'Open file in web browser',
arg: utils.getUrl(`/file/${f.key}/${f.name}`, 'browser'),
arg: utils.getUrl(`/file/${f.key}/${f.name}`, 'browser')
}

@@ -89,7 +127,4 @@ }

}
if (item.subtitle.toLowerCase().includes(alfy.input.toLowerCase())) {
return true
}
return false
}))
.then((filteredItems) => alfy.output(filteredItems))

14

lib/utils.js

@@ -20,10 +20,18 @@ const alfy = require('alfy')

// Subtitle formatter, x is the repo object, and format is an array with named formats
// Subtitle formatter, x is the object, and format is an array with named formats
const subtitle = (x, format) => {
return format.map(f => {
if (f == "modified") {
return `Modified ${pm(new Date() - new Date(x.last_modified), { compact: true, verbose: true })} ago`
if (f == 'modified') {
return `modified ${pm(new Date() - new Date(x.last_modified), { compact: true, verbose: true })} ago`
}
if (f == 'team') {
return `Team: ${x.team}`
}
if (f == 'project') {
return `Project: ${x.project}`
}
}).filter(x => x != null).join(" • ")

@@ -30,0 +38,0 @@ }

{
"name": "alfred-figma",
"version": "0.1.0",
"version": "0.2.0",
"description": "Alfred workflow to quick link figma projects and files",
"main": "index.js",
"author": {
"name": "Jon Rohan",
"email": "yes@jonrohan.codes",
"url": "http://jonrohan.codes/"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "alfy-init",
"preuninstall": "alfy-cleanup"
},
"keywords": [
"alfred",
"alfred-workflow",
"alfred3-workflow",
"alfred3",
"figma",
"workflow"
"figma-api",
"design",
"design-tools"
],
"author": "Jon Rohan",
"license": "MIT",

@@ -16,0 +27,0 @@ "dependencies": {

# Figma Alfred 3 workflow
> Alfred workflow to quick link Figma teams, projects and files
## TODO:
- Figma's API doesn't allow access to draft files.
- Figma's API doesn't allow access to get teams. This requires adding team ids to the workflow manually.
- Files open in the desktop app, but teams and projects won't.
## Installation
```
$ npm install --global alfred-figma
```
*Requires [Node.js](https://nodejs.org) 10+ and the Alfred [Powerpack](https://www.alfredapp.com/powerpack/).*
## Configuration
There are a couple of requirements.
1. You need a [Figma account](https://www.figma.com) and be part of a team.
2. Create a [Personal Access Token](https://www.figma.com/developers/docs#auth-dev-token) so you can reach the API.
3. Create a `.env` file with your access token in the directory of the installed workflow.
- `FIGMA_TOKEN=<personal-access-token>`
- Alternatively add an environment variable for `FIGMA_TOKEN`
4. Add a team to your results with the `figma add [teamurl]` command.
## Usage
![alfred-figma](https://user-images.githubusercontent.com/54012/47411429-88909400-d71d-11e8-93a4-43a06e5bdd8e.gif)
The workflow lists results of 3 items teams, projects and files.
### Teams
- <kbd>⏎</kbd> Open team page.
- <kbd>⌥</kbd> + <kbd>⏎</kbd> Remove team from workflow.
- <kbd>⌘</kbd> + <kbd>⏎</kbd> Open team page in web browser.
### Projects
- <kbd>⏎</kbd> Open project page.
- <kbd>⌘</kbd> + <kbd>⏎</kbd> Open project page in web browser.
### Files
- <kbd>⏎</kbd> Open file.
- <kbd>⌥</kbd> + <kbd>⏎</kbd> Duplicate file to your drafts.
- <kbd>⌘</kbd> + <kbd>⏎</kbd> Open file in web browser.
## Credits
- [alfy](https://github.com/sindresorhus/alfy) made by [Sindre Sorhus](https://sindresorhus.com/) is licensed by [MIT](https://github.com/sindresorhus/alfy/blob/master/license)
## License
MIT © [Jon Rohan](http://jonrohan.codes/)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc