我是一个完整的linux和CSH脚本新手,我目前正在使用reactjs + node + npm + webpack开发一个UI项目。
正如你现在可能需要的,我需要运行webpack捆绑,以获得符合要求的文件。
我的项目正在linux机器上部署。
这是我的项目结构如下所示,

如上所示,我需要在uibuild.csh文件中编写csh脚本,
所以这就是我认为的伪码,
脚本将从
project/web-inf/script/uibuild.csh
'npm安装‘'npm运行构建’
到目前为止,我已经尝试通过使用这个脚本来检查是否安装了节点。
if(`where node` == "") then
printf "\nNode.js and Npm not installed. Please install and continue\n";
exit(1);
endif但是我不知道如何改变目录和运行脚本??
有人能解决这个问题吗?
如果你需要更多的细节,我很乐意提供。
发布于 2016-06-23 10:56:19
if which node > /dev/null ; then
printf 'Node.js & NPM installed, continue start builing.. \n'
else
printf '\x1B[31m Node.js & NPM is not installed, exiting now.. \x1B[0m \n'
exit 0;
fi
printf 'Current working Directory :: '
pwd
cd ../../uisrc/
printf 'Current working Directory :: '
pwd
cd dist/
rm -rf index.html assets fixtures
cd ..
npm install --verbose
npm run build
cd ..
rm -rf index.html assets fixtures
cd uisrc/
mv dist/* ../https://stackoverflow.com/questions/37894354
复制相似问题