index.js
function runPluginWithIdentifier (pluginName, identifier, options = {}) {
  const pluginFolderPath = options.dir || pluginFolder();

  // Append `.sketchplugin` if not passed in with the plugin name
  if (!pluginName.endsWith('.sketchplugin')) {
    pluginName += '.sketchplugin';
  }
  const pluginPath = `${pluginFolderPath}/${pluginName}`;

  // Check if the plugin actually exists before running anything!
  const exists = fs.existsSync(pluginPath);
  invariant(
    exists,
    `Plugin '${pluginPath}' not found! Cannot run plugin command!`
  );

  let args = '';

  if (options.context) {
    args += `--context='${JSON.stringify(options.context)}' `;
  }

  sketchtoolExec(`run ${escape(pluginPath)} ${identifier} ${args}`);
}
function runPluginWithIdentifier (pluginName, identifier, options = {}) {
  const pluginFolderPath = options.dir || pluginFolder();

  // Append `.sketchplugin` if not passed in with the plugin name
  if (!pluginName.endsWith('.sketchplugin')) {
    pluginName += '.sketchplugin';
  }
  const pluginPath = `${pluginFolderPath}/${pluginName}`;

  // Check if the plugin actually exists before running anything!
  const exists = fs.existsSync(pluginPath);
  invariant(
    exists,
    `Plugin '${pluginPath}' not found! Cannot run plugin command!`
  );

  let args = '';

  if (options.context) {
    args += `--context='${JSON.stringify(options.context)}' `;
  }

  sketchtoolExec(`run ${escape(pluginPath)} ${identifier} ${args}`);
}
function runPluginWithIdentifier ( pluginName , identifier , options = { } ) { const pluginFolderPath = options . dir || pluginFolder ( ) ; // Append `.sketchplugin` if not passed in with the plugin name if ( ! pluginName . endsWith ( '.sketchplugin' ) ) { pluginName += '.sketchplugin' ; } const pluginPath = ` ${ pluginFolderPath } ${ pluginName } ` ; // Check if the plugin actually exists before running anything! const exists = fs . existsSync ( pluginPath ) ; invariant ( exists , ` ${ pluginPath } ` ) ; let args = '' ; if ( options . context ) { args += ` ${ JSON . stringify ( options . context ) } ` ; } sketchtoolExec ( ` ${ escape ( pluginPath ) } ${ identifier } ${ args } ` ) ; }
Run given plugin command of given plugin name
@param  {string} pluginName
@param  {string} identifier
@param  {Object} options
Run given plugin command of given plugin name