Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/mars-build/src/compiler/file/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ exports.gulpPlugin = function (options) {
return cb();
}
if (file.isBuffer()) {
try {
compile(file, options).then(_ => cb(null, file));
}
catch (e) {
log.error('[COMPILE ERROR]:', e);
}
compile(file, options)
.then(_ => cb(null, file))
.catch(err => {
log.error('[COMPILE ERROR]:', err);
cb(null, file);
});
return;
}
// for other file type
Expand Down
12 changes: 6 additions & 6 deletions packages/mars-build/src/gulp-mars-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ function gulpPlugin(opt = {dest: './dist'}, compilers) {
return cb();
}
if (file.isBuffer()) {
try {
compile(file, opt, compilers).then(_ => cb(null, file));
}
catch (e) {
log.error('[COMPILE ERROR]:', e);
}
compile(file, opt, compilers)
.then(_ => cb(null, file))
.catch(err => {
log.error('[COMPILE ERROR]:', err);
cb(null, file);
});
}
});
return stream;
Expand Down
42 changes: 24 additions & 18 deletions packages/mars-cli/lib/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
* @author meixuguang
*/

const {error, stopSpinner} = require('@vue/cli-shared-utils');
/* eslint-disable fecs-no-require */
/* eslint-disable no-console */

const {stopSpinner} = require('@vue/cli-shared-utils');
const logger = require('@vue/cli-shared-utils/lib/logger');
const execa = require('execa');
const fs = require('fs-extra');

function executeCommand(command, args, targetDir) {
return new Promise((resolve, reject) => {

const child = execa(command, args, {
cwd: targetDir,
stdio: ['inherit', 'inherit', 'inherit']
});

child.on('close', code => {
if (code !== 0) {
reject(`command failed: ${command} ${args.join(' ')}`);
return;
}
resolve();
});
async function executeCommand(command, args, targetDir) {
const child = execa(command, args, {
cwd: targetDir
});

child.stdout.pipe(process.stdout);

const res = await child;

if (res.code !== 0) {
logger.error(`command failed: ${command} ${args.join(' ')}\n`);
}

return res;
}

const dependencyList = [
Expand All @@ -49,7 +51,11 @@ async function update(cmd) {
forceUpdate(cmd.registry);
}
else {
compatibleUpdate(cmd.registry);
const res = await compatibleUpdate(cmd.registry);

if (!res.stdout && !res.stderr) {
logger.info('所有依赖已是最新。');
}
}
}

Expand Down Expand Up @@ -84,7 +90,7 @@ async function forceUpdate(registry) {
module.exports = (...args) =>
update(...args).catch(err => {
stopSpinner(false); // do not persist
error(err);
logger.error(err);
if (!process.env.VUE_CLI_TEST) {
process.exit(1);
}
Expand Down