sf-sketch-rpc
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -16,6 +16,2 @@ Object.defineProperty(exports, "__esModule", { | ||
var _coscript = require('coscript'); | ||
var _coscript2 = _interopRequireDefault(_coscript); | ||
var _lodash = require('lodash'); | ||
@@ -46,2 +42,4 @@ | ||
var coscript = require('coscript'); | ||
var readManifestForPluginBundle = function readManifestForPluginBundle(bundlePath) { | ||
@@ -113,3 +111,3 @@ try { | ||
var str = '"' + String(_coscript2['default']) + '" -e "' + String(script) + '"'; | ||
var str = '"' + String(coscript) + '" -e "' + String(script) + '"'; | ||
exec(str, function (err, stdout, stderr) { | ||
@@ -142,3 +140,3 @@ if (err) { | ||
var str = '"' + String(_coscript2['default']) + '" -e "' + String(script) + '"'; | ||
var str = '"' + String(coscript) + '" -e "' + String(script) + '"'; | ||
exec(str, function (err, stdout, stderr) { | ||
@@ -145,0 +143,0 @@ if (err) { |
@@ -10,2 +10,10 @@ Object.defineProperty(exports, "__esModule", { | ||
var _fs = require('fs'); | ||
var _fs2 = _interopRequireDefault(_fs); | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _mustache = require('mustache'); | ||
@@ -21,10 +29,19 @@ | ||
var templates = { | ||
/* | ||
const templates = { | ||
'bootstrap-plugin-instance': require('raw-loader!./templates/bootstrap-plugin-instance.js'), | ||
'coscript-executor': require('raw-loader!./templates/coscript-executor.js'), | ||
'plugin-command-executor': require('raw-loader!./templates/plugin-command-executor.js') | ||
'plugin-command-executor': require('raw-loader!./templates/plugin-command-executor.js'), | ||
}; | ||
*/ | ||
/* | ||
const readTemplateNamed = (name) => { | ||
let script = templates[name]; | ||
return _.replace(_.replace(script,/"<</g,''),/>>"/g,''); | ||
}; | ||
*/ | ||
var readTemplateNamed = function readTemplateNamed(name) { | ||
var script = templates[name]; | ||
var script = _fs2['default'].readFileSync(_path2['default'].join(_path2['default'].resolve(__dirname, 'templates'), String(name) + '.js'), 'utf8'); | ||
return _lodash2['default'].replace(_lodash2['default'].replace(script, /"<</g, ''), />>"/g, ''); | ||
@@ -31,0 +48,0 @@ }; |
{ | ||
"name": "sf-sketch-rpc", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "RPC module based on `coscript` cli for running scripts in Sketch runtime on node.js platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,3 +5,4 @@ | ||
import path from 'path'; | ||
import coscript from 'coscript'; | ||
const coscript = require('coscript'); | ||
import _ from 'lodash'; | ||
@@ -8,0 +9,0 @@ import AppleScript from 'applescript'; |
import _ from 'lodash' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import Mustache from 'mustache'; | ||
import jsStringEscape from 'js-string-escape'; | ||
/* | ||
const templates = { | ||
@@ -11,3 +14,5 @@ 'bootstrap-plugin-instance': require('raw-loader!./templates/bootstrap-plugin-instance.js'), | ||
}; | ||
*/ | ||
/* | ||
const readTemplateNamed = (name) => { | ||
@@ -17,3 +22,9 @@ let script = templates[name]; | ||
}; | ||
*/ | ||
const readTemplateNamed = (name) => { | ||
let script = fs.readFileSync(path.join(path.resolve(__dirname,'templates'),`${name}.js`),'utf8'); | ||
return _.replace(_.replace(script,/"<</g,''),/>>"/g,''); | ||
}; | ||
export const buildScript = (scriptName,appName,params) => { | ||
@@ -20,0 +31,0 @@ let targetScript = readTemplateNamed(scriptName); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29837
540
4