Fetch the repository succeeded.
This action will force synchronization from D2C/lens, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
#!/usr/bin/env node
const program = require('commander');
const ns = require('node-sketch');
const SketchToDsl = require('./src/index');
const path = require('path');
const Tools = require('./src/tools');
const process = require('process');
global.yunjin = {
ROOT_PATH: path.resolve(__dirname, '.'),
RUNTIME_PATH: path.resolve(__dirname, './.runtime'),
SRC_PATH: path.resolve(__dirname, './src'),
WORK_PATH: process.cwd(),
WORK_RUNTIME_PATH: path.resolve(process.cwd(), './.runtime'), // 运行时
WORK_RUNTIME_SNAPSHOT: path.resolve(process.cwd(), './.runtime/snapshot'), // 画板png快照路径
WORK_RUNTIME_UIDSL: path.resolve(process.cwd(), './.runtime/uidsl'), // 画板dsl快照路径
config: require(path.resolve(__dirname, './.yunjinrc.js'))
};
global.classNameTotal = {};
global.tools = new Tools();
(async() => {
global.yunjin.config = await global.tools.getConfig('');
})();
const DB = require('better-sqlite3')(path.resolve(yunjin.ROOT_PATH, './db.sqlite3'), { verbose: null });
global.db = DB;
program.version('0.2.0', '-v, --version')
.command('generate <platform>')
.alias('g')
.description('generate mobile html template')
.action(async(platform) => {
// console.log('platform',platform,global.tools.getConfig(''));
const config = global.tools.getConfig();
if (!config[platform]) {
console.error('未找到[' + platform + ']相关配置');
return;
}
config.target = config[platform];
config.target.platform = platform;
global.yunjin.config = config;
await tools.sleep(500);
// return;
const sketch = await ns.read(path.resolve(yunjin.WORK_PATH, yunjin.config.source.path));
const sketchToDsl = new SketchToDsl(sketch, yunjin.config.target.platform, yunjin.config.source.artboardName);
// sketchToDsl.saveToJson();
sketchToDsl.parseLayer();
});
program.parse(process.argv);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。