This commit is contained in:
陆柯 2022-10-18 11:04:44 +08:00
parent 0e27993ffd
commit 5c0238ac99
7 changed files with 122 additions and 19 deletions

View File

@ -37,10 +37,10 @@ for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not "%%o" == ".vscode" (
@REM 如果同时使用了 GIT 和 云盘进行管理,每次 git pull 都会造成 .git 目录下某些文件变化,导致云盘不断自动同步。因此过滤掉云盘的目录不做更新。
echo %%o | findstr "=" >NUL && (
echo !!!!!!!! omitting [%FONPATH%\%%o] !!!!!!!!
echo;
) || (
@REM echo %%o | findstr "=" >NUL && (
@REM echo !!!!!!!! omitting [%FONPATH%\%%o] !!!!!!!!
@REM echo;
@REM ) || (
echo ======== entering [%FONPATH%\%%o] ========
echo;
pushd %%o
@ -54,7 +54,7 @@ for /d %%o in (*) do (
)
)
popd
)
@REM )
)
)

View File

@ -32,7 +32,7 @@ pushd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '?*.git' | grep -v 'node_modules' | while read repo
find . -mindepth 1 -maxdepth 3 -type d -name '?*' | grep -v 'node_modules' | while read repo
do
if [ -d "$repo/.git" ]
then

View File

@ -42,7 +42,7 @@ do
echo "<<<< npm booting: [$org/$repo] <<<<"
cd "$repo"
npm run boot
echo ">>>> npm bootted: [$org/$repo] >>>>"
echo ">>>> npm booted: [$org/$repo] >>>>"
echo ""
cd ..
fi

54
npm-boot-recursive.bat Normal file
View File

@ -0,0 +1,54 @@
@echo off
@REM 首先清除可能残留的变量
set FONPATH=
@ if not "" == "%1" (
set FONPATH=%1
) else (
if exist D:\faronear (
set FONPATH=D:\faronear
) else (if exist C:\faronear (
set FONPATH=C:\faronear
) else (if exist %HOMEDRIVE%%HOMEPATH%\faronear (
set FONPATH=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo === Enter [target path] or leave [blank] for default to `.`
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
)
)))
)
if not exist "%FONPATH%" (
echo *** [%FONPATH%] not exist! Exit now. ***
@ GOTO END
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo;
for /d /r %%r in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not "%%r" == ".vscode" (
if exist "%%r\package.json" (
findstr "\"boot\"" "%%r\package.json" >NUL && (
pushd %%r
echo ---- npm booting [%FONPATH%\%%r] ----
npm run boot
echo;
popd
)
)
)
)
popd
:END
pause

47
npm-boot-recursive.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
if [ $1 ]
then
FONPATH=$1
elif [ -d /faronear ]
then
FONPATH=/faronear
elif [ -d ~/faronear ]
then
FONPATH=~/faronear
elif [ -d /mnt/d/faronear ]
then
FONPATH=/mnt/d/faronear
else
echo "=== Enter [target path] or leave [blank] for default to `.`"
read -p ">>> " FONPATH
echo ""
if [ ! $FONPATH ]
then
FONPATH=.
fi
fi
if [ ! -d $FONPATH ]
then
echo "*** [$FONPATH] not exist! Exit now. ***"
exit
fi
pushd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '?*' | grep -v 'node_modules' | while read repo
do
if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" )
then
echo "---- npm booting: [`pwd`/$repo] ----"
pushd "$repo"
npm run boot
echo "---- npm booted: [`pwd`/$repo] ----"
echo ""
popd
fi
done
popd

View File

@ -34,19 +34,21 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
echo ======== entering [%FONPATH%\%%o] ========
echo;
pushd %%o
for /d %%g in (*) do (
if exist %%g\node_modules (
pushd %%g
echo ---- Deleting [%%g\node_modules] ----
rd /s /q node_modules
echo;
popd
@ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ========
echo;
pushd %%o
for /d %%g in (*) do (
if exist %%g\node_modules (
pushd %%g
echo ---- Deleting [%%g\node_modules] ----
rd /s /q node_modules
echo;
popd
)
)
popd
)
popd
)
popd

View File

@ -34,7 +34,7 @@ echo;
for /d /r %%r in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not "%%r" == ".vscode" (
if exist "%%r\.git" (
if exist "%%r\node_modules" (
pushd "%%r"
echo ---- Deleting [%FONPATH%\%%r] ----
rd /s /q node_modules