npm install -g skpm
The npm
command-line tool is bundled with Node.js. If you have it installed, then you already have npm too. If not, go download Node.js.
I'm a sketch user
I'm a plugin developer
- Scaffold the architecture of a new plugin
- Build the plugin
- Symlinking the local plugin to the sketch plugins folder
- Publish the plugin on the registry
To install a sketch plugin:
skpm install name-of-the-plugin
To uninstall a sketch plugin:
skpm uninstall name-of-the-plugin
To search for a sketch plugin:
skpm search query
To interactively create the architecture to start developing a new plugin (see the sketch documentation for more information):
skpm init
This will create:
- a
package.json
file - a
src
folder with:- a
manifest.json
file - a
command.js
file for an example of command
- a
- a
.gitignore
file if non-existent
The package.json
must contain 3 specific fields:
main
: pointing to your.sketchplugin
manifest
: pointing to yourmanifest.json
(src/manifest.json
by default)repository
: pointing to your github repository
To transpile the JavaScript to CocoaScript and copy the manifest.json
to the .sketchplugin
:
skpm build
To watch for changes:
skpm build --watch
Additionally, some fields from the package.json
will be set in the manifest.json
(if not present):
- version
- name
- description
- homepage
skpm link path-to-local-plugin
It will also ask you if you want to disable the caching mechanism and force Sketch to always reload a Pluginβs code from disk (recommended when developing).
To publish a new version of the plugin to the registry:
skpm publish <newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease
The exact order of execution is as follows:
- Run the
preversion
script - Bump
version
in package.json as requested (patch
,minor
,major
, etc). - Run the
version
script - Commit and tag
- Run the
postversion
script. - Run the
build
script - Zip the folder specified in the
main
field - Create a draft release on GitHub
- Upload the zip to GitHub
- Publish the release
- Remove the zip
- Notify the registry