@modernpoacher/deps 2.1.11 → 2.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.1.11",
3
+ "version": "2.1.13",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -59,10 +59,16 @@ log(`\`git\` (${VERSION} - ${PLATFORM}) is awake`)
59
59
 
60
60
  const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
61
61
 
62
- function isFatal (s) {
62
+ export function isFatal (s) {
63
63
  return s.toLowerCase().startsWith('fatal: not a git repository')
64
64
  }
65
65
 
66
+ export function getIsDirectory (directory) {
67
+ return function isDirectory (s) {
68
+ return directory === s
69
+ }
70
+ }
71
+
66
72
  export function use (key) {
67
73
  const log = debug(`@modernpoacher/deps:${key}`)
68
74
 
@@ -78,11 +84,13 @@ export function use (key) {
78
84
  export function out (key, directory) {
79
85
  const log = debug(`@modernpoacher/deps:${key}`)
80
86
 
87
+ const isDirectory = getIsDirectory(directory)
88
+
81
89
  return function out (v) {
82
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => directory !== s).forEach((s) => { log(s) })
90
+ if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => !isDirectory(s)).forEach((s) => { log(s) })
83
91
  else {
84
92
  const s = v.trim()
85
- if (s !== '' && directory !== s) log(v.trimEnd())
93
+ if (s !== '' && !isDirectory(s)) log(v.trimEnd())
86
94
  }
87
95
  }
88
96
  }
@@ -90,11 +98,13 @@ export function out (key, directory) {
90
98
  export function err (key, directory) {
91
99
  const log = debug(`@modernpoacher/deps:${key}`)
92
100
 
101
+ const isDirectory = getIsDirectory(directory)
102
+
93
103
  return function err (v) {
94
- if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => directory !== s).filter((s) => !isFatal(s)).forEach((s) => { log(s) })
104
+ if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).filter((s) => !isDirectory(s)).filter((s) => !isFatal(s)).forEach((s) => { log(s) })
95
105
  else {
96
106
  const s = v.trim()
97
- if (s !== '' && directory !== s && !isFatal(s)) log(v.trimEnd())
107
+ if (s !== '' && !isDirectory(s) && !isFatal(s)) log(v.trimEnd())
98
108
  }
99
109
  }
100
110
  }