@modernpoacher/deps 2.2.43 → 2.2.45

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.
@@ -49,6 +49,7 @@ import {
49
49
  import {
50
50
  formatDirectory,
51
51
  use,
52
+ trim,
52
53
  tidy
53
54
  } from '#deps/src/common/format'
54
55
 
@@ -82,20 +83,20 @@ const MESSAGE = 'Either no error message has been defined or no error has been s
82
83
  const SP = String.fromCodePoint(32)
83
84
 
84
85
  const getRmrfCommands = PLATFORM === 'win32'
85
- ? () => tidy(`
86
+ ? () => trim(tidy(`
86
87
  rmdir /s /q node_modules 2> nul & del package-lock.json 2> nul
87
- `)
88
- : () => tidy(`
88
+ `))
89
+ : () => trim(tidy(`
89
90
  rm -rf node_modules package-lock.json
90
- `)
91
+ `))
91
92
 
92
93
  const getNpmiCommands = PLATFORM === 'win32'
93
- ? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
94
- : (registry = REGISTRY, force = false) => tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'npm i')))))
94
+ ? (registry = REGISTRY, force = false) => trim(tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i'))))
95
+ : (registry = REGISTRY, force = false) => trim(tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'npm i'))))))
95
96
 
96
97
  const getDepsCommands = PLATFORM === 'win32'
97
- ? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
98
- : (registry = REGISTRY, force = false) => tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'deps')))))
98
+ ? (registry = REGISTRY, force = false) => trim(tidy(getRegistryParameter(registry, getForceParameter(force, 'deps'))))
99
+ : (registry = REGISTRY, force = false) => trim(tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'deps'))))))
99
100
 
100
101
  export const DEPS = PLATFORM === 'win32'
101
102
  ? `bash "${join(BIN, '.\\bash\\deps.sh')}"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.2.43",
3
+ "version": "2.2.45",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -41,7 +41,14 @@ const LF = String.fromCodePoint(10)
41
41
  * @returns {string}
42
42
  */
43
43
  export function trim (v) {
44
- return v.split(LF).map(trimEnd).join(LF).trim()
44
+ return (
45
+ v
46
+ .split(LF)
47
+ .map((v) => v.trim() ? v.trimEnd() : '')
48
+ .filter(Boolean)
49
+ .join(LF)
50
+ .trim()
51
+ )
45
52
  }
46
53
 
47
54
  /**
@@ -57,7 +64,7 @@ export function trimEnd (v) {
57
64
  * @returns {string}
58
65
  */
59
66
  export function tidy (v) {
60
- return v.replace(/\n{2,}}/gm, LF).trim()
67
+ return v.replace(/\n{2,}}/gm, LF)
61
68
  }
62
69
 
63
70
  /**
@@ -19,6 +19,7 @@ import {
19
19
 
20
20
  import {
21
21
  formatAuthor,
22
+ trim,
22
23
  tidy
23
24
  } from '#deps/src/common/format'
24
25
 
@@ -163,8 +164,8 @@ ${commands}
163
164
  * @returns {string}
164
165
  */
165
166
  export const getCommands = PLATFORM === 'win32'
166
- ? (commands = 'npm i') => tidy(commands)
167
- : (commands = 'npm i') => tidy(getExportPath(getNvm(commands)))
167
+ ? (commands = 'npm i') => trim(tidy(commands))
168
+ : (commands = 'npm i') => trim(tidy(getExportPath(getNvm(commands))))
168
169
 
169
170
  /**
170
171
  * @function getProdDependencies