@modernpoacher/deps 2.1.11 → 2.1.14
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/common/index.mjs +16 -6
- package/package.json +1 -1
- package/src/common/git/index.mjs +63 -19
- package/src/index.mjs +16 -6
package/bin/common/index.mjs
CHANGED
|
@@ -91,15 +91,25 @@ export function getArgs () {
|
|
|
91
91
|
)
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
function filter (v) {
|
|
95
|
+
const s = v.trim()
|
|
96
|
+
|
|
97
|
+
return Boolean(s)
|
|
98
|
+
}
|
|
99
|
+
|
|
94
100
|
export function use (key) {
|
|
95
101
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
96
102
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
function write (v) {
|
|
104
|
+
const s = v.trimEnd()
|
|
105
|
+
|
|
106
|
+
log(s)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return function use (value) {
|
|
110
|
+
value.split(String.fromCharCode(10))
|
|
111
|
+
.filter(filter)
|
|
112
|
+
.forEach(write)
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
|
package/package.json
CHANGED
package/src/common/git/index.mjs
CHANGED
|
@@ -59,43 +59,87 @@ 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
|
|
62
|
+
function filter (v) {
|
|
63
|
+
const s = v.trim()
|
|
64
|
+
|
|
65
|
+
return Boolean(s)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function getIsDirectory (directory) {
|
|
69
|
+
return function isDirectory (s) {
|
|
70
|
+
return directory === s
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function isFatal (s) {
|
|
63
75
|
return s.toLowerCase().startsWith('fatal: not a git repository')
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
export function use (key) {
|
|
67
79
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
function write (v) {
|
|
82
|
+
const s = v.trimEnd()
|
|
83
|
+
|
|
84
|
+
log(s)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return function use (value) {
|
|
88
|
+
value.split(String.fromCharCode(10))
|
|
89
|
+
.filter(filter)
|
|
90
|
+
.forEach(write)
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
|
|
78
94
|
export function out (key, directory) {
|
|
79
95
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
80
96
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
const isDirectory = getIsDirectory(directory)
|
|
98
|
+
|
|
99
|
+
function filterOut (v) {
|
|
100
|
+
const s = v.trim()
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
!isDirectory(s)
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function write (v) {
|
|
108
|
+
const s = v.trimEnd()
|
|
109
|
+
|
|
110
|
+
log(s)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return function out (value) {
|
|
114
|
+
value.split(String.fromCharCode(10))
|
|
115
|
+
.filter(filter).filter(filterOut)
|
|
116
|
+
.forEach(write)
|
|
87
117
|
}
|
|
88
118
|
}
|
|
89
119
|
|
|
90
120
|
export function err (key, directory) {
|
|
91
121
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
92
122
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
123
|
+
const isDirectory = getIsDirectory(directory)
|
|
124
|
+
|
|
125
|
+
function filterErr (v) {
|
|
126
|
+
const s = v.trim()
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
!isDirectory(s) && !isFatal(s)
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function write (v) {
|
|
134
|
+
const s = v.trimEnd()
|
|
135
|
+
|
|
136
|
+
log(s)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return function err (value) {
|
|
140
|
+
value.split(String.fromCharCode(10))
|
|
141
|
+
.filter(filter).filter(filterErr)
|
|
142
|
+
.forEach(write)
|
|
99
143
|
}
|
|
100
144
|
}
|
|
101
145
|
|
package/src/index.mjs
CHANGED
|
@@ -45,15 +45,25 @@ const log = debug('@modernpoacher/deps')
|
|
|
45
45
|
|
|
46
46
|
log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
47
47
|
|
|
48
|
+
function filter (v) {
|
|
49
|
+
const s = v.trim()
|
|
50
|
+
|
|
51
|
+
return Boolean(s)
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
export function use (key) {
|
|
49
55
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
function write (v) {
|
|
58
|
+
const s = v.trimEnd()
|
|
59
|
+
|
|
60
|
+
log(s)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return function use (value) {
|
|
64
|
+
value.split(String.fromCharCode(10))
|
|
65
|
+
.filter(filter)
|
|
66
|
+
.forEach(write)
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
|