@modernpoacher/deps 2.0.20 → 2.0.22
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/README.md +14 -14
- package/bin/common/index.mjs +4 -4
- package/bin/deps.sh +71 -30
- package/bin/execute/app.mjs +1 -1
- package/bin/head.sh +68 -27
- package/bin/push.sh +52 -23
- package/bin/wipe.sh +52 -23
- package/nvm.sh +15 -7
- package/package.json +8 -8
- package/src/common/env/index.mjs +3 -3
- package/src/common/git/index.mjs +2 -2
- package/src/common/index.mjs +1 -1
- package/src/index.mjs +2 -2
- package/src/install/index.mjs +2 -2
package/README.md
CHANGED
|
@@ -179,17 +179,17 @@ deps-install \
|
|
|
179
179
|
--bundle \ # Boolean
|
|
180
180
|
--peer \ # Boolean
|
|
181
181
|
--save \ # Boolean
|
|
182
|
-
|
|
182
|
+
--registry '<REGISTRY>' \
|
|
183
183
|
--force # Boolean
|
|
184
184
|
|
|
185
185
|
deps-deps \
|
|
186
|
-
--path
|
|
187
|
-
--from
|
|
188
|
-
--only
|
|
186
|
+
--path . \
|
|
187
|
+
--from . \
|
|
188
|
+
--only .
|
|
189
189
|
|
|
190
|
-
deps-wipe --path
|
|
191
|
-
deps-push --path
|
|
192
|
-
deps-head --path
|
|
190
|
+
deps-wipe --path .
|
|
191
|
+
deps-push --path .
|
|
192
|
+
deps-head --path .
|
|
193
193
|
```
|
|
194
194
|
|
|
195
195
|
## *Deps* with its own script targets
|
|
@@ -219,15 +219,15 @@ npm run deps-install -- \
|
|
|
219
219
|
--bundle \ # Boolean
|
|
220
220
|
--peer \ # Boolean
|
|
221
221
|
--save \ # Boolean
|
|
222
|
-
|
|
222
|
+
--registry '<REGISTRY>' \
|
|
223
223
|
--force # Boolean
|
|
224
224
|
|
|
225
225
|
npm run deps-deps -- \
|
|
226
|
-
--path
|
|
227
|
-
--from
|
|
228
|
-
--only
|
|
226
|
+
--path . \
|
|
227
|
+
--from . \
|
|
228
|
+
--only .
|
|
229
229
|
|
|
230
|
-
npm run deps-wipe -- --path
|
|
231
|
-
npm run deps-push -- --path
|
|
232
|
-
npm run deps-head -- --path
|
|
230
|
+
npm run deps-wipe -- --path .
|
|
231
|
+
npm run deps-push -- --path .
|
|
232
|
+
npm run deps-head -- --path .
|
|
233
233
|
```
|
package/bin/common/index.mjs
CHANGED
|
@@ -4,22 +4,22 @@ import debug from 'debug'
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
exec
|
|
7
|
-
} from 'child_process'
|
|
7
|
+
} from 'node:child_process'
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
resolve,
|
|
11
11
|
relative,
|
|
12
12
|
normalize
|
|
13
|
-
} from 'path'
|
|
13
|
+
} from 'node:path'
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
constants
|
|
17
|
-
} from 'fs'
|
|
17
|
+
} from 'node:fs'
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
access,
|
|
21
21
|
readFile
|
|
22
|
-
} from 'fs/promises'
|
|
22
|
+
} from 'node:fs/promises'
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
25
|
VERSION,
|
package/bin/deps.sh
CHANGED
|
@@ -23,17 +23,21 @@ function update {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function can_update {
|
|
26
|
+
local directory_name
|
|
27
|
+
|
|
28
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
29
|
+
|
|
26
30
|
git_status=$(git status 2> /dev/null)
|
|
27
31
|
|
|
28
32
|
if [[ $? != 0 ]]
|
|
29
33
|
then
|
|
30
|
-
echo -e "\033[0;35m$
|
|
34
|
+
echo -e "\033[0;35m$directory_name\033[0m is not configured for Git" # "$1 is not configured for Git"
|
|
31
35
|
|
|
32
36
|
return 1
|
|
33
37
|
else
|
|
34
38
|
if [[ ! "$git_status" =~ "nothing to commit" ]]
|
|
35
39
|
then
|
|
36
|
-
echo -e "\033[0;35m$
|
|
40
|
+
echo -e "\033[0;35m$directory_name\033[0m has changes to commit" # "$1 has changes to commit"
|
|
37
41
|
|
|
38
42
|
return 1
|
|
39
43
|
fi
|
|
@@ -43,20 +47,24 @@ function can_update {
|
|
|
43
47
|
|
|
44
48
|
if [ -z "$default_branch" ]
|
|
45
49
|
then
|
|
46
|
-
echo -e "Failed to identify the default branch for \033[0;35m$
|
|
50
|
+
echo -e "Failed to identify the default branch for \033[0;35m$directory_name\033[0m"
|
|
47
51
|
|
|
48
52
|
return 1
|
|
49
53
|
else
|
|
50
|
-
echo -e "The default branch for \033[0;35m$
|
|
54
|
+
echo -e "The default branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
51
55
|
|
|
52
56
|
return 0
|
|
53
57
|
fi
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
function report {
|
|
61
|
+
local directory_name
|
|
62
|
+
|
|
63
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
64
|
+
|
|
57
65
|
echo
|
|
58
66
|
echo "==========================="
|
|
59
|
-
echo -e "\033[0;35m$
|
|
67
|
+
echo -e "\033[0;35m$directory_name\033[0m" # $1
|
|
60
68
|
echo "==========================="
|
|
61
69
|
echo
|
|
62
70
|
}
|
|
@@ -79,21 +87,49 @@ HOME=$PWD
|
|
|
79
87
|
echo
|
|
80
88
|
echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
|
|
81
89
|
|
|
82
|
-
for
|
|
90
|
+
for flag in "$@";
|
|
91
|
+
do
|
|
92
|
+
shift
|
|
93
|
+
case "$flag" in
|
|
94
|
+
--path=*|-p=*)
|
|
95
|
+
set -- "$@" '-p' "${flag#*=}"
|
|
96
|
+
;;
|
|
97
|
+
--path|-p)
|
|
98
|
+
set -- "$@" '-p' "${1}"
|
|
99
|
+
;;
|
|
100
|
+
--from=*|-f=*)
|
|
101
|
+
set -- "$@" '-f' "${flag#*=}"
|
|
102
|
+
;;
|
|
103
|
+
--from|-f)
|
|
104
|
+
set -- "$@" '-f' "${1}"
|
|
105
|
+
;;
|
|
106
|
+
--only=*|-o=*)
|
|
107
|
+
set -- "$@" '-o' "${flag#*=}"
|
|
108
|
+
;;
|
|
109
|
+
--only|-o)
|
|
110
|
+
set -- "$@" '-o' "${1}"
|
|
111
|
+
;;
|
|
112
|
+
*)
|
|
113
|
+
set -- "$@" "$flag"
|
|
114
|
+
;;
|
|
115
|
+
esac
|
|
116
|
+
done
|
|
117
|
+
|
|
118
|
+
while getopts "p:f:o:" flag;
|
|
83
119
|
do
|
|
84
|
-
case $
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
120
|
+
case "${flag}" in
|
|
121
|
+
p)
|
|
122
|
+
path="$OPTARG"
|
|
123
|
+
;;
|
|
124
|
+
f)
|
|
125
|
+
from="$OPTARG"
|
|
126
|
+
;;
|
|
127
|
+
o)
|
|
128
|
+
only="$OPTARG"
|
|
129
|
+
;;
|
|
94
130
|
*)
|
|
95
|
-
|
|
96
|
-
|
|
131
|
+
# Ignoring "$flag"
|
|
132
|
+
;;
|
|
97
133
|
esac
|
|
98
134
|
done
|
|
99
135
|
|
|
@@ -105,7 +141,7 @@ then
|
|
|
105
141
|
then
|
|
106
142
|
cd "$d"
|
|
107
143
|
|
|
108
|
-
execute "$
|
|
144
|
+
execute "$PWD"
|
|
109
145
|
|
|
110
146
|
cd ..
|
|
111
147
|
fi
|
|
@@ -115,17 +151,22 @@ else
|
|
|
115
151
|
then
|
|
116
152
|
cd "$path"
|
|
117
153
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
154
|
+
if [ -d "$PWD/.git" ];
|
|
155
|
+
then
|
|
156
|
+
execute "$PWD"
|
|
157
|
+
else
|
|
158
|
+
for d in *
|
|
159
|
+
do
|
|
160
|
+
if [ -d "$d" ]
|
|
161
|
+
then
|
|
162
|
+
cd "$d"
|
|
123
163
|
|
|
124
|
-
|
|
164
|
+
execute "$PWD"
|
|
125
165
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
166
|
+
cd ..
|
|
167
|
+
fi
|
|
168
|
+
done
|
|
169
|
+
fi
|
|
129
170
|
|
|
130
171
|
cd "$HOME"
|
|
131
172
|
else
|
|
@@ -141,7 +182,7 @@ else
|
|
|
141
182
|
then
|
|
142
183
|
cd "$d"
|
|
143
184
|
|
|
144
|
-
execute "$
|
|
185
|
+
execute "$PWD"
|
|
145
186
|
|
|
146
187
|
cd ..
|
|
147
188
|
fi
|
|
@@ -158,7 +199,7 @@ else
|
|
|
158
199
|
then
|
|
159
200
|
cd "$d"
|
|
160
201
|
|
|
161
|
-
execute "$
|
|
202
|
+
execute "$PWD"
|
|
162
203
|
|
|
163
204
|
cd ..
|
|
164
205
|
fi
|
package/bin/execute/app.mjs
CHANGED
package/bin/head.sh
CHANGED
|
@@ -5,38 +5,50 @@ export PATH=/usr/local/bin:$PATH
|
|
|
5
5
|
EXP="[-0-9a-zA-Z]*$"
|
|
6
6
|
|
|
7
7
|
function report {
|
|
8
|
+
local directory_name
|
|
9
|
+
|
|
10
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
11
|
+
|
|
8
12
|
echo
|
|
9
13
|
echo "==========================="
|
|
10
|
-
echo -e "\033[0;35m$
|
|
14
|
+
echo -e "\033[0;35m$directory_name\033[0m" # $1
|
|
11
15
|
echo "==========================="
|
|
12
16
|
echo
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
function has_git {
|
|
20
|
+
local directory_name
|
|
21
|
+
|
|
22
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
23
|
+
|
|
16
24
|
git_status=$(git status 2> /dev/null)
|
|
17
25
|
|
|
18
26
|
if [[ $? != 0 ]]
|
|
19
27
|
then
|
|
20
|
-
echo -e "\033[0;35m$
|
|
28
|
+
echo -e "\033[0;35m$directory_name\033[0m is not configured for Git" # "$1 is not configured for Git"
|
|
21
29
|
|
|
22
30
|
return 1
|
|
23
31
|
else
|
|
24
|
-
echo -e "\033[0;35m$
|
|
32
|
+
echo -e "\033[0;35m$directory_name\033[0m is configured for Git" # "$1 is configured for Git"
|
|
25
33
|
|
|
26
34
|
return 0
|
|
27
35
|
fi
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
function is_clean {
|
|
39
|
+
local directory_name
|
|
40
|
+
|
|
41
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
42
|
+
|
|
31
43
|
git_status=$(git status 2> /dev/null)
|
|
32
44
|
|
|
33
45
|
if [[ ! "$git_status" =~ "nothing to commit" ]]
|
|
34
46
|
then
|
|
35
|
-
echo -e "\033[0;35m$
|
|
47
|
+
echo -e "\033[0;35m$directory_name\033[0m is not clean" # "$1 is not clean"
|
|
36
48
|
|
|
37
49
|
return 1
|
|
38
50
|
else
|
|
39
|
-
echo -e "\033[0;35m$
|
|
51
|
+
echo -e "\033[0;35m$directory_name\033[0m is clean" # "$1 is clean"
|
|
40
52
|
|
|
41
53
|
return 0
|
|
42
54
|
fi
|
|
@@ -55,15 +67,19 @@ function get_current_branch {
|
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
function can_git_remote_set_head {
|
|
70
|
+
local directory_name
|
|
71
|
+
|
|
72
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
73
|
+
|
|
58
74
|
DIR=$(echo "$PWD" | sed 's/\\/\//g' | sed 's/://') && [[ $(cat "$DIR/.git/refs/remotes/origin/HEAD" 2> /dev/null) =~ $EXP ]] && default_branch="${BASH_REMATCH[0]}"
|
|
59
75
|
|
|
60
76
|
if [ -z "$default_branch" ]
|
|
61
77
|
then
|
|
62
|
-
echo -e "Failed to identify the default branch for \033[0;35m$
|
|
78
|
+
echo -e "Failed to identify the default branch for \033[0;35m$directory_name\033[0m"
|
|
63
79
|
|
|
64
80
|
return 1
|
|
65
81
|
else
|
|
66
|
-
echo -e "The default branch for \033[0;35m$
|
|
82
|
+
echo -e "The default branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
67
83
|
|
|
68
84
|
return 0
|
|
69
85
|
fi
|
|
@@ -80,6 +96,10 @@ function execute {
|
|
|
80
96
|
|
|
81
97
|
has_git "$1"
|
|
82
98
|
|
|
99
|
+
local directory_name
|
|
100
|
+
|
|
101
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
102
|
+
|
|
83
103
|
if [[ $? = 0 ]]
|
|
84
104
|
then
|
|
85
105
|
is_clean "$1"
|
|
@@ -96,7 +116,7 @@ function execute {
|
|
|
96
116
|
|
|
97
117
|
if [[ $default_branch == $current_branch ]];
|
|
98
118
|
then
|
|
99
|
-
echo -e "The current branch for \033[0;35m$
|
|
119
|
+
echo -e "The current branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
100
120
|
|
|
101
121
|
return 0
|
|
102
122
|
else
|
|
@@ -104,11 +124,11 @@ function execute {
|
|
|
104
124
|
|
|
105
125
|
if [[ $? = 1 ]]
|
|
106
126
|
then
|
|
107
|
-
echo -e "Failed to change current branch for \033[0;35m$
|
|
127
|
+
echo -e "Failed to change current branch for \033[0;35m$directory_name\033[0m to '$default_branch'"
|
|
108
128
|
|
|
109
129
|
return 1
|
|
110
130
|
else
|
|
111
|
-
echo -e "The current branch for \033[0;35m$
|
|
131
|
+
echo -e "The current branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
112
132
|
|
|
113
133
|
return 0
|
|
114
134
|
fi
|
|
@@ -123,15 +143,31 @@ HOME=$PWD
|
|
|
123
143
|
echo
|
|
124
144
|
echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
|
|
125
145
|
|
|
126
|
-
for
|
|
146
|
+
for flag in "$@";
|
|
127
147
|
do
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
path
|
|
131
|
-
|
|
148
|
+
shift
|
|
149
|
+
case "$flag" in
|
|
150
|
+
--path=*|-p=*)
|
|
151
|
+
set -- "$@" '-p' "${flag#*=}"
|
|
152
|
+
;;
|
|
153
|
+
--path|-p)
|
|
154
|
+
set -- "$@" '-p' "${1}"
|
|
155
|
+
;;
|
|
132
156
|
*)
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
set -- "$@" "$flag"
|
|
158
|
+
;;
|
|
159
|
+
esac
|
|
160
|
+
done
|
|
161
|
+
|
|
162
|
+
while getopts "p:" flag;
|
|
163
|
+
do
|
|
164
|
+
case "${flag}" in
|
|
165
|
+
p)
|
|
166
|
+
path="$OPTARG"
|
|
167
|
+
;;
|
|
168
|
+
*)
|
|
169
|
+
# Ignoring "$flag"
|
|
170
|
+
;;
|
|
135
171
|
esac
|
|
136
172
|
done
|
|
137
173
|
|
|
@@ -143,7 +179,7 @@ then
|
|
|
143
179
|
then
|
|
144
180
|
cd "$d"
|
|
145
181
|
|
|
146
|
-
execute "$
|
|
182
|
+
execute "$PWD"
|
|
147
183
|
|
|
148
184
|
cd ..
|
|
149
185
|
fi
|
|
@@ -153,17 +189,22 @@ else
|
|
|
153
189
|
then
|
|
154
190
|
cd "$path"
|
|
155
191
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
192
|
+
if [ -d "$PWD/.git" ];
|
|
193
|
+
then
|
|
194
|
+
execute "$PWD"
|
|
195
|
+
else
|
|
196
|
+
for d in *
|
|
197
|
+
do
|
|
198
|
+
if [ -d "$d" ]
|
|
199
|
+
then
|
|
200
|
+
cd "$d"
|
|
161
201
|
|
|
162
|
-
|
|
202
|
+
execute "$PWD"
|
|
163
203
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
204
|
+
cd ..
|
|
205
|
+
fi
|
|
206
|
+
done
|
|
207
|
+
fi
|
|
167
208
|
|
|
168
209
|
cd "$HOME"
|
|
169
210
|
fi
|
package/bin/push.sh
CHANGED
|
@@ -5,9 +5,13 @@ export PATH=/usr/local/bin:$PATH
|
|
|
5
5
|
EXP="[-0-9a-zA-Z]*$"
|
|
6
6
|
|
|
7
7
|
function report {
|
|
8
|
+
local directory_name
|
|
9
|
+
|
|
10
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
11
|
+
|
|
8
12
|
echo
|
|
9
13
|
echo "==========================="
|
|
10
|
-
echo -e "\033[0;35m$
|
|
14
|
+
echo -e "\033[0;35m$directory_name\033[0m" # $1
|
|
11
15
|
echo "==========================="
|
|
12
16
|
echo
|
|
13
17
|
}
|
|
@@ -15,19 +19,23 @@ function report {
|
|
|
15
19
|
function checkout_default_branch {
|
|
16
20
|
DIR=$(echo "$PWD" | sed 's/\\/\//g' | sed 's/://') && [[ $(cat "$DIR/.git/refs/remotes/origin/HEAD" 2> /dev/null) =~ $EXP ]] && default_branch="${BASH_REMATCH[0]}"
|
|
17
21
|
|
|
22
|
+
local directory_name
|
|
23
|
+
|
|
24
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
25
|
+
|
|
18
26
|
if [ -z "$default_branch" ]
|
|
19
27
|
then
|
|
20
|
-
echo -e "Failed to identify the default branch for \033[0;35m$
|
|
28
|
+
echo -e "Failed to identify the default branch for \033[0;35m$directory_name\033[0m"
|
|
21
29
|
|
|
22
30
|
return 1
|
|
23
31
|
else
|
|
24
|
-
echo -e "The default branch for \033[0;35m$
|
|
32
|
+
echo -e "The default branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
25
33
|
|
|
26
34
|
git checkout $default_branch 2> /dev/null
|
|
27
35
|
|
|
28
36
|
if [[ $? != 0 ]]
|
|
29
37
|
then
|
|
30
|
-
echo -e "Failed to checkout the default branch for \033[0;35m$
|
|
38
|
+
echo -e "Failed to checkout the default branch for \033[0;35m$directory_name\033[0m" # "$d is not configured for Git"
|
|
31
39
|
|
|
32
40
|
return 1
|
|
33
41
|
fi
|
|
@@ -62,15 +70,31 @@ HOME=$PWD
|
|
|
62
70
|
echo
|
|
63
71
|
echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
|
|
64
72
|
|
|
65
|
-
for
|
|
73
|
+
for flag in "$@";
|
|
66
74
|
do
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
path
|
|
70
|
-
|
|
75
|
+
shift
|
|
76
|
+
case "$flag" in
|
|
77
|
+
--path=*|-p=*)
|
|
78
|
+
set -- "$@" '-p' "${flag#*=}"
|
|
79
|
+
;;
|
|
80
|
+
--path|-p)
|
|
81
|
+
set -- "$@" '-p' "${1}"
|
|
82
|
+
;;
|
|
71
83
|
*)
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
set -- "$@" "$flag"
|
|
85
|
+
;;
|
|
86
|
+
esac
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
while getopts "p:" flag;
|
|
90
|
+
do
|
|
91
|
+
case "${flag}" in
|
|
92
|
+
p)
|
|
93
|
+
path="$OPTARG"
|
|
94
|
+
;;
|
|
95
|
+
*)
|
|
96
|
+
# Ignoring "$flag"
|
|
97
|
+
;;
|
|
74
98
|
esac
|
|
75
99
|
done
|
|
76
100
|
|
|
@@ -82,7 +106,7 @@ then
|
|
|
82
106
|
then
|
|
83
107
|
cd "$d"
|
|
84
108
|
|
|
85
|
-
execute "$
|
|
109
|
+
execute "$PWD"
|
|
86
110
|
|
|
87
111
|
cd ..
|
|
88
112
|
fi
|
|
@@ -92,17 +116,22 @@ else
|
|
|
92
116
|
then
|
|
93
117
|
cd "$path"
|
|
94
118
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
119
|
+
if [ -d "$PWD/.git" ];
|
|
120
|
+
then
|
|
121
|
+
execute "$PWD"
|
|
122
|
+
else
|
|
123
|
+
for d in *
|
|
124
|
+
do
|
|
125
|
+
if [ -d "$d" ]
|
|
126
|
+
then
|
|
127
|
+
cd "$d"
|
|
128
|
+
|
|
129
|
+
execute "$PWD"
|
|
130
|
+
|
|
131
|
+
cd ..
|
|
132
|
+
fi
|
|
133
|
+
done
|
|
134
|
+
fi
|
|
106
135
|
|
|
107
136
|
cd "$HOME"
|
|
108
137
|
fi
|
package/bin/wipe.sh
CHANGED
|
@@ -5,9 +5,13 @@ export PATH=/usr/local/bin:$PATH
|
|
|
5
5
|
EXP="[-0-9a-zA-Z]*$"
|
|
6
6
|
|
|
7
7
|
function report {
|
|
8
|
+
local directory_name
|
|
9
|
+
|
|
10
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
11
|
+
|
|
8
12
|
echo
|
|
9
13
|
echo "==========================="
|
|
10
|
-
echo -e "\033[0;35m$
|
|
14
|
+
echo -e "\033[0;35m$directory_name\033[0m" # $1
|
|
11
15
|
echo "==========================="
|
|
12
16
|
echo
|
|
13
17
|
}
|
|
@@ -15,19 +19,23 @@ function report {
|
|
|
15
19
|
function checkout_default_branch {
|
|
16
20
|
DIR=$(echo "$PWD" | sed 's/\\/\//g' | sed 's/://') && [[ $(cat "$DIR/.git/refs/remotes/origin/HEAD" 2> /dev/null) =~ $EXP ]] && default_branch="${BASH_REMATCH[0]}"
|
|
17
21
|
|
|
22
|
+
local directory_name
|
|
23
|
+
|
|
24
|
+
directory_name="${1##*/}" # directory_name="$(basename "$(git rev-parse --show-toplevel)")"
|
|
25
|
+
|
|
18
26
|
if [ -z "$default_branch" ]
|
|
19
27
|
then
|
|
20
|
-
echo -e "Failed to identify the default branch for \033[0;35m$
|
|
28
|
+
echo -e "Failed to identify the default branch for \033[0;35m$directory_name\033[0m"
|
|
21
29
|
|
|
22
30
|
return 1
|
|
23
31
|
else
|
|
24
|
-
echo -e "The default branch for \033[0;35m$
|
|
32
|
+
echo -e "The default branch for \033[0;35m$directory_name\033[0m is '$default_branch'"
|
|
25
33
|
|
|
26
34
|
git checkout $default_branch 2> /dev/null
|
|
27
35
|
|
|
28
36
|
if [[ $? != 0 ]]
|
|
29
37
|
then
|
|
30
|
-
echo -e "Failed to checkout the default branch for \033[0;35m$
|
|
38
|
+
echo -e "Failed to checkout the default branch for \033[0;35m$directory_name\033[0m" # "$d is not configured for Git"
|
|
31
39
|
|
|
32
40
|
return 1
|
|
33
41
|
fi
|
|
@@ -63,15 +71,31 @@ HOME=$PWD
|
|
|
63
71
|
echo
|
|
64
72
|
echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
|
|
65
73
|
|
|
66
|
-
for
|
|
74
|
+
for flag in "$@";
|
|
67
75
|
do
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
path
|
|
71
|
-
|
|
76
|
+
shift
|
|
77
|
+
case "$flag" in
|
|
78
|
+
--path=*|-p=*)
|
|
79
|
+
set -- "$@" '-p' "${flag#*=}"
|
|
80
|
+
;;
|
|
81
|
+
--path|-p)
|
|
82
|
+
set -- "$@" '-p' "${1}"
|
|
83
|
+
;;
|
|
72
84
|
*)
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
set -- "$@" "$flag"
|
|
86
|
+
;;
|
|
87
|
+
esac
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
while getopts "p:" flag;
|
|
91
|
+
do
|
|
92
|
+
case "${flag}" in
|
|
93
|
+
p)
|
|
94
|
+
path="$OPTARG"
|
|
95
|
+
;;
|
|
96
|
+
*)
|
|
97
|
+
# Ignoring "$flag"
|
|
98
|
+
;;
|
|
75
99
|
esac
|
|
76
100
|
done
|
|
77
101
|
|
|
@@ -83,7 +107,7 @@ then
|
|
|
83
107
|
then
|
|
84
108
|
cd "$d"
|
|
85
109
|
|
|
86
|
-
execute "$
|
|
110
|
+
execute "$PWD"
|
|
87
111
|
|
|
88
112
|
cd ..
|
|
89
113
|
fi
|
|
@@ -93,17 +117,22 @@ else
|
|
|
93
117
|
then
|
|
94
118
|
cd "$path"
|
|
95
119
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
if [ -d "$PWD/.git" ];
|
|
121
|
+
then
|
|
122
|
+
execute "$PWD"
|
|
123
|
+
else
|
|
124
|
+
for d in *
|
|
125
|
+
do
|
|
126
|
+
if [ -d "$d" ]
|
|
127
|
+
then
|
|
128
|
+
cd "$d"
|
|
129
|
+
|
|
130
|
+
execute "$PWD"
|
|
131
|
+
|
|
132
|
+
cd ..
|
|
133
|
+
fi
|
|
134
|
+
done
|
|
135
|
+
fi
|
|
107
136
|
|
|
108
137
|
cd "$HOME"
|
|
109
138
|
fi
|
package/nvm.sh
CHANGED
|
@@ -2,29 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
NVM=~/.nvm
|
|
4
4
|
|
|
5
|
-
if [
|
|
5
|
+
if [ -f "$NVM/nvm.sh" ];
|
|
6
6
|
then
|
|
7
|
+
unset npm_package_scripts_nvm
|
|
8
|
+
unset npm_config_prefix
|
|
9
|
+
unset npm_lifecycle_script
|
|
10
|
+
|
|
7
11
|
source $NVM/nvm.sh
|
|
8
12
|
else
|
|
9
|
-
NVM=$(brew --prefix nvm)
|
|
13
|
+
NVM=$(brew --prefix nvm 2> /dev/null)
|
|
10
14
|
|
|
11
|
-
if [
|
|
15
|
+
if [ -f "$NVM/nvm.sh" ];
|
|
12
16
|
then
|
|
17
|
+
unset npm_package_scripts_nvm
|
|
18
|
+
unset npm_config_prefix
|
|
19
|
+
unset npm_lifecycle_script
|
|
20
|
+
|
|
13
21
|
source $NVM/nvm.sh
|
|
14
22
|
fi
|
|
15
23
|
fi
|
|
16
24
|
|
|
17
|
-
VERSION=$(nvm --version)
|
|
25
|
+
VERSION=$(nvm --version 2> /dev/null)
|
|
18
26
|
|
|
19
|
-
if [
|
|
27
|
+
if [ -z "$VERSION" ];
|
|
20
28
|
then
|
|
21
29
|
echo Environment does not have NVM installed
|
|
22
30
|
else
|
|
23
31
|
echo Environment has NVM version $VERSION installed
|
|
24
32
|
|
|
25
|
-
set
|
|
33
|
+
set -e
|
|
26
34
|
|
|
27
|
-
nvm use
|
|
35
|
+
nvm use
|
|
28
36
|
|
|
29
37
|
if [[ $? != 0 ]];
|
|
30
38
|
then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
"deps-head": "bin/head.sh"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"commander": "^10.0.
|
|
54
|
+
"commander": "^10.0.1",
|
|
55
55
|
"debug": "^4.3.4",
|
|
56
56
|
"glob-all": "^3.3.1",
|
|
57
57
|
"supports-color": "8.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.21.
|
|
61
|
-
"@babel/core": "^7.21.
|
|
62
|
-
"@babel/eslint-parser": "^7.21.
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
60
|
+
"@babel/cli": "^7.21.5",
|
|
61
|
+
"@babel/core": "^7.21.8",
|
|
62
|
+
"@babel/eslint-parser": "^7.21.8",
|
|
63
|
+
"@babel/preset-env": "^7.21.5",
|
|
64
64
|
"@babel/register": "^7.21.0",
|
|
65
65
|
"chai": "^4.3.7",
|
|
66
|
-
"core-js": "^3.
|
|
66
|
+
"core-js": "^3.30.1",
|
|
67
67
|
"cross-env": "^7.0.3",
|
|
68
|
-
"eslint": "^8.
|
|
68
|
+
"eslint": "^8.40.0",
|
|
69
69
|
"eslint-config-standard": "^17.0.0",
|
|
70
70
|
"eslint-plugin-import": "^2.27.5",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
package/src/common/env/index.mjs
CHANGED
|
@@ -4,15 +4,15 @@ import PATH from '#where-am-i'
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
join
|
|
7
|
-
} from 'path'
|
|
7
|
+
} from 'node:path'
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
readFileSync
|
|
11
|
-
} from 'fs'
|
|
11
|
+
} from 'node:fs'
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
platform
|
|
15
|
-
} from 'os'
|
|
15
|
+
} from 'node:os'
|
|
16
16
|
|
|
17
17
|
const {
|
|
18
18
|
name: NAME,
|
package/src/common/git/index.mjs
CHANGED
package/src/common/index.mjs
CHANGED
package/src/index.mjs
CHANGED