Developing outside of Drafts

Is anyone using an IDE outside of Drafts to build action scripts? I use VS Code for all my JavaScript development, and much prefer that interface to work in. The catch is that I can’t test within VS Code, so to use the features of my development environment, I have to copy/paste or import/export between Drafts and VS Code, and debugging isn’t possible because I can’t find a way to access the Drafts library.

Is there an npm package or other means to import and connect to Drafts from an IDE?

I create a fair amount of code in VS Code in library files in the Drafts scripts directory. I

have a standard test function tied to an action which has a keyboard shortcut. I can immediately try any code In Drafts, but I even use Keyboard Maestro to use the same key code in VS Code to switch me to Drafts and so nd the same key press.

Debugging all happens in Drafts, though I have creates some enhanced logging to help with that.

There are also Typescript definition file available for Drafts on Github.

1 Like

These are actually the things I’ve been trying to work out.

library files in the Drafts scripts directory

Where is that directory?

I have a standard test function tied to an action which has a keyboard shortcut.

Can you share details of this functions?

Debugging all happens in Drafts, though I have creates some enhanced logging to help with that.

Is this just console.log logging or do you have a special logging function just for Drafts?

OK, I finally located that. Just being able to include that in my dev dependencies will be helpful.

If there’s any more specific information about developing for Drafts, I’d appreciate it.

Drafts’ scripting documentation is your primary source.

If you want more prebuilt functions then I have made a library.

Hope that helps.

2 Likes

That does, thanks!

I’ve actually been using the Drafts Script Reference pretty much from the start. It was getting VS Code to recognize those globals for autocomplete and in-IDE tools that I was missing.

Those libraries should help a lot. Thanks for sharing them.