binary-collections 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bash-dummy +51 -0
- package/bin/bash-dummy.cmd +25 -0
- package/bin/clean-nodemodule +17 -5
- package/bin/clean-nodemodules +17 -5
- package/bin/dev +17 -5
- package/bin/empty +17 -5
- package/bin/git-fix-encoding +17 -5
- package/bin/git-reduce-size +17 -5
- package/bin/javakill.cmd +1 -0
- package/bin/kill-process +17 -5
- package/bin/nodekill +17 -5
- package/bin/prod +17 -5
- package/bin/rmfind +17 -5
- package/bin/rmpath +17 -5
- package/bin/rmx +64 -0
- package/bin/submodule +152 -0
- package/bin/submodule-install +17 -9
- package/bin/submodule-remove +17 -5
- package/lib/npm-run-series.js +36 -35
- package/package.json +19 -10
- package/readme.md +55 -2
package/bin/bash-dummy
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
|
+
|
|
3
|
+
# put these on top of file
|
|
4
|
+
|
|
5
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
6
|
+
|
|
7
|
+
# absolute path working directory
|
|
8
|
+
basecwd=${PWD}
|
|
9
|
+
# base script directory
|
|
10
|
+
basedir=`dirname "$0"`
|
|
11
|
+
# absolute path script directory
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
16
|
+
|
|
17
|
+
case `uname` in
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# write a function
|
|
32
|
+
fresh(){
|
|
33
|
+
# t stores $1 argument passed to fresh()
|
|
34
|
+
t=$1
|
|
35
|
+
echo "fresh(): \$0 is $0"
|
|
36
|
+
echo "fresh(): \$1 is $1"
|
|
37
|
+
echo "fresh(): \$t is $t"
|
|
38
|
+
echo "fresh(): total args passed to me $#"
|
|
39
|
+
echo "fresh(): all args (\$@) passed to me -\"$@\""
|
|
40
|
+
echo "fresh(): all args (\$*) passed to me -\"$*\""
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# invoke the function with total 3 arguments
|
|
44
|
+
echo "**** calling fresh() with params ****"
|
|
45
|
+
fresh Tomato Onion Paneer
|
|
46
|
+
|
|
47
|
+
echo ""
|
|
48
|
+
|
|
49
|
+
# pass cli arguments to function params
|
|
50
|
+
echo "**** calling fresh() pass cli arguments into params ****"
|
|
51
|
+
fresh "$@"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
SETLOCAL enableExtensions enableDelayedExpansion
|
|
4
|
+
|
|
5
|
+
rem my malfunction keyboard 56^%
|
|
6
|
+
rem execute bash file with cygwin from batch script https://stackoverflow.com/a/43300782/6404439
|
|
7
|
+
|
|
8
|
+
set scriptDirPath=%~dp0
|
|
9
|
+
set terminalCwd=%CD%
|
|
10
|
+
set cygwinBinPath=c:\cygwin64\bin\
|
|
11
|
+
set minttyBin=%cygwinBinPath%mintty
|
|
12
|
+
set bashBin=%cygwinBinPath%bash
|
|
13
|
+
|
|
14
|
+
rem to inspect terminal output
|
|
15
|
+
rem c:\cygwin64\bin\mintty -h always /bin/bash -l /cygdrive/c/path/to/bash-script
|
|
16
|
+
rem run bash in the current console window
|
|
17
|
+
rem C:\cygwin64\bin\bash -l c:\path\to\your\script
|
|
18
|
+
rem run bash in new window (mintty)
|
|
19
|
+
rem C:\cygwin64\bin\mintty /bin/bash -l c:\path\to\your\script
|
|
20
|
+
|
|
21
|
+
rem %minttyBin% -h always /bin/bash -l %scriptDirPath%bash-dummy
|
|
22
|
+
|
|
23
|
+
%bashBin% -l %scriptDirPath%bash-dummy Hello World
|
|
24
|
+
|
|
25
|
+
ENDLOCAL
|
package/bin/clean-nodemodule
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
node_modules=()
|
|
20
32
|
locks=()
|
|
21
33
|
yarn_caches=()
|
package/bin/clean-nodemodules
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
echo "cleaning node_modules starts with letter vowels folders..."
|
|
20
32
|
|
|
21
33
|
vowels=( a i u e o A I U E O )
|
package/bin/dev
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
# resolve cli
|
|
20
32
|
CLI="$basedir/../node_modules/.bin/cross-env-shell"
|
|
21
33
|
if ! [ -x "$CLI" ]; then
|
package/bin/empty
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
## make non-binary file empty
|
|
20
32
|
|
|
21
33
|
truncate -s 0 "$1"
|
package/bin/git-fix-encoding
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
echo "fix auto rebase"
|
|
20
32
|
git config config.pull false
|
|
21
33
|
echo "force LF end of line"
|
package/bin/git-reduce-size
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
if [ -f ".gitmodules" ]; then
|
|
20
32
|
git submodule foreach "git reflog expire --all --expire=now | :"
|
|
21
33
|
git submodule foreach "git gc --prune=now --aggressive | :"
|
package/bin/javakill.cmd
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
taskkill /f /im java.exe
|
package/bin/kill-process
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,10 +9,23 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
ps -W | grep "$1" | awk '{print $1}' | xargs kill -f;
|
package/bin/nodekill
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
#kill -9 $(ps aux | grep '\\snode\\s' | awk '{print $2}')
|
|
20
32
|
|
|
21
33
|
if ! [ -x "$(command -v killall)" ]; then
|
package/bin/prod
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
# resolve cli
|
|
20
32
|
CLI="$basedir/../node_modules/.bin/cross-env-shell"
|
|
21
33
|
if ! [ -x "$CLI" ]; then
|
package/bin/rmfind
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
# delete filename or dirname recursively
|
|
20
32
|
|
|
21
33
|
if [ -z "$1" ]; then
|
package/bin/rmpath
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
# fast huge folder deleter
|
|
20
32
|
|
|
21
33
|
if [ -z "$1" ]; then
|
package/bin/rmx
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
|
+
|
|
3
|
+
# put these on top of file
|
|
4
|
+
|
|
5
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
6
|
+
|
|
7
|
+
# absolute path working directory
|
|
8
|
+
basecwd=${PWD}
|
|
9
|
+
# base script directory
|
|
10
|
+
basedir=`dirname "$0"`
|
|
11
|
+
# absolute path script directory
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
16
|
+
|
|
17
|
+
case `uname` in
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# fast huge folder deleter
|
|
32
|
+
|
|
33
|
+
if [ -z "$1" ]; then
|
|
34
|
+
echo "You need to provide a file or folder path"
|
|
35
|
+
exit
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# delete single file
|
|
39
|
+
if [ -f "$1" ]; then
|
|
40
|
+
rm -rf "$1"
|
|
41
|
+
exit
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
if [ ! -d "$1" ]; then
|
|
45
|
+
echo "$1 not found"
|
|
46
|
+
exit
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
rm -rf "$1" &
|
|
50
|
+
|
|
51
|
+
vowels=( a i u e o A I U E O )
|
|
52
|
+
for letter in {{a..z},{A..Z}}; do
|
|
53
|
+
for vowel in "${vowels[@]}"; do
|
|
54
|
+
toBeDeleted=( "$1/.${letter}*" "$1/@${letter}*" "$1/${letter}*" "$1/@${letter}${vowel}*" "$1/.${letter}${vowel}*" "$1/${letter}${vowel}*" )
|
|
55
|
+
shuffled=( $(shuf -e "${toBeDeleted[@]}") )
|
|
56
|
+
for fpath in "${shuffled[@]}"; do
|
|
57
|
+
if [ -d "$1" ]; then
|
|
58
|
+
rm -rf $fpath && echo "removed $fpath" || echo "cannot delete $fpath" &
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
done
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
wait
|
package/bin/submodule
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
|
+
|
|
3
|
+
# put these on top of file
|
|
4
|
+
|
|
5
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
6
|
+
|
|
7
|
+
# absolute path working directory
|
|
8
|
+
basecwd=${PWD}
|
|
9
|
+
# base script directory
|
|
10
|
+
basedir=`dirname "$0"`
|
|
11
|
+
# absolute path script directory
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
16
|
+
|
|
17
|
+
case `uname` in
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# auto clone all submodules, prevent not-matched hash
|
|
32
|
+
# set ACCESS_TOKEN=github_personal_tokens
|
|
33
|
+
# usages: sh folder_this_repo/submodule-install
|
|
34
|
+
|
|
35
|
+
update_submodule() {
|
|
36
|
+
# set default root
|
|
37
|
+
export ROOT="$(git rev-parse --show-toplevel)"
|
|
38
|
+
while test $# -gt 0; do
|
|
39
|
+
case "$1" in
|
|
40
|
+
-h|--help)
|
|
41
|
+
echo "$package - attempt to install submodules"
|
|
42
|
+
echo " "
|
|
43
|
+
echo "$package [options] application [arguments]"
|
|
44
|
+
echo " "
|
|
45
|
+
echo "options:"
|
|
46
|
+
echo "-h, --help show brief help"
|
|
47
|
+
echo "-o, --output-dir=DIR specify a directory to install submodules"
|
|
48
|
+
exit 0
|
|
49
|
+
;;
|
|
50
|
+
-cwd)
|
|
51
|
+
shift
|
|
52
|
+
if test $# -gt 0; then
|
|
53
|
+
export ROOT=$1
|
|
54
|
+
else
|
|
55
|
+
echo "no output dir specified"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
shift
|
|
59
|
+
;;
|
|
60
|
+
--cwd*)
|
|
61
|
+
export ROOT=`echo $1 | sed -e 's/^[^=]*=//g'`
|
|
62
|
+
shift
|
|
63
|
+
;;
|
|
64
|
+
*)
|
|
65
|
+
break
|
|
66
|
+
;;
|
|
67
|
+
esac
|
|
68
|
+
done
|
|
69
|
+
|
|
70
|
+
echo "installing submodules at $ROOT"
|
|
71
|
+
|
|
72
|
+
git -C "${REPO_PATH}" config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
|
|
73
|
+
while read -r KEY MODULE_PATH
|
|
74
|
+
do
|
|
75
|
+
# relative module path from root
|
|
76
|
+
RELATIVE_MODULE_PATH="${ROOT}/${MODULE_PATH}"
|
|
77
|
+
# cd git root dir
|
|
78
|
+
cd ${ROOT}
|
|
79
|
+
# If the module's path exists, remove it.
|
|
80
|
+
# This is done b/c the module's path is currently
|
|
81
|
+
# not a valid git repo and adding the submodule will cause an error.
|
|
82
|
+
if [ -d "${RELATIVE_MODULE_PATH}" ]; then
|
|
83
|
+
echo "deleting ${RELATIVE_MODULE_PATH}"
|
|
84
|
+
rm -rf "${RELATIVE_MODULE_PATH}"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
NAME="$(echo "${KEY}" | sed 's/^submodule\.\(.*\)\.path$/\1/')"
|
|
88
|
+
|
|
89
|
+
url_key="$(echo "${KEY}" | sed 's/\.path$/.url/')"
|
|
90
|
+
branch_key="$(echo "${KEY}" | sed 's/\.path$/.branch/')"
|
|
91
|
+
|
|
92
|
+
URL="$(git config -f .gitmodules --get "${url_key}")"
|
|
93
|
+
BRANCH="$(git config -f .gitmodules --get "${branch_key}" || echo "master")"
|
|
94
|
+
|
|
95
|
+
git -C "${REPO_PATH}" submodule add --force -b "${BRANCH}" --name "${NAME}" "${URL}" "${MODULE_PATH}" || echo "cannot add submodule ${MODULE_PATH}"
|
|
96
|
+
|
|
97
|
+
repo=${URL#"https://github.com/"}
|
|
98
|
+
if [ $ACCESS_TOKEN != "" ]; then
|
|
99
|
+
URL_WITH_TOKEN="https://${ACCESS_TOKEN}@github.com/${repo}"
|
|
100
|
+
echo "apply token for ${repo} at ${MODULE_PATH} branch ${BRANCH}"
|
|
101
|
+
GIT_MODULES="${RELATIVE_MODULE_PATH}/.gitmodules"
|
|
102
|
+
cd "${RELATIVE_MODULE_PATH}"
|
|
103
|
+
git remote set-url origin "${URL_WITH_TOKEN}"
|
|
104
|
+
fi
|
|
105
|
+
# fetch
|
|
106
|
+
git fetch --all
|
|
107
|
+
# pull
|
|
108
|
+
git pull origin "${BRANCH}"
|
|
109
|
+
if [ -f "${GIT_MODULES}" ]; then
|
|
110
|
+
echo "${MODULE_PATH} has submodules"
|
|
111
|
+
bash -e "${SCRIPT}" -cwd ${RELATIVE_MODULE_PATH}
|
|
112
|
+
fi
|
|
113
|
+
done
|
|
114
|
+
|
|
115
|
+
git -C "${REPO_PATH}" submodule update --init --recursive
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
remove_submodule() {
|
|
119
|
+
if [[ -z $1 || $1 == "" ]]; then
|
|
120
|
+
echo "input submodule path"
|
|
121
|
+
read folderpath
|
|
122
|
+
else
|
|
123
|
+
folderpath="$1"
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# Remove the submodule entry from .git/config
|
|
127
|
+
git submodule deinit -f $folderpath
|
|
128
|
+
|
|
129
|
+
# Remove the submodule directory from the superproject's .git/modules directory
|
|
130
|
+
if [ -d ".git/modules/$folderpath" ]; then
|
|
131
|
+
rm -rf .git/modules/$folderpath
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
|
|
135
|
+
if [ -d "$folderpath" ]; then
|
|
136
|
+
git rm -f $folderpath
|
|
137
|
+
fi
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
case $1 in
|
|
141
|
+
install|i)
|
|
142
|
+
update_submodule "$@"
|
|
143
|
+
;;
|
|
144
|
+
uninstall|remove|u|x)
|
|
145
|
+
remove_submodule "$@"
|
|
146
|
+
;;
|
|
147
|
+
*)
|
|
148
|
+
echo "no option found. Usage:"
|
|
149
|
+
echo "update submodule $SCRIPT [install|i]"
|
|
150
|
+
echo "remove submodule $SCRIPT [uninstall|remove|u|x]"
|
|
151
|
+
;;
|
|
152
|
+
esac
|
package/bin/submodule-install
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/bin/bash -e
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,20 +9,29 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
# auto clone all submodules, prevent not-matched hash
|
|
20
32
|
# set ACCESS_TOKEN=github_personal_tokens
|
|
21
33
|
# usages: sh folder_this_repo/submodule-install
|
|
22
34
|
|
|
23
|
-
# get script path
|
|
24
|
-
SCRIPT=$(realpath "$0")
|
|
25
|
-
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
26
|
-
|
|
27
35
|
# set default root
|
|
28
36
|
export ROOT="$(git rev-parse --show-toplevel)"
|
|
29
37
|
|
package/bin/submodule-remove
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
1
|
+
#!/usr/bin/env -S bash -e
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
3
|
+
# put these on top of file
|
|
5
4
|
|
|
6
5
|
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
6
|
|
|
@@ -10,12 +9,25 @@ basecwd=${PWD}
|
|
|
10
9
|
# base script directory
|
|
11
10
|
basedir=`dirname "$0"`
|
|
12
11
|
# absolute path script directory
|
|
13
|
-
SCRIPT_DIR=$(
|
|
12
|
+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
|
|
13
|
+
# get script path
|
|
14
|
+
SCRIPT=$(realpath "$0")
|
|
15
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
14
16
|
|
|
15
17
|
case `uname` in
|
|
16
|
-
*CYGWIN*)
|
|
18
|
+
*CYGWIN*)
|
|
19
|
+
basedir=`cygpath -w "$basedir"`
|
|
20
|
+
# make cygwin bin as priority
|
|
21
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH"
|
|
22
|
+
;;
|
|
17
23
|
esac
|
|
18
24
|
|
|
25
|
+
# parse and export .env file (dotenv)
|
|
26
|
+
if [ -f ".env" ]; then
|
|
27
|
+
# Export the vars in .env into your shell:
|
|
28
|
+
export $(egrep -v '^#' .env | xargs)
|
|
29
|
+
fi
|
|
30
|
+
|
|
19
31
|
echo "input submodule path"
|
|
20
32
|
read folderpath
|
|
21
33
|
|
package/lib/npm-run-series.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const fs = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const { Minimatch } = require(
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { Minimatch } = require('minimatch');
|
|
6
6
|
|
|
7
|
-
const args = require(
|
|
7
|
+
const args = require('minimist')(process.argv.slice(2));
|
|
8
8
|
const cwd = process.cwd();
|
|
9
|
-
const packagejson = path.join(cwd,
|
|
10
|
-
const verbose = args[
|
|
9
|
+
const packagejson = path.join(cwd, 'package.json');
|
|
10
|
+
const verbose = args['v'] || args['verbose'];
|
|
11
|
+
const usingYarn = args['yarn'];
|
|
11
12
|
|
|
12
13
|
(async function npmRunSeries() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const { execa } = await import('execa');
|
|
15
|
+
if (fs.existsSync(packagejson)) {
|
|
16
|
+
/**
|
|
17
|
+
* @type {import('../package.json')}
|
|
18
|
+
*/
|
|
19
|
+
const parse = JSON.parse(fs.readFileSync(packagejson, 'utf-8'));
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
if (parse !== null && typeof parse === 'object') {
|
|
22
|
+
if ('scripts' in parse) {
|
|
23
|
+
const patterns = args._;
|
|
24
|
+
const scripts = parse.scripts;
|
|
25
|
+
const scriptNames = Object.keys(scripts);
|
|
26
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
27
|
+
const pattern = patterns[i];
|
|
28
|
+
const matcher = new Minimatch(pattern, { nonegate: true });
|
|
29
|
+
for (let ii = 0; ii < scriptNames.length; ii++) {
|
|
30
|
+
const scriptName = scriptNames[ii];
|
|
31
|
+
const match = matcher.match(scriptName);
|
|
32
|
+
if (verbose) console.log({ pattern, scriptName, match });
|
|
33
|
+
if (match === true) {
|
|
34
|
+
await execa(usingYarn ? 'yarn' : 'npm', ['run', scriptName], {
|
|
35
|
+
cwd,
|
|
36
|
+
stdio: 'inherit'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
43
44
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "binary-collections",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "binary helper collections by L3n4r0x",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"!releases"
|
|
11
11
|
],
|
|
12
12
|
"directories": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"lib": "lib",
|
|
14
|
+
"test": "test"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"update:packer": "curl -L https://github.com/dimaslanjaka/nodejs-package-types/raw/main/packer.js > packer.js",
|
|
18
|
-
"build": "node build.js && yarn run pack",
|
|
18
|
+
"build": "node -r ts-node/register -r dotenv/config build.js && yarn run pack",
|
|
19
19
|
"test": "cd test && npm install -D file:../ &&",
|
|
20
20
|
"test:nrs": "npm test -- nrs build:**",
|
|
21
21
|
"pack": "node packer.js --yarn --filename=bin"
|
|
@@ -29,13 +29,19 @@
|
|
|
29
29
|
"glob": "^10.2.2",
|
|
30
30
|
"minimatch": "^9.0.0",
|
|
31
31
|
"minimist": "^1.2.8",
|
|
32
|
-
"upath": "^2.0.1"
|
|
32
|
+
"upath": "^2.0.1",
|
|
33
|
+
"yaml": "^2.3.1"
|
|
33
34
|
},
|
|
34
|
-
"packageManager": "yarn@3.
|
|
35
|
+
"packageManager": "yarn@3.6.1",
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/minimist": "^1",
|
|
37
38
|
"@types/node": "^18.16.3",
|
|
38
|
-
"@types/yargs": "^17"
|
|
39
|
+
"@types/yargs": "^17",
|
|
40
|
+
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/ff4b648/release/cross-spawn.tgz",
|
|
41
|
+
"dotenv": "^16.3.1",
|
|
42
|
+
"git-command-helper": "^2.0.1",
|
|
43
|
+
"ts-node": "^10.9.1",
|
|
44
|
+
"typescript": "^5.2.2"
|
|
39
45
|
},
|
|
40
46
|
"optionalDependencies": {
|
|
41
47
|
"ansi-colors": "^4.1.3"
|
|
@@ -46,19 +52,22 @@
|
|
|
46
52
|
"dev": "bin/dev",
|
|
47
53
|
"empty": "bin/empty",
|
|
48
54
|
"git-fix-encoding": "bin/git-fix-encoding",
|
|
49
|
-
"git-fix-encoding
|
|
55
|
+
"git-fix-encoding-cmd": "bin/git-fix-encoding.cmd",
|
|
50
56
|
"git-reduce-size": "bin/git-reduce-size",
|
|
57
|
+
"javakill-cmd": "bin/javakill.cmd",
|
|
51
58
|
"kill-process": "bin/kill-process",
|
|
52
59
|
"nodekill": "bin/nodekill",
|
|
53
|
-
"nodekill
|
|
54
|
-
"nodekill
|
|
60
|
+
"nodekill-cmd": "bin/nodekill.cmd",
|
|
61
|
+
"nodekill-ps1": "bin/nodekill.ps1",
|
|
55
62
|
"npm-run-series": "lib/npm-run-series.js",
|
|
56
63
|
"nrs": "lib/npm-run-series.js",
|
|
57
64
|
"prod": "bin/prod",
|
|
58
65
|
"rmfind": "bin/rmfind",
|
|
59
66
|
"rmpath": "bin/rmpath",
|
|
67
|
+
"rmx": "bin/rmx",
|
|
60
68
|
"run-s": "lib/npm-run-series.js",
|
|
61
69
|
"run-series": "lib/npm-run-series.js",
|
|
70
|
+
"submodule": "bin/submodule",
|
|
62
71
|
"submodule-install": "bin/submodule-install",
|
|
63
72
|
"submodule-remove": "bin/submodule-remove"
|
|
64
73
|
}
|
package/readme.md
CHANGED
|
@@ -10,7 +10,7 @@ git clone -b master https://github.com/dimaslanjaka/bin bin
|
|
|
10
10
|
|
|
11
11
|
via npm
|
|
12
12
|
```bash
|
|
13
|
-
npm install binary-collections@https://github.com/dimaslanjaka/bin
|
|
13
|
+
npm install binary-collections@git+https://github.com/dimaslanjaka/bin.git
|
|
14
14
|
# or
|
|
15
15
|
npm install binary-collections@https://github.com/dimaslanjaka/bin/raw/master/releases/bin.tgz
|
|
16
16
|
```
|
|
@@ -61,4 +61,57 @@ create `.vscode/settings.json`
|
|
|
61
61
|
see all binary at
|
|
62
62
|
- https://github.com/dimaslanjaka/bin/tree/master/bin
|
|
63
63
|
- https://github.com/dimaslanjaka/bin/tree/master/lib
|
|
64
|
-
- https://github.com/dimaslanjaka/bin/blob/master/package.json
|
|
64
|
+
- https://github.com/dimaslanjaka/bin/blob/master/package.json
|
|
65
|
+
|
|
66
|
+
### npm scripts runner
|
|
67
|
+
|
|
68
|
+
> binaries: `nrs`, `run-s`, `run-series`
|
|
69
|
+
|
|
70
|
+
| arg | description |
|
|
71
|
+
| :--- | :--- |
|
|
72
|
+
| `--yarn` | using `yarn run <script-name>` |
|
|
73
|
+
| `--verbose` `-v` | using `yarn run <script-name>` |
|
|
74
|
+
|
|
75
|
+
example: `npm run namescript`
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"name": "package-name",
|
|
80
|
+
"version": "0.0.0",
|
|
81
|
+
"private": true,
|
|
82
|
+
"scripts": {
|
|
83
|
+
"namescript:xx": "echo xx",
|
|
84
|
+
"namescript:xxx": "echo xxx",
|
|
85
|
+
"namescript:xxxx": "echo xxxx",
|
|
86
|
+
"namescript:xxxxx": "echo xxxxx",
|
|
87
|
+
"namescript": "nrs --yarn=true --verbose=true \"namescript:**\""
|
|
88
|
+
},
|
|
89
|
+
"license": "ISC"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## troubleshooting
|
|
94
|
+
### submodule-install
|
|
95
|
+
|
|
96
|
+
when you're facing error like
|
|
97
|
+
```log
|
|
98
|
+
fatal: 'origin/<branch>' is not a commit and a branch '<branch>' cannot be created from it
|
|
99
|
+
fatal: unable to checkout submodule '<folder>/<submodule>'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
solution: deleting `.git/modules` before execute `submodule-install`.
|
|
103
|
+
|
|
104
|
+
example single execution:
|
|
105
|
+
```bash
|
|
106
|
+
echo "init submodules"
|
|
107
|
+
git submodule init
|
|
108
|
+
git submodule foreach "git submodule init"
|
|
109
|
+
echo "sync submodules"
|
|
110
|
+
git submodule sync
|
|
111
|
+
git submodule foreach "git submodule sync"
|
|
112
|
+
echo "update submodules"
|
|
113
|
+
mkdir -p bin >/dev/null 2>&1
|
|
114
|
+
curl -L https://github.com/dimaslanjaka/bin/raw/master/bin/submodule-install > bin/submodule-install
|
|
115
|
+
rm -rf .git/modules
|
|
116
|
+
bash ./bin/submodule-install
|
|
117
|
+
```
|