├── .gitignore ├── .gitattributes ├── .travis.yml ├── icon.png ├── media ├── screencast.gif └── screenshot.png ├── .editorconfig ├── test.js ├── readme.md ├── package.json ├── license ├── index.js └── info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.js text eol=lf 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '6' 4 | - '4' 5 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radibit/alfred-vue/HEAD/icon.png -------------------------------------------------------------------------------- /media/screencast.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radibit/alfred-vue/HEAD/media/screencast.gif -------------------------------------------------------------------------------- /media/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radibit/alfred-vue/HEAD/media/screenshot.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{package.json,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import alfyTest from 'alfy-test'; 3 | 4 | test(async t => { 5 | const alfy = alfyTest(); 6 | 7 | const result = await alfy('v-on'); 8 | 9 | t.deepEqual(result[0], { 10 | title: 'v-on', 11 | subtitle: 'API > Directives > v-on', 12 | arg: 'http://vuejs.org/v2/api/#v-on', 13 | quicklookurl: 'http://vuejs.org/v2/api/#v-on' 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # alfred-vue [![Build Status](https://travis-ci.org/radibit/alfred-vue.svg?branch=master)](https://travis-ci.org/radibit/alfred-vue) 2 | 3 | > Search for Vue.js API references on vuejs.org 4 | 5 | 6 | 7 | ## Install 8 | 9 | ``` 10 | $ npm install -g alfred-vue 11 | ``` 12 | 13 | *Requires [Node.js](https://nodejs.org) 4+ and the Alfred [Powerpack](https://www.alfredapp.com/powerpack/).* 14 | 15 | 16 | ## Usage 17 | 18 | In Alfred, type `vue`, Enter, and your query. 19 | 20 | 21 | ## License 22 | 23 | MIT © [radibit](http://radibit.com) 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alfred-vue", 3 | "version": "0.2.0", 4 | "description": "Search for Vue.js API references on vuejs.org", 5 | "license": "MIT", 6 | "repository": "radibit/alfred-vue", 7 | "author": "Radimir Bitsov ", 8 | "engines": { 9 | "node": ">=4" 10 | }, 11 | "scripts": { 12 | "test": "xo && ava", 13 | "postinstall": "alfy-init", 14 | "preuninstall": "alfy-cleanup" 15 | }, 16 | "files": [ 17 | "index.js", 18 | "icon.png", 19 | "info.plist" 20 | ], 21 | "keywords": [ 22 | "alfred", 23 | "workflow", 24 | "alfy" 25 | ], 26 | "dependencies": { 27 | "alfred-notifier": "^0.2.0", 28 | "alfy": "^0.6.0" 29 | }, 30 | "devDependencies": { 31 | "alfy-test": "^0.3.0", 32 | "ava": "^0.16.0", 33 | "xo": "^0.17.0" 34 | }, 35 | "xo": { 36 | "esnext": true 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) radibit (radibit.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const alfy = require('alfy'); 4 | 5 | const config = { 6 | url: 'bh4d9od16a-dsn.algolia.net/1/indexes/*/queries', 7 | appId: 'BH4D9OD16A', 8 | apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea' 9 | }; 10 | 11 | const q = 'query=' + alfy.input + '&hitsPerPage=10'; 12 | 13 | alfy.fetch(config.url, { 14 | method: 'POST', 15 | headers: { 16 | 'x-algolia-application-id': config.appId, 17 | 'x-algolia-api-key': config.apiKey 18 | }, 19 | body: JSON.stringify({ 20 | requests: [ 21 | { 22 | indexName: 'vuejs', 23 | params: q 24 | } 25 | ] 26 | }) 27 | }) 28 | .then(data => { 29 | const items = data.results[0].hits 30 | .map(x => { 31 | const result = { 32 | title: x.anchor, 33 | subtitle: x.anchor, 34 | arg: x.url, 35 | quicklookurl: x.url 36 | }; 37 | 38 | if (x.hierarchy) { 39 | const hierarchy = Object.keys(x.hierarchy).filter( 40 | objKey => Boolean(x.hierarchy[objKey]) 41 | ).sort(); 42 | 43 | result.title = x.hierarchy[hierarchy[hierarchy.length - 1]]; 44 | result.subtitle = hierarchy.map(level => x.hierarchy[level]).join(' > '); 45 | } 46 | 47 | return result; 48 | }); 49 | 50 | alfy.output(items); 51 | }); 52 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | vue 7 | bundleid 8 | com.radibit.alfred-vue 9 | category 10 | Uncategorised 11 | connections 12 | 13 | AD4E4A3F-6FC6-414F-9578-5B22AB1871BE 14 | 15 | 16 | destinationuid 17 | C3CAA433-A0B9-4B5C-9147-7270E3FD2714 18 | modifiers 19 | 0 20 | modifiersubtext 21 | 22 | vitoclose 23 | 24 | 25 | 26 | 27 | disabled 28 | 29 | objects 30 | 31 | 32 | config 33 | 34 | browser 35 | 36 | spaces 37 | 38 | url 39 | {query} 40 | utf8 41 | 42 | 43 | type 44 | alfred.workflow.action.openurl 45 | uid 46 | C3CAA433-A0B9-4B5C-9147-7270E3FD2714 47 | version 48 | 1 49 | 50 | 51 | config 52 | 53 | alfredfiltersresults 54 | 55 | argumenttype 56 | 0 57 | escaping 58 | 102 59 | keyword 60 | vue 61 | queuedelaycustom 62 | 3 63 | queuedelayimmediatelyinitially 64 | 65 | queuedelaymode 66 | 0 67 | queuemode 68 | 2 69 | runningsubtext 70 | Searching... 71 | script 72 | ./node_modules/.bin/run-node index.js "$1" 73 | scriptargtype 74 | 1 75 | scriptfile 76 | index.js 77 | subtext 78 | 79 | title 80 | Vue.js API 81 | type 82 | 0 83 | withspace 84 | 85 | 86 | type 87 | alfred.workflow.input.scriptfilter 88 | uid 89 | AD4E4A3F-6FC6-414F-9578-5B22AB1871BE 90 | version 91 | 2 92 | 93 | 94 | readme 95 | 96 | uidata 97 | 98 | C3CAA433-A0B9-4B5C-9147-7270E3FD2714 99 | 100 | xpos 101 | 150 102 | ypos 103 | 10 104 | 105 | AD4E4A3F-6FC6-414F-9578-5B22AB1871BE 106 | 107 | xpos 108 | 10 109 | ypos 110 | 10 111 | 112 | 113 | 114 | 115 | --------------------------------------------------------------------------------