@modernpoacher/deps 2.0.19 → 2.0.21

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/deps.sh CHANGED
@@ -79,21 +79,49 @@ HOME=$PWD
79
79
  echo
80
80
  echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
81
81
 
82
- for i in "$@"
82
+ for flag in "$@";
83
83
  do
84
- case $i in
85
- path=*|-p=*|--path=*)
86
- path="${i#*=}"
87
- ;;
88
- from=*|-f=*|--from=*)
89
- from="${i#*=}"
90
- ;;
91
- only=*|-o=*|--only=*)
92
- only="${i#*=}"
93
- ;;
84
+ shift
85
+ case "$flag" in
86
+ --path=*|-p=*)
87
+ set -- "$@" '-p' "${flag#*=}"
88
+ ;;
89
+ --path|-p)
90
+ set -- "$@" '-p' "${1}"
91
+ ;;
92
+ --from=*|-f=*)
93
+ set -- "$@" '-f' "${flag#*=}"
94
+ ;;
95
+ --from|-f)
96
+ set -- "$@" '-f' "${1}"
97
+ ;;
98
+ --only=*|-o=*)
99
+ set -- "$@" '-o' "${flag#*=}"
100
+ ;;
101
+ --only|-o)
102
+ set -- "$@" '-o' "${1}"
103
+ ;;
94
104
  *)
95
- # unknown option
96
- ;;
105
+ set -- "$@" "$flag"
106
+ ;;
107
+ esac
108
+ done
109
+
110
+ while getopts "p:f:o:" flag;
111
+ do
112
+ case "${flag}" in
113
+ p)
114
+ path="$OPTARG"
115
+ ;;
116
+ f)
117
+ from="$OPTARG"
118
+ ;;
119
+ o)
120
+ only="$OPTARG"
121
+ ;;
122
+ *)
123
+ # Ignoring "$flag"
124
+ ;;
97
125
  esac
98
126
  done
99
127
 
@@ -105,7 +133,7 @@ then
105
133
  then
106
134
  cd "$d"
107
135
 
108
- execute "$d"
136
+ execute "$PWD"
109
137
 
110
138
  cd ..
111
139
  fi
@@ -115,17 +143,22 @@ else
115
143
  then
116
144
  cd "$path"
117
145
 
118
- for d in *
119
- do
120
- if [ -d "$d" ]
121
- then
122
- cd "$d"
146
+ if [ -d "$PWD/.git" ];
147
+ then
148
+ execute "$PWD"
149
+ else
150
+ for d in *
151
+ do
152
+ if [ -d "$d" ]
153
+ then
154
+ cd "$d"
123
155
 
124
- execute "$d"
156
+ execute "$PWD"
125
157
 
126
- cd ..
127
- fi
128
- done
158
+ cd ..
159
+ fi
160
+ done
161
+ fi
129
162
 
130
163
  cd "$HOME"
131
164
  else
@@ -141,7 +174,7 @@ else
141
174
  then
142
175
  cd "$d"
143
176
 
144
- execute "$d"
177
+ execute "$PWD"
145
178
 
146
179
  cd ..
147
180
  fi
@@ -158,7 +191,7 @@ else
158
191
  then
159
192
  cd "$d"
160
193
 
161
- execute "$d"
194
+ execute "$PWD"
162
195
 
163
196
  cd ..
164
197
  fi
