-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ba72b80
Showing
10 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.gif | ||
*.alfredworkflow |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# alfred-webpack-docs | ||
|
||
> [Alfred 3](https://www.alfredapp.com) workflow that gives you a super quick access to webpack documentation. | ||
<img src="https://raw.githubusercontent.com/wolasss/alfred-webpack-docs/master/alfred-webpack-docs.gif"> | ||
|
||
## Install | ||
|
||
``` | ||
$ npm install --global alfred-webpack-docs | ||
``` | ||
|
||
or download it from [here](https://raw.githubusercontent.com/wolasss/alfred-webpack-docs/master/alfred-webpack-docs.alfredworkflow) | ||
|
||
*Requires [Node.js](https://nodejs.org) 4+ and the Alfred 3 [Powerpack](https://www.alfredapp.com/powerpack/).* | ||
|
||
## Usage | ||
|
||
In Alfred, type `wpd` followed by a keyword you want to search the documentation through. | ||
|
||
## License | ||
|
||
MIT © [Adam Wolski](https://adamwolski.com) |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const alfy = require("alfy"); | ||
const query = alfy.input; | ||
const Entities = require('html-entities').XmlEntities; | ||
const entities = new Entities(); | ||
const merge = require('merge') | ||
|
||
const search = (items, ret) => { | ||
items.forEach(item => { | ||
if ((item.title && item.title.toLowerCase().indexOf(query.toLowerCase()) >= 0) || (item.url && item.url.toLowerCase().indexOf(query.toLowerCase()) >= 0)) { | ||
ret.push(item); | ||
} | ||
|
||
if (item.pages && item.pages.length) { | ||
search(item.pages, ret); | ||
} | ||
}); | ||
|
||
return ret; | ||
} | ||
|
||
alfy.fetch('https://webpack.js.org/', { | ||
json: false | ||
}).then(data => { | ||
const props = data.match(/data-props\=\"([^\"]+)\"/gm); | ||
|
||
const docs = {}; | ||
|
||
props.forEach(prop => { | ||
try { | ||
const properties = JSON.parse(entities.decode(prop.replace(/data-props\="/, "").replace(/\"$/, ""))); | ||
docs = merge(docs, properties); | ||
} catch (e) {} | ||
}); | ||
|
||
const result = search(docs.sections, []).map(item => { | ||
return { | ||
title: item.title, | ||
subtitle: item.url, | ||
arg: `https://webpack.js.org/${item.url}` | ||
} | ||
}); | ||
|
||
alfy.output(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>bundleid</key> | ||
<string>webpackdocs</string> | ||
<key>category</key> | ||
<string>Tools</string> | ||
<key>connections</key> | ||
<dict> | ||
<key>B1CFE20E-B1DB-451D-80ED-59F9F4673719</key> | ||
<array> | ||
<dict> | ||
<key>destinationuid</key> | ||
<string>E70F4F54-D52D-46D2-B981-4C5005FE223B</string> | ||
<key>modifiers</key> | ||
<integer>0</integer> | ||
<key>modifiersubtext</key> | ||
<string></string> | ||
<key>vitoclose</key> | ||
<false/> | ||
</dict> | ||
</array> | ||
</dict> | ||
<key>createdby</key> | ||
<string>Adam Wolski</string> | ||
<key>description</key> | ||
<string>Search through webpack documentation</string> | ||
<key>disabled</key> | ||
<false/> | ||
<key>name</key> | ||
<string>alfred-webpack-docs</string> | ||
<key>objects</key> | ||
<array> | ||
<dict> | ||
<key>config</key> | ||
<dict> | ||
<key>browser</key> | ||
<string></string> | ||
<key>spaces</key> | ||
<string></string> | ||
<key>url</key> | ||
<string>{query}</string> | ||
<key>utf8</key> | ||
<true/> | ||
</dict> | ||
<key>type</key> | ||
<string>alfred.workflow.action.openurl</string> | ||
<key>uid</key> | ||
<string>E70F4F54-D52D-46D2-B981-4C5005FE223B</string> | ||
<key>version</key> | ||
<integer>1</integer> | ||
</dict> | ||
<dict> | ||
<key>config</key> | ||
<dict> | ||
<key>alfredfiltersresults</key> | ||
<false/> | ||
<key>argumenttype</key> | ||
<integer>1</integer> | ||
<key>escaping</key> | ||
<integer>127</integer> | ||
<key>keyword</key> | ||
<string>wpd</string> | ||
<key>queuedelaycustom</key> | ||
<integer>1</integer> | ||
<key>queuedelayimmediatelyinitially</key> | ||
<false/> | ||
<key>queuedelaymode</key> | ||
<integer>0</integer> | ||
<key>queuemode</key> | ||
<integer>1</integer> | ||
<key>runningsubtext</key> | ||
<string>Searching...</string> | ||
<key>script</key> | ||
<string>./node_modules/.bin/run-node index.js "$1"</string> | ||
<key>scriptargtype</key> | ||
<integer>1</integer> | ||
<key>scriptfile</key> | ||
<string></string> | ||
<key>subtext</key> | ||
<string></string> | ||
<key>title</key> | ||
<string>Search Webpack docs</string> | ||
<key>type</key> | ||
<integer>0</integer> | ||
<key>withspace</key> | ||
<true/> | ||
</dict> | ||
<key>type</key> | ||
<string>alfred.workflow.input.scriptfilter</string> | ||
<key>uid</key> | ||
<string>B1CFE20E-B1DB-451D-80ED-59F9F4673719</string> | ||
<key>version</key> | ||
<integer>2</integer> | ||
</dict> | ||
</array> | ||
<key>readme</key> | ||
<string></string> | ||
<key>uidata</key> | ||
<dict> | ||
<key>B1CFE20E-B1DB-451D-80ED-59F9F4673719</key> | ||
<dict> | ||
<key>xpos</key> | ||
<integer>240</integer> | ||
<key>ypos</key> | ||
<integer>50</integer> | ||
</dict> | ||
<key>E70F4F54-D52D-46D2-B981-4C5005FE223B</key> | ||
<dict> | ||
<key>xpos</key> | ||
<integer>440</integer> | ||
<key>ypos</key> | ||
<integer>50</integer> | ||
</dict> | ||
</dict> | ||
<key>webaddress</key> | ||
<string>https://www.adamwolski.com</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "alfred-webpack-docs", | ||
"version": "1.0.0", | ||
"description": "Workflow for searching through webpack documentation.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "test", | ||
"postinstall": "alfy-init", | ||
"preuninstall": "alfy-cleanup" | ||
}, | ||
"author": { | ||
"name": "Adam Wolski", | ||
"email": "[email protected]", | ||
"url": "http://adamwolski.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wolasss/alfred-webpack-docs" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"alfy": "^0.6.0", | ||
"html-entities": "^1.2.0", | ||
"merge": "^1.2.0" | ||
} | ||
} |