Skip to content

Commit

Permalink
fix(ewa-cli): 修复因为路径中包含空格导致脚本执行报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lyfeyaj committed Jul 6, 2021
1 parent bef8c05 commit 264cb9a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion packages/cli/lib/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ module.exports = function build(type) {
utils.log('正在以生产模式编译项目...');

execSync(
`cd ${ROOT} && node ${script}`,
`node "${script}"`,
{
cwd: ROOT,
env: Object.assign({}, {
NODE_ENV: 'production',
EWA_ENV: type
Expand Down
34 changes: 19 additions & 15 deletions packages/cli/lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@ module.exports = function install(projectDir, successTip) {
}, 10000);
}, 10000);

exec(`cd ${projectDir} && npm i`, function(err) {
if (err) return utils.log(err, 'error');

if (tip) clearTimeout(tip);
if (loadingTip) clearInterval(loadingTip);

utils.log('安装完成 ^_^ !', 'success');
utils.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~', 'success');
utils.log('欢迎使用 ewa 工具, 运行命令: ', 'success');
console.log('');
console.log(` ${successTip}`);
console.log('');
utils.log('即可启动项目 ~ Enjoy!', 'success');
utils.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~', 'success');
});
exec(
'npm i',
{ cwd: projectDir },
function(err) {
if (err) return utils.log(err, 'error');

if (tip) clearTimeout(tip);
if (loadingTip) clearInterval(loadingTip);

utils.log('安装完成 ^_^ !', 'success');
utils.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~', 'success');
utils.log('欢迎使用 ewa 工具, 运行命令: ', 'success');
console.log('');
console.log(` ${successTip}`);
console.log('');
utils.log('即可启动项目 ~ Enjoy!', 'success');
utils.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~', 'success');
}
);
};
3 changes: 2 additions & 1 deletion packages/cli/lib/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ module.exports = async function start(type) {
utils.log('正在启动项目实时编译...');

execSync(
`cd ${ROOT} && node ${script}`,
`node "${script}"`,
{
cwd: ROOT,
env: Object.assign({}, {
NODE_ENV: 'development',
EWA_ENV: type
Expand Down

0 comments on commit 264cb9a

Please sign in to comment.