Created
August 21, 2022 09:14
-
-
Save yuanqing/7516c094740a08c805e78838ca723339 to your computer and use it in GitHub Desktop.
Create Figma Plugin: Run Last Plugin
This file contains hidden or 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
const { exec } = require('child_process') | |
const esbuildFigmaRunLastPlugin = { | |
name: 'figma-run-last-plugin', | |
setup: async function () { | |
await new Promise(function (resolve, reject) { | |
exec( | |
`osascript <<'EOF' | |
if application "Figma" is running then | |
tell application "Figma" | |
activate | |
end tell | |
tell application "System Events" | |
tell application process "Figma" | |
tell menu bar 1 | |
tell menu "Plugins" | |
click menu item "Run last plugin" | |
end tell | |
end tell | |
end tell | |
end tell | |
end if | |
EOF`, | |
function (error) { | |
if (error) { | |
reject(error) | |
return | |
} | |
resolve() | |
} | |
) | |
}) | |
}, | |
} | |
module.exports = function (buildOptions) { | |
return { | |
...buildOptions, | |
plugins: [esbuildFigmaRunLastPlugin], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment