@modernpoacher/deps 2.1.9 → 2.1.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.
@@ -53,9 +53,9 @@ const CODE = 0
53
53
 
54
54
  const MESSAGE = 'Either no error message has been defined or no error has been supplied'
55
55
 
56
- const tidy = (v) => v.replace(/\n\n/gm, '\n').trim()
56
+ export const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
57
57
 
58
- const trim = (v) => v.split('\n').map((v) => v.trim()).join('\n').trim()
58
+ export const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
59
59
 
60
60
  const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePath = relative.bind(null, process.cwd())
61
61
 
@@ -95,10 +95,10 @@ export function use (key) {
95
95
  const log = debug(`@modernpoacher/deps:${key}`)
96
96
 
97
97
  return function use (v) {
98
- if (v.includes('\n')) v.split('\n').map((s) => trim(s)).filter(Boolean).forEach((s) => log(s))
98
+ if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
99
99
  else {
100
100
  const s = v.trim()
101
- if (s !== '') log(trim(s))
101
+ if (s !== '') log(v.trimEnd())
102
102
  }
103
103
  }
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -57,45 +57,45 @@ const log = debug('@modernpoacher/deps')
57
57
 
58
58
  log(`\`git\` (${VERSION} - ${PLATFORM}) is awake`)
59
59
 
60
- const trim = (v) => v.split('\n').map((v) => v.trimEnd()).join('\n').trim()
60
+ const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
61
61
 
62
- function use (key) {
62
+ function isFatal (s) {
63
+ return s.toLowerCase().startsWith('fatal: not a git repository')
64
+ }
65
+
66
+ export function use (key) {
63
67
  const log = debug(`@modernpoacher/deps:${key}`)
64
68
 
65
69
  return function use (v) {
66
- if (v.trim() === '') return
67
-
68
- return (
69
- log(trim(v))
70
- )
70
+ if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
71
+ else {
72
+ const s = v.trim()
73
+ if (s !== '') log(v.trimEnd())
74
+ }
71
75
  }
72
76
  }
73
77
 
74
- function out (key, directory) {
78
+ export function out (key, directory) {
75
79
  const log = debug(`@modernpoacher/deps:${key}`)
76
80
 
77
81
  return function out (v) {
78
- const s = v.trim()
79
-
80
- if (s === '' || directory === s) return
81
-
82
- return (
83
- log(trim(s))
84
- )
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) })
83
+ else {
84
+ const s = v.trim()
85
+ if (s !== '' && directory !== s) log(v.trimEnd())
86
+ }
85
87
  }
86
88
  }
87
89
 
88
- function err (key, directory) {
90
+ export function err (key, directory) {
89
91
  const log = debug(`@modernpoacher/deps:${key}`)
90
92
 
91
93
  return function err (v) {
92
- const s = v.trim()
93
-
94
- if (s === '' || directory === s || s.toLowerCase().startsWith('fatal: not a git repository')) return
95
-
96
- return (
97
- log(trim(s))
98
- )
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) })
95
+ else {
96
+ const s = v.trim()
97
+ if (s !== '' && directory !== s && !isFatal(s)) log(v.trimEnd())
98
+ }
99
99
  }
100
100
  }
101
101
 
@@ -70,7 +70,9 @@ const log = debug('@modernpoacher/deps')
70
70
 
71
71
  log(`\`common\` (${VERSION} - ${PLATFORM}) is awake at "${PATH}"`)
72
72
 
73
- const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
73
+ export const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
74
+
75
+ export const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
74
76
 
75
77
  /**
76
78
  * @function getSaveProdParameter
package/src/index.mjs CHANGED
@@ -45,17 +45,15 @@ const log = debug('@modernpoacher/deps')
45
45
 
46
46
  log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
47
47
 
48
- function use (key) {
48
+ export function use (key) {
49
49
  const log = debug(`@modernpoacher/deps:${key}`)
50
50
 
51
51
  return function use (v) {
52
- const s = v.trim()
53
-
54
- if (s === '') return
55
-
56
- return (
57
- log(s)
58
- )
52
+ if (v.includes(String.fromCharCode(10))) v.split(String.fromCharCode(10)).map((s) => s.trimEnd()).filter(Boolean).forEach((s) => { log(s) })
53
+ else {
54
+ const s = v.trim()
55
+ if (s !== '') log(v.trimEnd())
56
+ }
59
57
  }
60
58
  }
61
59