Package: alfred-workflow-packager
Alfred Workflow PackagerCopyright 2016-2023 Caleb EvansReleased under the MIT licenseAlfred Workflow Packager is a command-line utility which makes the process of
packaging and exporting anAlfredworkflow
incredibly quick and easy. The utility supports Alfred 3 and up, on projects running Python 3 (Python 2 is no longer supported).SetupYou can install the utility viapip3, either globally or within a virtualenv:pip3installalfred-workflow-packagerUsage1. Create configuration fileOnce you've installed AWP, you must configure it for every project where you
wish to use it. To do so, create apackager.jsonfile in the root directory of
your project; this file configures AWP for that particular project.Example{"export_files":["Fruit.alfredworkflow"],"bundle_id":"com.yourname.fruit","readme":"README.txt","resources":["icon.png","src/*.py","src/data/*.json"]}Required settingsexport_filesThe paths of the exported workflows (relative to your project directory).bundle_idThe unique bundle ID of your workflow. You must have one set in the installed
workflow, or AWP will not be able to find your workflow when packaging.resourcesA list of zero or more files/folder patterns representing files or folders to
copy from your project to the installed workflow. The directory structures and
filenames are preserved when copying.Local project:- icon.png
- fruit
    - apple.py
    - banana.applescript
    - orange.phpInstalled workflow (before running utility):- info.plist
- special_file.jsonpackager.json resources:["icon.png","fruit/*.json"]Installed workflow (after running utility):- info.plist
- icon.png
- special_file.json
- fruit
    - apple.py
    - banana.applescript
    - orange.phpNote that files and folders already present in the installed workflow arenottouched if they are not in theresourceslist.Optional settingsreadmeThe path to the README file to use for this workflow; theAbout this Workflowfield in your workflow is populated with the contents of this file.2. Run utilityYou can run the utility via theawpcommand:awpRunningawpwill copy those project resources listed inpackager.jsonto
the installed workflow (in their respective locations), but only if their
contents or permissions have changed. If you ever need to ignore this equality
check, you can force the copying of all files/directories by passing--force/-f.awp--forceawp-fSetting the workflow versionPassing the--versionoption (also-v) toawpallows you to set the
version of the installed workflow directly. I highly recommend usingsemantic
versioningto version your workflow releases.awp--version1.2.0awp-v1.2.0Exporting the workflowWhen you're pleased with your work and you're ready to publish a new release,
you can export the installed workflow to your project directory by passing the--exportflag (or-e) toawp.awp--exportawp-eNote that you can set the version and export the workflow simultaneously:awp-v1.2.0-eNew in AWP v1.1.0:If you wish to temporarily export the workflow to a
different file (different fromexport_filesinpackager.json), you can
pass one or more optional paths to--export:awp-v1.3.0-beta.1-e~/Desktop/fruit-beta-alfred-5.alfredworkflow4. Configure workflow objectsThe last important step is to update any script objects in your workflow (i.e.objects of typeScript Filter,Run Script,etc.) to reference the
files copied to the installed workflow directory.You should set theLanguageto/bin/bashand use the appropriate shell
command to call your script. Use"$@"if your input is passed as argv, or"{query}"if your input is passed as {query}.Python/usr/bin/python3-mfruit.apple"$@"/usr/bin/python3-mfruit.apple"{query}"AppleScript/usr/bin/osascriptfruit/banana.applescript"$@"/usr/bin/osascriptfruit/banana.applescript"{query}"PHP/usr/bin/phpfruit/orange.php"$@"/usr/bin/phpfruit/orange.php"{query}"