1 Star 0 Fork 0

Abel/micro-fun

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
copy.sh 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
cagataycali 提交于 2021-03-28 17:19 . ✔️ Added react testing library
#!/bin/bash
# Copy the boilerplate to the target
cp -rf templates/fragment src/$1
echo "$FUN_FRAGMENT_NAME $FUN_PORT" >> registry
# cp -rf templates/boilerplate src/$1
cd src/$1
mv components/component.js components/$FUN_FRAGMENT_NAME.js
# Author of script: https://github.com/cagataycali
# Original source: https://gist.github.com/cagataycali/917a90113aa7ac4819114fd45d9e0d2c
prefix="FUN_"
# Usage: FUN_PROVIDER='test' FUN_CAGATAY='CALI' ./replace.sh
# echo $FUN_DIRNAME
# The for loop below is taken from here:
# https://stackoverflow.com/questions/39529648/how-to-iterate-through-all-the-env-variables-printing-key-and-value
unset IFS
for var in "${!FUN_@}"; do
glob="s|#$var|${!var}|g"
# Debug with uncomment below echo.
# echo $glob # Will replace if the FUN_PROVIDER='TEST'
# The find code is taken from: https://superuser.com/a/537037
find . -type f -name "*" -not -path '*/\.git/*' -not -path '*/\node_modules/*' -exec sed -i'' -e $glob {} + 2> /dev/null
done
rm **/*-e 2> /dev/null
rm *-e 2> /dev/null
rm **/.*-e 2> /dev/null
rm .*-e 2> /dev/null
echo 'Cleanup success'
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/bbat/micro-fun.git
git@gitee.com:bbat/micro-fun.git
bbat
micro-fun
micro-fun
master

搜索帮助