@modernpoacher/deps 2.0.21 → 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 +13 -5
- package/bin/execute/app.mjs +1 -1
- package/bin/head.sh +31 -11
- package/bin/push.sh +13 -5
- package/bin/wipe.sh +13 -5
- package/nvm.sh +15 -7
- package/package.json +4 -4
- 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
|
}
|
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
|
|
@@ -76,10 +92,14 @@ function git_remote_set_head {
|
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
function execute {
|
|
79
|
-
report "$
|
|
95
|
+
report "$1"
|
|
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
|
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
|
|
@@ -45,7 +53,7 @@ function update {
|
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
function execute {
|
|
48
|
-
report "$
|
|
56
|
+
report "$1"
|
|
49
57
|
|
|
50
58
|
checkout_default_branch "$1"
|
|
51
59
|
|
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
|
|
@@ -46,7 +54,7 @@ function update {
|
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
function execute {
|
|
49
|
-
report "$
|
|
57
|
+
report "$1"
|
|
50
58
|
|
|
51
59
|
checkout_default_branch "$1"
|
|
52
60
|
|
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",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@babel/cli": "^7.21.5",
|
|
61
|
-
"@babel/core": "^7.21.
|
|
62
|
-
"@babel/eslint-parser": "^7.21.
|
|
61
|
+
"@babel/core": "^7.21.8",
|
|
62
|
+
"@babel/eslint-parser": "^7.21.8",
|
|
63
63
|
"@babel/preset-env": "^7.21.5",
|
|
64
64
|
"@babel/register": "^7.21.0",
|
|
65
65
|
"chai": "^4.3.7",
|
|
66
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