Support TypeScript & Support Bundler!
- Use this template to create a repository
- Clone the repository you created
- Run
pnpm installto install dependencies - Run
pnpm buildto build scripts
The script source code is located in the src directory, and the compile results (which can be used by OmniFocus) are in the dist directory.
Any typescript file inside src directory is treated as an OmniFocus script.
If you want to ignore some scripts (e.g., treat them as utility scripts), ensure their filenames start with an underscore (_).
Any script must follow the following pattern:
export const action = new PlugIn.Action(function (selection) {
// do anything you want
});
action.validate = function (selection) {
// do anything you want
};
export const meta: Meta = {
label: "...",
description: "...",
identifier: "...",
author: "...",
version: "0.1",
};Note:
actionandmetaare required,action.validateis optional.metamust appear as the last section of the script; no code should follow it.
Run pnpm build, the built scripts (ended with .omnifocusjs) will be placed in the dist directory.
Feel free to use third-party dependencies. All imports will be bundled; however, be aware that imported scripts might not function properly in the Omni Automation environment.
See src directory for some pre-built scripts.
If you are using iCloud to save your OmniFocus Scripts, you can use pnpm sync to automatically sync built scripts (which is generated by pnpm build) to your OmniFocus Scripts directory.
If your OmniFocus Scripts are located elsewhere, modify the sync.sh script accordingly..
MIT