@wubafe/picasso
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "@wubafe/picasso", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "sketch设计稿智能解析工具", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -98,2 +98,18 @@ const fs = require('fs'); | ||
/** | ||
* 封装脚本异步执行方法 | ||
* @param {string} sketchtoolString 命令行脚本string | ||
*/ | ||
const processAsync = (sketchtoolString) => { | ||
return new Promise((resolve,reject) => { | ||
process.exec(sketchtoolString, { maxBuffer: 20000*1024 }, (error,stdout,stderr) => { | ||
if (error||stderr) { | ||
reject(error); | ||
} else { | ||
resolve(stdout); | ||
} | ||
}); | ||
}) | ||
}; | ||
/** | ||
* 单个sketch解析 | ||
@@ -161,4 +177,6 @@ * | ||
const rst = process.execSync(`${sketchtoolPath} metadata ${cliSketchResourcePath}/${sketchName}.sketch`); | ||
let doc = process.execSync(`${sketchtoolPath} dump ${cliSketchResourcePath}/${sketchName}.sketch`); | ||
let doc = await processAsync(`${sketchtoolPath} dump ${cliSketchResourcePath}/${sketchName}.sketch`); | ||
let foreignSymbols = JSON.parse(doc.toString()).foreignSymbols; | ||
appVersion = JSON.parse(rst.toString()).appVersion; | ||
@@ -268,3 +286,3 @@ // skethc文件版本和当前sketch软件一致 且 外部库都已经转化为内部库 | ||
} | ||
}, 100); | ||
}, 1000); | ||
} catch (error) { | ||
@@ -271,0 +289,0 @@ console.log(error); |
Sorry, the diff of this file is not supported yet
13679
2673413
156