@modernpoacher/deps 1.6.2 → 1.6.5
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.js +16 -19
- package/package.json +1 -1
package/bin/common/index.js
CHANGED
|
@@ -44,11 +44,17 @@ const log = debug('@modernpoacher/deps')
|
|
|
44
44
|
|
|
45
45
|
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
46
46
|
|
|
47
|
+
const OPTIONS = {
|
|
48
|
+
maxBuffer: 1024 * 2000,
|
|
49
|
+
shell: true,
|
|
50
|
+
stdio: 'inherit'
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
const CODE = 0
|
|
48
54
|
|
|
49
55
|
const MESSAGE = 'Either no error message has been defined or no error has been supplied'
|
|
50
56
|
|
|
51
|
-
const tidy = (v) => v.replace(/\n\n/gm,
|
|
57
|
+
const tidy = (v) => v.replace(/\n\n/gm, '\n').trim()
|
|
52
58
|
|
|
53
59
|
const trim = (v) => v.split('\n').map((v) => v.trimEnd()).join('\n').trim()
|
|
54
60
|
|
|
@@ -56,35 +62,26 @@ const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePa
|
|
|
56
62
|
|
|
57
63
|
const getRmrfCommands = PLATFORM === 'win32'
|
|
58
64
|
? (directory = DIRECTORY) => tidy(`
|
|
59
|
-
|
|
60
|
-
del
|
|
65
|
+
rmdir /s /q node_modules 2> nul &
|
|
66
|
+
del package-lock.json 2> nul
|
|
61
67
|
`)
|
|
62
68
|
: (directory = DIRECTORY) => tidy(`
|
|
63
|
-
cd "${normalize(directory)}"
|
|
64
69
|
rm -rf node_modules package-lock.json
|
|
65
70
|
`)
|
|
66
71
|
|
|
67
72
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
68
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(
|
|
69
|
-
cd "${normalize(directory)}"
|
|
70
|
-
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
71
|
-
`)
|
|
73
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
|
|
72
74
|
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
73
75
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
74
|
-
|
|
75
|
-
. "${normalize(NVM)}" 2> /dev/null
|
|
76
|
+
. "${NVM}" 2> /dev/null
|
|
76
77
|
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
77
78
|
`)
|
|
78
79
|
|
|
79
80
|
const getDepsCommands = PLATFORM === 'win32'
|
|
80
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(
|
|
81
|
-
cd "${normalize(directory)}"
|
|
82
|
-
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
83
|
-
`)
|
|
81
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
|
|
84
82
|
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
85
83
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
86
|
-
|
|
87
|
-
. "${normalize(NVM)}" 2> /dev/null
|
|
84
|
+
. "${NVM}" 2> /dev/null
|
|
88
85
|
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
89
86
|
`)
|
|
90
87
|
|
|
@@ -243,7 +240,7 @@ function rmrf (directory = DIRECTORY) {
|
|
|
243
240
|
const {
|
|
244
241
|
stdout,
|
|
245
242
|
stderr
|
|
246
|
-
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
243
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
247
244
|
|
|
248
245
|
stdout.on('data', log)
|
|
249
246
|
stderr.on('data', log)
|
|
@@ -264,7 +261,7 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
264
261
|
const {
|
|
265
262
|
stdout,
|
|
266
263
|
stderr
|
|
267
|
-
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
264
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
268
265
|
|
|
269
266
|
stdout.on('data', log)
|
|
270
267
|
stderr.on('data', log)
|
|
@@ -285,7 +282,7 @@ function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
285
282
|
const {
|
|
286
283
|
stdout,
|
|
287
284
|
stderr
|
|
288
|
-
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
285
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
289
286
|
|
|
290
287
|
stdout.on('data', log)
|
|
291
288
|
stderr.on('data', log)
|