@@ -33,7 +33,8 @@ import {
33
33
  import {
34
34
  REGISTRY,
35
35
  getIgnore,
36
- getAuthor
36
+ getAuthor,
37
+ getMessage
37
38
  } from '#deps/src/common'
38
39
 
39
40
  import {
@@ -143,6 +144,28 @@ async function getAuthorFromPackage (directory) {
143
144
  )
144
145
  }
145
146
 
147
+ /**
148
+ * @function getMessageFromConfiguration
149
+ *
150
+ * Interrogates `.depsrc` or `.depsrc.json` for a `message` value
151
+ *
152
+ * @param {string} directory
153
+ * @returns {Promise<string|null>}
154
+ */
155
+ async function getMessageFromConfiguration (directory) {
156
+ log('getMessageFromConfiguration')
157
+
158
+ const CONFIGURATION = (
159
+ await hasConfiguration(directory)
160
+ ? await getConfiguration(directory)
161
+ : {}
162
+ )
163
+
164
+ return (
165
+ getMessage(CONFIGURATION)
166
+ )
167
+ }
168
+
146
169
  /**
147
170
  * @function toAuthor
148
171
  *
@@ -159,6 +182,22 @@ async function toAuthor (author, directory) {
159
182
  return author || await getAuthorFromConfiguration(directory) || await getAuthorFromPackage(directory) || AUTHOR
160
183
  }
161
184
 
185
+ /**
186
+ * @function toMessage
187
+ *
188
+ * Ensures that the `message` is set either from the command line,
189
+ * configuration, or a default
190
+ *
191
+ * Since it can be null `message` may not default in function arguments
192
+ *
193
+ * @param {string|null} message
194
+ * @param {string} directory
195
+ * @returns {Promise<string>}
196
+ */
197
+ async function toMessage (message, directory) {
198
+ return message || await getMessageFromConfiguration(directory) || MESSAGE
199
+ }
200
+
162
201
  const filterDeps = (v) => !!v // de-falsy
163
202
 
164
203
  const reduceDeps = (a, v) => a.includes(v) ? a : a.concat(v) // de-dupe
@@ -216,7 +255,7 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
216
255
  if (D === await gitRevParse(D)) {
217
256
  const ignore = await getIgnoreFromConfiguration(D)
218
257
  if (!ignore) {
219
- await execute(D, registry, force, message, await toAuthor(author, D))
258
+ await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
220
259
  }
221
260
  }
222
261
  } catch (e) {
@@ -259,7 +298,7 @@ async function executeFrom (directory, registry, force, message, author) {
259
298
  const ignore = await getIgnoreFromConfiguration(D)
260
299
  if (!ignore) {
261
300
  return (
262
- await execute(D, registry, force, message, await toAuthor(author, D))
301
+ await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
263
302
  )
264
303
  }
265
304
  }
@@ -278,7 +317,7 @@ async function executeOnly (directory, registry, force, message, author) {
278
317
  const ignore = await getIgnoreFromConfiguration(D)
279
318
  if (!ignore) {
280
319
  return (
281
- await execute(D, registry, force, message, await toAuthor(author, D))
320
+ await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
282
321
  )
283
322
  }
284
323
  }
@@ -297,7 +336,7 @@ async function executePath (directory, registry, force, message, author) {
297
336
  const ignore = await getIgnoreFromConfiguration(D)
298
337
  if (!ignore) {
299
338
  return (
300
- await execute(D, registry, force, message, await toAuthor(author, D))
339
+ await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
301
340
  )
302
341
  }
303
342
  }
package/bin/head.sh CHANGED
@@ -76,7 +76,7 @@ function git_remote_set_head {
76
76
  }
77
77
 
78
78
  function execute {
79
- report "$1"
79
+ report "${1##*/}"
80
80
 
81
81
  has_git "$1"
82
82
 
@@ -123,15 +123,31 @@ HOME=$PWD
123
123
  echo
124
124
  echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
125
125
 
126
- for i in "$@"
126
+ for flag in "$@";
127
127
  do
128
- case $i in
129
- path=*|-p=*|--path=*)
130
- path="${i#*=}"
131
- ;;
128
+ shift
129
+ case "$flag" in
130
+ --path=*|-p=*)
131
+ set -- "$@" '-p' "${flag#*=}"
132
+ ;;
133
+ --path|-p)
134
+ set -- "$@" '-p' "${1}"
135
+ ;;
132
136
  *)
