upload.js
633 Bytes
const path = require('path');
const cp = require('child_process');
const genConfig = require('./gen-config');
const wxrc = require('./wxrc');
module.exports = ({code_path, ver, desc}) => {
genConfig({code_path, env: 'production'}).then(() => wxrc()).then(({wxpath}) => {
const ls = cp.spawn(`${wxpath}/cli`, [
'-u', `${ver}@${path.join(__dirname, '../', code_path)}`, '--upload-desc', desc
]);
ls.stdout.on('data', (data) => {
console.log(data.toString());
});
ls.stderr.on('data', (data) => {
console.log(data.toString());
});
}).catch(e => {
console.error('error', e);
});
};