Skip to content

Quick Start

Installation

bash
npm install fast-alfred

TIP ⚡

You can use this workflow template to have all fast-alfred powers and best-practices out of the box 🚀

Change all placeholders, such as REPO-NAME, REPO-ORG, WORKFLOW_NAME, AUTHOR_EMAIL, AUTHOR_NAME, TODO, to your desired values.

Configuration

Create a .fast-alfred.config.cjs file in the root of your project and add the following configuration:

javascript
/**
 * @type {import('fast-alfred').FastAlfredConfig}
 */
module.exports = {}

Build Your First Workflow

  1. Create a Workflow via Alfred UI, or use an existing one
  2. Open the Workflow directory, copy relevant files (icons, info.plist, etc) to your project
  3. In case your package declares "type": "module" in the package.json file, you'll
    need to set both esmHelpers and outputFormat in order to use fast-alfred runtime
  4. Create a source directory for your Workflow scripts
bash
mkdir -p src/main

Caution ⚠️

By default, your production scripts should be located under src/main.
You can import every external script from this directory regularly.
See more here

  1. Use fast-alfred client utilities to manage your Workflow
  2. Follow the bundling guidelines to bundle your scripts
  3. Call your scripts using fast-alfred runtime


The Reason

fast-alfred lets you think about the functionality, rather than the boilerplate.

It provides you with a convenient way to manage your workflow, apply proper versioning, and bundle it into a .alfredworkflow file.

The Hard Time When Developing Alfred Workflows In Node.js

According to Alfred's official community,
it is not a best-practice to include any external dependencies at installation time,
so all of your code and its dependencies should be included in the workflow file.

Alfred Gallery requires you to upload a .alfredworkflow file, which is a zip archive containing all the necessary files for your workflow to run.

In order to accomplish this task, we need to bundle our code into a single file and include it in the workflow.

The Solution

fast-alfred allows you to bundle your production code into a few scripts, and include them in the workflow.
All bundle options are configurable, via a .fast-alfred.config.cjs file at the root of your project.

Released under the MIT License