133
- # unknown option
134
- ;;
137
+ set -- "$@" "$flag"
138
+ ;;
139
+ esac
140
+ done
141
+
142
+ while getopts "p:" flag;
143
+ do
144
+ case "${flag}" in
145
+ p)
146
+ path="$OPTARG"
147
+ ;;
148
+ *)
149
+ # Ignoring "$flag"
150
+ ;;
135
151
  esac
136
152
  done
137
153
 
@@ -143,7 +159,7 @@ then
143
159
  then
144
160
  cd "$d"
145
161
 
146
- execute "$d"
162
+ execute "$PWD"
147
163
 
148
164
  cd ..
149
165
  fi
@@ -153,17 +169,22 @@ else
153
169
  then
154
170
  cd "$path"
155
171
 
156
- for d in *
157
- do
158
- if [ -d "$d" ]
159
- then
160
- cd "$d"
172
+ if [ -d "$PWD/.git" ];
173
+ then
174
+ execute "$PWD"
175
+ else
176
+ for d in *
177
+ do
178
+ if [ -d "$d" ]
179
+ then
180
+ cd "$d"
161
181
 
162
- execute "$d"
182
+ execute "$PWD"
163
183
 
164
- cd ..
165
- fi
166
- done
184
+ cd ..
185
+ fi
186
+ done
187
+ fi
167
188
 
168
189
  cd "$HOME"
169
190
  fi
package/bin/push.sh CHANGED
@@ -45,7 +45,7 @@ function update {
45
45
  }
46
46
 
47
47
  function execute {
48
- report "$1"
48
+ report "${1##*/}"
49
49
 
50
50
  checkout_default_branch "$1"
51
51
 
@@ -62,15 +62,31 @@ HOME=$PWD
62
62
  echo
63
63
  echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
64
64
 
65
- for i in "$@"
65
+ for flag in "$@";
66
66
  do
67
- case $i in
68
- path=*|-p=*|--path=*)
69
- path="${i#*=}"
70
- ;;
67
+ shift
68
+ case "$flag" in
69
+ --path=*|-p=*)
70
+ set -- "$@" '-p' "${flag#*=}"
71
+ ;;
72
+ --path|-p)
73
+ set -- "$@" '-p' "${1}"
74
+ ;;
71
75
  *)
72
- # unknown option
73
- ;;
76
+ set -- "$@" "$flag"
77
+ ;;
78
+ esac
79
+ done
80
+
81
+ while getopts "p:" flag;
82
+ do
83
+ case "${flag}" in
84
+ p)
85
+ path="$OPTARG"
86
+ ;;
87
+ *)
88
+ # Ignoring "$flag"
89
+ ;;
74
90
  esac
75
91
  done
76
92
 
@@ -82,7 +98,7 @@ then
82
98
  then
83
99
  cd "$d"
84
100
 
85
- execute "$d"
101
+ execute "$PWD"
86
102
 
87
103
  cd ..
88
104
  fi
@@ -92,17 +108,22 @@ else
92
108
  then
93
109
  cd "$path"
94
110
 
95
- for d in *
96
- do
97
- if [ -d "$d" ]
98
- then
99
- cd "$d"
100
-
101
- execute "$d"
102
-
103
- cd ..
104
- fi
105
- done
111
+ if [ -d "$PWD/.git" ];
112
+ then
113
+ execute "$PWD"
114
+ else
115
+ for d in *
116
+ do
117
+ if [ -d "$d" ]
118
+ then
119
+ cd "$d"
120
+
121
+ execute "$PWD"
122
+
123
+ cd ..
124
+ fi
125
+ done
126
+ fi
106
127
 
107
128
  cd "$HOME"
108
129
  fi
package/bin/wipe.sh CHANGED
@@ -46,7 +46,7 @@ function update {
46
46
  }
47
47
 
