Important: Node.js > V6.x is a minimum requirement. You also need the command line tools installed.
npm install -g skpm
skpm create my-plugin
The above command pulls the template from skpm/skpm, prompts for some information, and generates the project at ./my-plugin/.
skpm create <plugin-name>
--name The plugin display name.
--cwd A directory to use instead of $PWD.
--force Force option to create the directory for the new app. [boolean] [default: false]
--template The repository hosting the template to start from. [string] [default: skpm/skpm]
--git Initialize version control using git. [boolean] [default: true]
--install Installs dependencies. [boolean] [default: true]
A note on templates
The purpose of official skpm plugin templates are to provide opinionated development tooling setups so that users can get started with actual plugin code as fast as possible. However, these templates are un-opinionated in terms of how you structure your plugin code and what libraries you use in addition to skpm.
Current available official templates include:
skpm/skpm
- The simplest possible plugin setup. (default)skpm/with-prettier
- A plugin setup featuring linting with ESLint and code formatting with Prettier.skpm/with-datasupplier
- A template to create DataSupplier plugins (check our blog for more info)skpm/with-webview
- A template to create plugins displaying some rich UI in a WebView (check sketch-module-web-view for more info)skpm/with-actions
- A template to create plugins using the Actions API.
�� Tip: Any Github repo with a 'template' folder can be used as a custom template:skpm create <project-name> --template=<username>/<repository>
Once the installation is done, you can run some commands inside the project folder:
npm run build
To watch for changes:
npm run watch
Additionally, if you wish to run the plugin every time it is built:
npm run start
To view the output of your console.log
, you have a few different options:
sketch-dev-tools
Console.app
and look for the sketch logs~/Library/Logs/com.bohemiancoding.sketch3/Plugin Output.log
fileSkpm provides a convenient way to do the latter:
skpm log
-f, -F The `-f` option causes tail to not stop when end of file is
reached, but rather to wait for additional data to be appended
to the input. [boolean] [default: "false"]
--number, -n Shows `number` lines of the logs. [number]
To publish a new version of the plugin to the registry:
skpm publish <new-version> | major | minor | patch | premajor | preminor | prepatch | prerelease
--repo-url Specify the repository URL (default to the one specified
in package.json). [string]
--skip-release Do not create a release on GitHub.com. [boolean]
--open-release, -o Open the newly created release on GitHub.com. [boolean]
--skip-registry Do not publish to the plugins registry if not already
present. [boolean]
--download-url Specify the new version's download URL (default to the
asset of the release created on GitHub.com). [string]
The exact order of execution (without options) is as follows:
preversion
scriptversion
in package.json as requested (patch
, minor
, major
, etc).version
scriptpostversion
script.prepublish
or build
scriptmain
field拿 Sketch 49 的新 JS API 重构了一边 SketchSelect 和 NameOrganizer 插件,感受:Sketch JS API 文档比之前清晰太多,还带了示例代码片段,官方终于想起有这么个文档了 ?,但目前暴露的属性非常不全,只能说是阉割版,比如 TextLayer 的字体,ShapeLayer 的混合模式投影等,还有诸如导出,锁定,隐藏等状态都无法直接取到,还是得用其丑