1const fs = require('fs'); 2const { spawnSync } = require('child_process'); 3const path = require('path'); 4const os = require('os'); 5function compileMock() { 6 const mockJsPath = path.join(__dirname, '..', './runtime/main/extend/systemplugin'); 7 let nodeDir = ''; 8 if (os.platform() === 'linux') { 9 nodeDir = './node-v12.18.4-linux-x64/bin/node'; 10 } else { 11 nodeDir = './node-v12.18.4-darwin-x64/bin/node'; 12 } 13 14 const bat = spawnSync(`${path.join(__dirname, '..', nodeDir)} ${path.join(__dirname, '..','./node_modules/typescript/bin/tsc')} && 15 ${path.join(__dirname, '..', nodeDir)} ${path.join(__dirname, 'dist')}/main.js && 16 ${path.join(__dirname, '..', nodeDir)} ${path.join(__dirname, '..', './node_modules/eslint/bin/eslint.js')} -c .eslintrc --fix ${mockJsPath}/**/*.js`, { 17 cwd: __dirname, 18 shell: true 19 }); 20} 21 22compileMock(); 23