48
48
  function execute {
49
- report "$1"
49
+ report "${1##*/}"
50
50
 
51
51
  checkout_default_branch "$1"
52
52
 
@@ -63,15 +63,31 @@ HOME=$PWD
63
63
  echo
64
64
  echo -e "\033[0;32mStarting ...\033[0m" # "Starting ..."
65
65
 
66
- for i in "$@"
66
+ for flag in "$@";
67
67
  do
68
- case $i in
69
- path=*|-p=*|--path=*)
70
- path="${i#*=}"
71
- ;;
68
+ shift
69
+ case "$flag" in
70
+ --path=*|-p=*)
71
+ set -- "$@" '-p' "${flag#*=}"
72
+ ;;
73
+ --path|-p)
74
+ set -- "$@" '-p' "${1}"
75
+ ;;
72
76
  *)
73
- # unknown option
74
- ;;
77
+ set -- "$@" "$flag"
78
+ ;;
79
+ esac
80
+ done
81
+
82
+ while getopts "p:" flag;
83
+ do
84
+ case "${flag}" in
85
+ p)
86
+ path="$OPTARG"
87
+ ;;
88
+ *)
89
+ # Ignoring "$flag"
90
+ ;;
75
91
  esac
76
92
  done
77
93
 
@@ -83,7 +99,7 @@ then
83
99
  then
84
100
  cd "$d"
85
101
 
86
- execute "$d"
102
+ execute "$PWD"
87
103
 
88
104
  cd ..
89
105
  fi
@@ -93,17 +109,22 @@ else
93
109
  then
94
110
  cd "$path"
95
111
 
96
- for d in *
97
- do
98
- if [ -d "$d" ]
99
- then
100
- cd "$d"
101
-
102
- execute "$d"
103
-
104
- cd ..
105
- fi
106
- done
112
+ if [ -d "$PWD/.git" ];
113
+ then
114
+ execute "$PWD"
115
+ else
116
+ for d in *
117
+ do
118
+ if [ -d "$d" ]
119
+ then
120
+ cd "$d"
121
+
122
+ execute "$PWD"
123
+
124
+ cd ..
125
+ fi
126
+ done
127
+ fi
107
128
 
108
129
  cd "$HOME"
109
130
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.0.19",
3
+ "version": "2.0.21",
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.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.0",
61
- "@babel/core": "^7.21.3",
60
+ "@babel/cli": "^7.21.5",
61
+ "@babel/core": "^7.21.5",
62
62
  "@babel/eslint-parser": "^7.21.3",
63
- "@babel/preset-env": "^7.20.2",
63
+ "@babel/preset-env": "^7.21.5",
64
64
  "@babel/register": "^7.21.0",
65
65
  "chai": "^4.3.7",
66
- "core-js": "^3.29.1",
66
+ "core-js": "^3.30.1",
67
67
  "cross-env": "^7.0.3",
68
- "eslint": "^8.36.0",
68
+ "eslint": "^8.39.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",
@@ -250,9 +250,9 @@ export const getPeerDependencies = ({ peerDependencies } = {}) => peerDependenci
250
250
  /**
251
251
  * @function getIgnore
252
252
  *
253
- * Get the ignore flag by destructuring the package or configuration
253
+ * Get the ignore flag by destructuring the configuration
254
254
  *
255
- * @param {Package|Configuration}
255
+ * @param {Configuration}
256
256
  *
257
257
  * @return {boolean}
258
258
  */
@@ -287,6 +287,17 @@ export const getAuthor = ({ author = '' } = {}) => {
287
287
  return author || null
288
288
  }
289
289
 
290
+ /**
291
+ * @function getMessage
292
+ *
293
+ * Get the message by destructuring the configuration
294
+ *
295
+ * @param {Configuration}
296
+ *
297
+ * @return {string|null}
298
+ */
299
+ export const getMessage = ({ message = '' } = {}) => message || null
300
+
290
301
  /**
291
302
  * @function isPreRelease
292
303
  *