@modernpoacher/deps 2.0.9 → 2.0.11

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.
@@ -42,7 +42,9 @@ import {
42
42
  npmi,
43
43
  deps,
44
44
  hasConfiguration,
45
- getConfiguration
45
+ getConfiguration,
46
+ hasPackage,
47
+ getPackage
46
48
  } from '#deps/bin/common'
47
49
 
48
50
  const {
@@ -103,6 +105,20 @@ async function getAuthorFromConfiguration (directory) {
103
105
  )
104
106
  }
105
107
 
108
+ async function getAuthorFromPackage (directory) {
109
+ log('getAuthorFromPackage')
110
+
111
+ const PACKAGE = (
112
+ await hasPackage(directory)
113
+ ? await getPackage(directory)
114
+ : {}
115
+ )
116
+
117
+ return (
118
+ getAuthor(PACKAGE)
119
+ )
120
+ }
121
+
106
122
  const filterDeps = (v) => !!v // de-falsy
107
123
 
108
124
  const reduceDeps = (a, v) => a.includes(v) ? a : a.concat(v) // de-dupe
@@ -160,7 +176,7 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
160
176
  if (D === await gitRevParse(D)) {
161
177
  const ignore = await getIgnoreFromConfiguration(D)
162
178
  if (!ignore) {
163
- await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
179
+ await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D) || await getAuthorFromPackage(D))
164
180
  }
165
181
  }
166
182
  } catch (e) {
@@ -203,7 +219,7 @@ async function executeFrom (directory, registry, force, message, author) {
203
219
  const ignore = await getIgnoreFromConfiguration(D)
204
220
  if (!ignore) {
205
221
  return (
206
- await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
222
+ await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D) || await getAuthorFromPackage(D))
207
223
  )
208
224
  }
209
225
  }
@@ -222,7 +238,7 @@ async function executeOnly (directory, registry, force, message, author) {
222
238
  const ignore = await getIgnoreFromConfiguration(D)
223
239
  if (!ignore) {
224
240
  return (
225
- await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
241
+ await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D) || await getAuthorFromPackage(D))
226
242
  )
227
243
  }
228
244
  }
@@ -241,7 +257,7 @@ async function executePath (directory, registry, force, message, author) {
241
257
  const ignore = await getIgnoreFromConfiguration(D)
242
258
  if (!ignore) {
243
259
  return (
244
- await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
260
+ await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D) || await getAuthorFromPackage(D))
245
261
  )
246
262
  }
247
263
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -241,7 +241,18 @@ export const getIgnore = ({ ignore = false } = {}) => ignore === true
241
241
  *
242
242
  * @return {String}
243
243
  */
244
- export const getAuthor = ({ author } = {}) => String(author)
244
+ export const getAuthor = ({ author } = {}) => {
245
+ if ((author || false) instanceof Object) {
246
+ const {
247
+ name = '',
248
+ email = ''
249
+ } = author
250
+
251
+ return `${name} ${email}`.trim() || null
252
+ }
253
+
254
+ return author || null
255
+ }
245
256
 
246
257
  /**
247
258
  * @function isPreRelease