binary-collections 1.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/LICENSE +21 -0
- package/bin/clean-nodemodule +87 -0
- package/bin/clean-nodemodules +56 -0
- package/bin/dev +28 -0
- package/bin/empty +21 -0
- package/bin/git-fix-encoding +22 -0
- package/bin/git-fix-encoding.cmd +6 -0
- package/bin/git-reduce-size +25 -0
- package/bin/kill-process +19 -0
- package/bin/nodekill +25 -0
- package/bin/nodekill.cmd +1 -0
- package/bin/nodekill.ps1 +1 -0
- package/bin/prod +28 -0
- package/bin/rmfind +27 -0
- package/bin/rmpath +53 -0
- package/bin/submodule-install +105 -0
- package/bin/submodule-remove +29 -0
- package/index.js +1 -0
- package/lib/npm-run-series.js +43 -0
- package/lib/package-resolutions.json +22 -0
- package/package.json +64 -0
- package/readme.md +57 -0
- package/releases/bin +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Dimas Lanjaka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
node_modules=()
|
|
20
|
+
locks=()
|
|
21
|
+
yarn_caches=()
|
|
22
|
+
|
|
23
|
+
while IFS= read -r -d $'\0'; do
|
|
24
|
+
locks+=("$REPLY")
|
|
25
|
+
done < <(find "${basecwd}" -name "yarn.lock" -print0)
|
|
26
|
+
|
|
27
|
+
unset IFS;
|
|
28
|
+
|
|
29
|
+
while IFS= read -r -d $'\0'; do
|
|
30
|
+
locks+=("$REPLY")
|
|
31
|
+
done < <(find "${basecwd}" -name "package-lock.json" -print0)
|
|
32
|
+
|
|
33
|
+
unset IFS;
|
|
34
|
+
|
|
35
|
+
while IFS= read -r -d $'\0'; do
|
|
36
|
+
node_modules+=("$REPLY")
|
|
37
|
+
done < <(find "${basecwd}" -name "node_modules" -print0)
|
|
38
|
+
|
|
39
|
+
unset IFS;
|
|
40
|
+
|
|
41
|
+
while IFS= read -r -d $'\0'; do
|
|
42
|
+
yarn_caches+=("$REPLY")
|
|
43
|
+
done < <(find "${basecwd}" -wholename "*/.yarn/cache" -print0)
|
|
44
|
+
|
|
45
|
+
unset IFS;
|
|
46
|
+
|
|
47
|
+
#printf "%s\n" "${yarn_caches[@]}"
|
|
48
|
+
#printf "%s\n" "${node_modules[@]}"
|
|
49
|
+
#printf "%s\n" "${locks[@]}"
|
|
50
|
+
|
|
51
|
+
echo "removing locks"
|
|
52
|
+
for lock in "${locks[@]}"; do
|
|
53
|
+
rm -rf "$lock" && echo "removed $lock" &
|
|
54
|
+
done
|
|
55
|
+
|
|
56
|
+
wait
|
|
57
|
+
|
|
58
|
+
paths=("${yarn_caches[@]}" "${node_modules[@]}")
|
|
59
|
+
#echo ${paths[@]}
|
|
60
|
+
#echo "count ${#paths[@]}"
|
|
61
|
+
|
|
62
|
+
# https://unix.stackexchange.com/questions/482393/bash-sort-array-according-to-length-of-elements
|
|
63
|
+
|
|
64
|
+
indexes=( $(
|
|
65
|
+
for i in "${!paths[@]}" ; do
|
|
66
|
+
printf '%s %s %s\n' $i "${#paths[i]}" "${paths[i]}"
|
|
67
|
+
done | sort -nrk2,2 -rk3 | cut -f1 -d' '
|
|
68
|
+
))
|
|
69
|
+
|
|
70
|
+
sorted=()
|
|
71
|
+
for i in "${indexes[@]}" ; do
|
|
72
|
+
sorted+=("${paths[i]}")
|
|
73
|
+
done
|
|
74
|
+
|
|
75
|
+
#printf "%s\n" "${sorted[@]}"
|
|
76
|
+
|
|
77
|
+
echo "removing node_modules and caches"
|
|
78
|
+
|
|
79
|
+
for file in "${sorted[@]}"; do
|
|
80
|
+
rm -rf "$file" && echo "removed $file" &
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
wait
|
|
84
|
+
|
|
85
|
+
echo "cleaning tmp"
|
|
86
|
+
|
|
87
|
+
find . -name "tmp" -exec rm -rf '{}' +
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
echo "cleaning node_modules starts with letter vowels folders..."
|
|
20
|
+
|
|
21
|
+
vowels=( a i u e o A I U E O )
|
|
22
|
+
for letter in {{a..z},{A..Z}}; do
|
|
23
|
+
for vowel in "${vowels[@]}"; do
|
|
24
|
+
withoutVowel="node_modules/${letter}*"
|
|
25
|
+
withVowel="node_modules/${letter}${vowel}*"
|
|
26
|
+
echo "deleting ${withoutVowel}"
|
|
27
|
+
rm -rf $withoutVowel &
|
|
28
|
+
echo "deleting ${withVowel}"
|
|
29
|
+
rm -rf $withVowel &
|
|
30
|
+
done
|
|
31
|
+
done
|
|
32
|
+
|
|
33
|
+
wait
|
|
34
|
+
|
|
35
|
+
echo "cleaning locks..."
|
|
36
|
+
|
|
37
|
+
[[ -d "yarn.lock" ]] && rm -rf yarn.lock &
|
|
38
|
+
[[ -d "package-lock.json" ]] && rm -rf package-lock.json &
|
|
39
|
+
|
|
40
|
+
wait
|
|
41
|
+
|
|
42
|
+
echo "cleaning non-letter folders..."
|
|
43
|
+
[[ -d "node_modules/@*" ]] && rm -rf node_modules/@* &
|
|
44
|
+
[[ -d "node_modules/.*" ]] && rm -rf node_modules/.* &
|
|
45
|
+
[[ -d "node_modules" ]] && rm -rf node_modules &
|
|
46
|
+
|
|
47
|
+
wait
|
|
48
|
+
|
|
49
|
+
echo "cleaning node_modules using find"
|
|
50
|
+
|
|
51
|
+
find . -name "tmp" -exec rm -rf '{}' + &
|
|
52
|
+
find . -name "node_modules" -exec rm -rf '{}' + &
|
|
53
|
+
find . -name "yarn.lock" -exec rm -rf '{}' + &
|
|
54
|
+
find . -name "package-lock.json" -exec rm -rf '{}' + &
|
|
55
|
+
|
|
56
|
+
wait
|
package/bin/dev
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# resolve cli
|
|
20
|
+
CLI="$basedir/../node_modules/.bin/cross-env-shell"
|
|
21
|
+
if ! [ -x "$CLI" ]; then
|
|
22
|
+
CLI="$basedir/node_modules/.bin/cross-env-shell"
|
|
23
|
+
fi
|
|
24
|
+
if ! [ -x "$CLI" ]; then
|
|
25
|
+
CLI="./node_modules/.bin/cross-env-shell"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
"$CLI" NODE_ENV=development "$@"
|
package/bin/empty
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
## make non-binary file empty
|
|
20
|
+
|
|
21
|
+
truncate -s 0 "$1"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
echo "fix auto rebase"
|
|
20
|
+
git config config.pull false
|
|
21
|
+
echo "force LF end of line"
|
|
22
|
+
git config core.autocrlf false
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
if [ -f ".gitmodules" ]; then
|
|
20
|
+
git submodule foreach "git reflog expire --all --expire=now | :"
|
|
21
|
+
git submodule foreach "git gc --prune=now --aggressive | :"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
git reflog expire --all --expire=now
|
|
25
|
+
git gc --prune=now --aggressive
|
package/bin/kill-process
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
ps -W | grep "$1" | awk '{print $1}' | xargs kill -f;
|
package/bin/nodekill
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
#kill -9 $(ps aux | grep '\\snode\\s' | awk '{print $2}')
|
|
20
|
+
|
|
21
|
+
if ! [ -x "$(command -v killall)" ]; then
|
|
22
|
+
kill-process node
|
|
23
|
+
else
|
|
24
|
+
killall node
|
|
25
|
+
fi
|
package/bin/nodekill.cmd
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
taskkill /f /im node.exe
|
package/bin/nodekill.ps1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cmd "/C TASKKILL /IM node.exe /F"
|
package/bin/prod
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# resolve cli
|
|
20
|
+
CLI="$basedir/../node_modules/.bin/cross-env-shell"
|
|
21
|
+
if ! [ -x "$CLI" ]; then
|
|
22
|
+
CLI="$basedir/node_modules/.bin/cross-env-shell"
|
|
23
|
+
fi
|
|
24
|
+
if ! [ -x "$CLI" ]; then
|
|
25
|
+
CLI="./node_modules/.bin/cross-env-shell"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
"$CLI" NODE_ENV=production "$@"
|
package/bin/rmfind
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# delete filename or dirname recursively
|
|
20
|
+
|
|
21
|
+
if [ -z "$1" ]; then
|
|
22
|
+
echo "You need to provide a file or folder path"
|
|
23
|
+
exit
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
## find . -name "$1" -type d -prune -print | xargs du -chs
|
|
27
|
+
find . -name "$1" -type d -prune -print -exec rm -rf '{}' \;
|
package/bin/rmpath
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# fast huge folder deleter
|
|
20
|
+
|
|
21
|
+
if [ -z "$1" ]; then
|
|
22
|
+
echo "You need to provide a file or folder path"
|
|
23
|
+
exit
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# delete single file
|
|
27
|
+
if [ -f "$1" ]; then
|
|
28
|
+
rm -rf "$1"
|
|
29
|
+
exit
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if [ ! -d "$1" ]; then
|
|
33
|
+
echo "$1 not found"
|
|
34
|
+
exit
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
vowels=( a i u e o A I U E O )
|
|
38
|
+
for letter in {{a..z},{A..Z}}; do
|
|
39
|
+
for vowel in "${vowels[@]}"; do
|
|
40
|
+
toBeDeleted=( "$1/.${letter}*" "$1/@${letter}*" "$1/${letter}*" "$1/@${letter}${vowel}*" "$1/.${letter}${vowel}*" "$1/${letter}${vowel}*" )
|
|
41
|
+
for fpath in "${toBeDeleted[@]}"; do
|
|
42
|
+
echo "deleting ${fpath}"
|
|
43
|
+
rm -rf $fpath or echo "cannot delete $fpath" &
|
|
44
|
+
done
|
|
45
|
+
done
|
|
46
|
+
done
|
|
47
|
+
|
|
48
|
+
wait
|
|
49
|
+
|
|
50
|
+
echo "cleaning $1"
|
|
51
|
+
rm -rf $1 &
|
|
52
|
+
|
|
53
|
+
wait
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# auto clone all submodules, prevent not-matched hash
|
|
20
|
+
# set ACCESS_TOKEN=github_personal_tokens
|
|
21
|
+
# usages: sh folder_this_repo/submodule-install
|
|
22
|
+
|
|
23
|
+
# get script path
|
|
24
|
+
SCRIPT=$(realpath "$0")
|
|
25
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
26
|
+
|
|
27
|
+
# set default root
|
|
28
|
+
export ROOT="$(git rev-parse --show-toplevel)"
|
|
29
|
+
|
|
30
|
+
while test $# -gt 0; do
|
|
31
|
+
case "$1" in
|
|
32
|
+
-h|--help)
|
|
33
|
+
echo "$package - attempt to install submodules"
|
|
34
|
+
echo " "
|
|
35
|
+
echo "$package [options] application [arguments]"
|
|
36
|
+
echo " "
|
|
37
|
+
echo "options:"
|
|
38
|
+
echo "-h, --help show brief help"
|
|
39
|
+
echo "-o, --output-dir=DIR specify a directory to install submodules"
|
|
40
|
+
exit 0
|
|
41
|
+
;;
|
|
42
|
+
-cwd)
|
|
43
|
+
shift
|
|
44
|
+
if test $# -gt 0; then
|
|
45
|
+
export ROOT=$1
|
|
46
|
+
else
|
|
47
|
+
echo "no output dir specified"
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
shift
|
|
51
|
+
;;
|
|
52
|
+
--cwd*)
|
|
53
|
+
export ROOT=`echo $1 | sed -e 's/^[^=]*=//g'`
|
|
54
|
+
shift
|
|
55
|
+
;;
|
|
56
|
+
*)
|
|
57
|
+
break
|
|
58
|
+
;;
|
|
59
|
+
esac
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
echo "installing submodules at $ROOT"
|
|
63
|
+
|
|
64
|
+
git -C "${REPO_PATH}" config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
|
|
65
|
+
while read -r KEY MODULE_PATH
|
|
66
|
+
do
|
|
67
|
+
# relative module path from root
|
|
68
|
+
RELATIVE_MODULE_PATH="${ROOT}/${MODULE_PATH}"
|
|
69
|
+
# cd git root dir
|
|
70
|
+
cd ${ROOT}
|
|
71
|
+
# If the module's path exists, remove it.
|
|
72
|
+
# This is done b/c the module's path is currently
|
|
73
|
+
# not a valid git repo and adding the submodule will cause an error.
|
|
74
|
+
if [ -d "${RELATIVE_MODULE_PATH}" ]; then
|
|
75
|
+
echo "deleting ${RELATIVE_MODULE_PATH}"
|
|
76
|
+
rm -rf "${RELATIVE_MODULE_PATH}"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
NAME="$(echo "${KEY}" | sed 's/^submodule\.\(.*\)\.path$/\1/')"
|
|
80
|
+
|
|
81
|
+
url_key="$(echo "${KEY}" | sed 's/\.path$/.url/')"
|
|
82
|
+
branch_key="$(echo "${KEY}" | sed 's/\.path$/.branch/')"
|
|
83
|
+
|
|
84
|
+
URL="$(git config -f .gitmodules --get "${url_key}")"
|
|
85
|
+
BRANCH="$(git config -f .gitmodules --get "${branch_key}" || echo "master")"
|
|
86
|
+
|
|
87
|
+
git -C "${REPO_PATH}" submodule add --force -b "${BRANCH}" --name "${NAME}" "${URL}" "${MODULE_PATH}" || echo "cannot add submodule ${MODULE_PATH}"
|
|
88
|
+
|
|
89
|
+
repo=${URL#"https://github.com/"}
|
|
90
|
+
URL_WITH_TOKEN="https://${ACCESS_TOKEN}@github.com/${repo}"
|
|
91
|
+
|
|
92
|
+
echo "apply token for ${repo} at ${MODULE_PATH} branch ${BRANCH}"
|
|
93
|
+
GIT_MODULES="${RELATIVE_MODULE_PATH}/.gitmodules"
|
|
94
|
+
cd "${RELATIVE_MODULE_PATH}"
|
|
95
|
+
git remote set-url origin "${URL_WITH_TOKEN}"
|
|
96
|
+
git fetch --all
|
|
97
|
+
git pull origin "${BRANCH}" -X theirs
|
|
98
|
+
if [ -f "${GIT_MODULES}" ];
|
|
99
|
+
then
|
|
100
|
+
echo "${MODULE_PATH} has submodules"
|
|
101
|
+
sh "${SCRIPT}" -cwd ${RELATIVE_MODULE_PATH}
|
|
102
|
+
fi
|
|
103
|
+
done
|
|
104
|
+
|
|
105
|
+
git -C "${REPO_PATH}" submodule update --init --recursive
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# make cygwin bin as priority
|
|
4
|
+
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH";
|
|
5
|
+
|
|
6
|
+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
|
|
7
|
+
|
|
8
|
+
# absolute path working directory
|
|
9
|
+
basecwd=${PWD}
|
|
10
|
+
# base script directory
|
|
11
|
+
basedir=`dirname "$0"`
|
|
12
|
+
# absolute path script directory
|
|
13
|
+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
14
|
+
|
|
15
|
+
case `uname` in
|
|
16
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
echo "input submodule path"
|
|
20
|
+
read folderpath
|
|
21
|
+
|
|
22
|
+
# Remove the submodule entry from .git/config
|
|
23
|
+
git submodule deinit -f $folderpath
|
|
24
|
+
|
|
25
|
+
# Remove the submodule directory from the superproject's .git/modules directory
|
|
26
|
+
rm -rf .git/modules/$folderpath
|
|
27
|
+
|
|
28
|
+
# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
|
|
29
|
+
git rm -f $folderpath
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log("binary-collections main script :P");
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { Minimatch } = require("minimatch");
|
|
6
|
+
|
|
7
|
+
const args = require("minimist")(process.argv.slice(2));
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
const packagejson = path.join(cwd, "package.json");
|
|
10
|
+
const verbose = args["v"] || args["verbose"];
|
|
11
|
+
|
|
12
|
+
(async function npmRunSeries() {
|
|
13
|
+
const { execa } = await import("execa");
|
|
14
|
+
if (fs.existsSync(packagejson)) {
|
|
15
|
+
/**
|
|
16
|
+
* @type {import('../package.json')}
|
|
17
|
+
*/
|
|
18
|
+
const parse = JSON.parse(fs.readFileSync(packagejson, "utf-8"));
|
|
19
|
+
|
|
20
|
+
if (parse !== null && typeof parse === "object") {
|
|
21
|
+
if ("scripts" in parse) {
|
|
22
|
+
const patterns = args._;
|
|
23
|
+
const scripts = parse.scripts;
|
|
24
|
+
const scriptNames = Object.keys(scripts);
|
|
25
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
26
|
+
const pattern = patterns[i];
|
|
27
|
+
const matcher = new Minimatch(pattern, { nonegate: true });
|
|
28
|
+
for (let ii = 0; ii < scriptNames.length; ii++) {
|
|
29
|
+
const scriptName = scriptNames[ii];
|
|
30
|
+
const match = matcher.match(scriptName);
|
|
31
|
+
if (verbose) console.log({ pattern, scriptName, match });
|
|
32
|
+
if (match === true) {
|
|
33
|
+
await execa("npm", ["run", scriptName], {
|
|
34
|
+
cwd,
|
|
35
|
+
stdio: "inherit",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"resolutions": {
|
|
3
|
+
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
4
|
+
"safelinkify": "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
|
|
5
|
+
"sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
|
|
6
|
+
"sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
|
|
7
|
+
"sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
|
|
8
|
+
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
|
|
9
|
+
"sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
|
|
10
|
+
"static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
|
|
11
|
+
"hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
|
|
12
|
+
"hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
|
|
13
|
+
"hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
|
|
14
|
+
"hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
|
|
15
|
+
"hexo": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
|
|
16
|
+
"hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
|
|
17
|
+
"hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
|
|
18
|
+
"warehouse": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
|
|
19
|
+
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
|
|
20
|
+
"instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "binary-collections",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "binary helper collections by L3n4r0x",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"bin",
|
|
8
|
+
"lib",
|
|
9
|
+
"index.js"
|
|
10
|
+
],
|
|
11
|
+
"directories": {
|
|
12
|
+
"bin": "bin",
|
|
13
|
+
"lib": "lib"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"update:packer": "curl -L https://github.com/dimaslanjaka/nodejs-package-types/raw/main/packer.js > packer.js",
|
|
17
|
+
"build": "node build.js && yarn run pack",
|
|
18
|
+
"test": "cd test && npm install -D file:../ &&",
|
|
19
|
+
"test:nrs": "npm test -- nrs build:**",
|
|
20
|
+
"pack": "node packer.js --yarn --filename=bin"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"execa": "^7.1.1",
|
|
27
|
+
"fs-extra": "^11.1.1",
|
|
28
|
+
"glob": "^10.2.2",
|
|
29
|
+
"minimatch": "^9.0.0",
|
|
30
|
+
"minimist": "^1.2.8",
|
|
31
|
+
"upath": "^2.0.1"
|
|
32
|
+
},
|
|
33
|
+
"packageManager": "yarn@3.5.0",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/minimist": "^1",
|
|
36
|
+
"@types/node": "^18.16.3",
|
|
37
|
+
"@types/yargs": "^17"
|
|
38
|
+
},
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"ansi-colors": "^4.1.3"
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"nrs": "lib/npm-run-series.js",
|
|
44
|
+
"run-s": "lib/npm-run-series.js",
|
|
45
|
+
"run-series": "lib/npm-run-series.js",
|
|
46
|
+
"npm-run-series": "lib/npm-run-series.js",
|
|
47
|
+
"submodule-remove": "bin/submodule-remove",
|
|
48
|
+
"submodule-install": "bin/submodule-install",
|
|
49
|
+
"rmpath": "bin/rmpath",
|
|
50
|
+
"rmfind": "bin/rmfind",
|
|
51
|
+
"prod": "bin/prod",
|
|
52
|
+
"nodekill.ps1": "bin/nodekill.ps1",
|
|
53
|
+
"nodekill.cmd": "bin/nodekill.cmd",
|
|
54
|
+
"nodekill": "bin/nodekill",
|
|
55
|
+
"kill-process": "bin/kill-process",
|
|
56
|
+
"git-reduce-size": "bin/git-reduce-size",
|
|
57
|
+
"git-fix-encoding.cmd": "bin/git-fix-encoding.cmd",
|
|
58
|
+
"git-fix-encoding": "bin/git-fix-encoding",
|
|
59
|
+
"empty": "bin/empty",
|
|
60
|
+
"dev": "bin/dev",
|
|
61
|
+
"clean-nodemodules": "bin/clean-nodemodules",
|
|
62
|
+
"clean-nodemodule": "bin/clean-nodemodule"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# binary helper collections
|
|
2
|
+
binary helper collections by L3n4r0x
|
|
3
|
+
|
|
4
|
+
## installation
|
|
5
|
+
|
|
6
|
+
clone direct folder
|
|
7
|
+
```bash
|
|
8
|
+
git clone -b master https://github.com/dimaslanjaka/bin bin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
via npm
|
|
12
|
+
```bash
|
|
13
|
+
npm install binary-collections@https://github.com/dimaslanjaka/bin
|
|
14
|
+
# or
|
|
15
|
+
npm install binary-collections@https://github.com/dimaslanjaka/bin/raw/master/releases/bin.tgz
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Setup vscode
|
|
19
|
+
create `.vscode/settings.json`
|
|
20
|
+
```jsonc
|
|
21
|
+
{
|
|
22
|
+
"terminal.integrated.env.linux": {
|
|
23
|
+
"PATH": "${env:PATH}:${workspaceFolder}/node_modules/.bin:${workspaceFolder}/bin"
|
|
24
|
+
},
|
|
25
|
+
"terminal.integrated.env.windows": {
|
|
26
|
+
"PATH": "${env:PATH};${workspaceFolder}\\node_modules\\.bin;${workspaceFolder}\\bin"
|
|
27
|
+
},
|
|
28
|
+
"terminal.integrated.profiles.windows": {
|
|
29
|
+
"PowerShell": {
|
|
30
|
+
"source": "PowerShell",
|
|
31
|
+
"icon": "terminal-powershell"
|
|
32
|
+
},
|
|
33
|
+
"Command Prompt": {
|
|
34
|
+
"path": [
|
|
35
|
+
"${env:windir}\\Sysnative\\cmd.exe",
|
|
36
|
+
"${env:windir}\\System32\\cmd.exe"
|
|
37
|
+
],
|
|
38
|
+
"args": [],
|
|
39
|
+
"icon": "terminal-cmd"
|
|
40
|
+
},
|
|
41
|
+
"Git Bash": {
|
|
42
|
+
"source": "Git Bash"
|
|
43
|
+
},
|
|
44
|
+
"Cygwin": {
|
|
45
|
+
"path": "C:\\cygwin64\\bin\\bash.exe",
|
|
46
|
+
"args": [
|
|
47
|
+
"--login",
|
|
48
|
+
"-i"
|
|
49
|
+
],
|
|
50
|
+
"env": {
|
|
51
|
+
"CHERE_INVOKING": "1"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"terminal.integrated.defaultProfile.windows": "Command Prompt",
|
|
56
|
+
}
|
|
57
|
+
```
|
package/releases/bin
ADDED
|
Binary file
|