Skip to content

Instantly share code, notes, and snippets.

@way2ex
Created November 5, 2020 03:31
Show Gist options
  • Save way2ex/bd774c5dc66192527439366b4b8f2f66 to your computer and use it in GitHub Desktop.
Save way2ex/bd774c5dc66192527439366b4b8f2f66 to your computer and use it in GitHub Desktop.
Run yarn command for multiple workspaces
# 调用方式
# sh batch.sh admin,audit,video add package -D
echo $@
# 拆分参数
allParams=($@)
command=${allParams[@]:1}
workspacesString=$1
echo $command
oldIFS=$IFS
IFS=,
workspacesList=($workspacesString)
IFS=$oldIFS
for workspace in ${workspacesList[@]};
do
echo current $workspace
yarn workspace $workspace ${command}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment