@modernpoacher/deps 2.0.0 → 2.0.2
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 +35 -36
- package/bin/execute/app.mjs +34 -35
- package/package.json +1 -1
- package/src/common/git/index.mjs +64 -50
- package/src/index.mjs +72 -56
- package/src/install/index.mjs +6 -4
- package/.nvmrc +0 -1
package/bin/common/index.mjs
CHANGED
|
@@ -62,25 +62,25 @@ const trim = (v) => v.split('\n').map((v) => v.trim()).join('\n').trim()
|
|
|
62
62
|
const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePath = relative.bind(null, process.cwd())
|
|
63
63
|
|
|
64
64
|
const getRmrfCommands = PLATFORM === 'win32'
|
|
65
|
-
? (
|
|
65
|
+
? () => tidy(`
|
|
66
66
|
rmdir /s /q node_modules 2> nul & \
|
|
67
67
|
del package-lock.json 2> nul
|
|
68
68
|
`)
|
|
69
|
-
: (
|
|
69
|
+
: () => tidy(`
|
|
70
70
|
rm -rf node_modules package-lock.json
|
|
71
71
|
`)
|
|
72
72
|
|
|
73
73
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
74
|
-
? (
|
|
75
|
-
: (
|
|
74
|
+
? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
|
|
75
|
+
: (registry = REGISTRY, force = false) => tidy(`
|
|
76
76
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
77
77
|
. "${NVM}" 2> /dev/null
|
|
78
78
|
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
79
79
|
`)
|
|
80
80
|
|
|
81
81
|
const getDepsCommands = PLATFORM === 'win32'
|
|
82
|
-
? (
|
|
83
|
-
: (
|
|
82
|
+
? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
|
|
83
|
+
: (registry = REGISTRY, force = false) => tidy(`
|
|
84
84
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
85
85
|
. "${NVM}" 2> /dev/null
|
|
86
86
|
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
@@ -92,11 +92,7 @@ function use (key) {
|
|
|
92
92
|
return function use (v) {
|
|
93
93
|
const s = v.trim()
|
|
94
94
|
|
|
95
|
-
if (s
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
log(trim(s))
|
|
99
|
-
)
|
|
95
|
+
if (s !== '') log(trim(s))
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
|
|
@@ -105,15 +101,15 @@ function handleError (e = {}) {
|
|
|
105
101
|
code = CODE,
|
|
106
102
|
message = MESSAGE
|
|
107
103
|
} = e
|
|
104
|
+
|
|
108
105
|
const log = debug('@modernpoacher/deps:error')
|
|
109
106
|
if (code > 1) log(code)
|
|
110
107
|
log(message)
|
|
111
|
-
log(e)
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
const handlePackageError = ({ message = MESSAGE } = {}) => log(`Package error: "${message}"`)
|
|
110
|
+
const handlePackageError = ({ message = MESSAGE } = {}) => { log(`Package error: "${message}"`) }
|
|
115
111
|
|
|
116
|
-
const handleConfigurationError = ({ message = MESSAGE } = {}) => log(`Configuration error: "${message}"`)
|
|
112
|
+
const handleConfigurationError = ({ message = MESSAGE } = {}) => { log(`Configuration error: "${message}"`) }
|
|
117
113
|
|
|
118
114
|
const getPackageJsonPath = (directory = DIRECTORY) => resolve(directory, 'package.json')
|
|
119
115
|
|
|
@@ -153,7 +149,7 @@ async function hasPackage (directory = DIRECTORY) {
|
|
|
153
149
|
|
|
154
150
|
log(`Package at "${toRelativePath(getPackageJsonPath(directory))}"`)
|
|
155
151
|
return true
|
|
156
|
-
} catch
|
|
152
|
+
} catch {
|
|
157
153
|
log(`No package at "${toRelativePath(getPackageJsonPath(directory))}"`)
|
|
158
154
|
return false
|
|
159
155
|
}
|
|
@@ -239,17 +235,18 @@ function rmrf (directory = DIRECTORY) {
|
|
|
239
235
|
|
|
240
236
|
return (
|
|
241
237
|
new Promise((resolve, reject) => {
|
|
242
|
-
const
|
|
243
|
-
const commands = getRmrfCommands(directory)
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* log(commands)
|
|
247
|
-
*/
|
|
238
|
+
const commands = getRmrfCommands()
|
|
248
239
|
|
|
249
240
|
const {
|
|
250
241
|
stdout,
|
|
251
242
|
stderr
|
|
252
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
243
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
244
|
+
(!e)
|
|
245
|
+
? resolve(v)
|
|
246
|
+
: reject(e)
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
const log = use('rmrf')
|
|
253
250
|
|
|
254
251
|
stdout.on('data', log)
|
|
255
252
|
stderr.on('data', log)
|
|
@@ -262,17 +259,18 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
262
259
|
|
|
263
260
|
return (
|
|
264
261
|
new Promise((resolve, reject) => {
|
|
265
|
-
const
|
|
266
|
-
const commands = getNpmiCommands(directory, registry, force)
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* log(commands)
|
|
270
|
-
*/
|
|
262
|
+
const commands = getNpmiCommands(registry, force)
|
|
271
263
|
|
|
272
264
|
const {
|
|
273
265
|
stdout,
|
|
274
266
|
stderr
|
|
275
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
267
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
268
|
+
(!e)
|
|
269
|
+
? resolve(v)
|
|
270
|
+
: reject(e)
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
const log = use('npmi')
|
|
276
274
|
|
|
277
275
|
stdout.on('data', log)
|
|
278
276
|
stderr.on('data', log)
|
|
@@ -285,17 +283,18 @@ function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
285
283
|
|
|
286
284
|
return (
|
|
287
285
|
new Promise((resolve, reject) => {
|
|
288
|
-
const
|
|
289
|
-
const commands = getDepsCommands(directory, registry, force)
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* log(commands)
|
|
293
|
-
*/
|
|
286
|
+
const commands = getDepsCommands(registry, force)
|
|
294
287
|
|
|
295
288
|
const {
|
|
296
289
|
stdout,
|
|
297
290
|
stderr
|
|
298
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
291
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
292
|
+
(!e)
|
|
293
|
+
? resolve(v)
|
|
294
|
+
: reject(e)
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
const log = use('deps')
|
|
299
298
|
|
|
300
299
|
stdout.on('data', log)
|
|
301
300
|
stderr.on('data', log)
|
package/bin/execute/app.mjs
CHANGED
|
@@ -72,28 +72,31 @@ function handleCommandError (e) {
|
|
|
72
72
|
const log = debug('@modernpoacher/deps:error')
|
|
73
73
|
if (code > 1) log(code)
|
|
74
74
|
log(message)
|
|
75
|
-
log(e)
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
async function getIgnoreFromConfiguration (
|
|
78
|
+
async function getIgnoreFromConfiguration (directory) {
|
|
80
79
|
log('getIgnoreFromConfiguration')
|
|
81
80
|
|
|
82
|
-
const CONFIGURATION =
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
const CONFIGURATION = (
|
|
82
|
+
await hasConfiguration(directory)
|
|
83
|
+
? await getConfiguration(directory)
|
|
84
|
+
: {}
|
|
85
|
+
)
|
|
85
86
|
|
|
86
87
|
return (
|
|
87
88
|
getIgnore(CONFIGURATION)
|
|
88
89
|
)
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
async function getAuthorFromConfiguration (
|
|
92
|
+
async function getAuthorFromConfiguration (directory) {
|
|
92
93
|
log('getAuthorFromConfiguration')
|
|
93
94
|
|
|
94
|
-
const CONFIGURATION =
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
const CONFIGURATION = (
|
|
96
|
+
await hasConfiguration(directory)
|
|
97
|
+
? await getConfiguration(directory)
|
|
98
|
+
: {}
|
|
99
|
+
)
|
|
97
100
|
|
|
98
101
|
return (
|
|
99
102
|
getAuthor(CONFIGURATION)
|
|
@@ -109,7 +112,11 @@ function getPathList (directory) {
|
|
|
109
112
|
|
|
110
113
|
return (
|
|
111
114
|
new Promise((resolve, reject) => {
|
|
112
|
-
glob(`${directory}/*/`, (error, array) =>
|
|
115
|
+
glob(`${directory}/*/`, (error, array) => {
|
|
116
|
+
(!error)
|
|
117
|
+
? resolve(array)
|
|
118
|
+
: reject(error)
|
|
119
|
+
})
|
|
113
120
|
})
|
|
114
121
|
)
|
|
115
122
|
}
|
|
@@ -147,15 +154,13 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
|
|
|
147
154
|
log('iterate')
|
|
148
155
|
|
|
149
156
|
if (directory) {
|
|
150
|
-
const
|
|
157
|
+
const D = resolve(directory)
|
|
151
158
|
|
|
152
159
|
try {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (path === await gitRevParse(path)) {
|
|
156
|
-
const ignore = await getIgnoreFromConfiguration(path)
|
|
160
|
+
if (D === await gitRevParse(D)) {
|
|
161
|
+
const ignore = await getIgnoreFromConfiguration(D)
|
|
157
162
|
if (!ignore) {
|
|
158
|
-
await execute(
|
|
163
|
+
await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
} catch (e) {
|
|
@@ -191,16 +196,14 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
191
196
|
async function executeFrom (directory, registry, force, message, author) {
|
|
192
197
|
log('executeFrom')
|
|
193
198
|
|
|
194
|
-
const
|
|
199
|
+
const D = resolve(directory)
|
|
195
200
|
|
|
196
201
|
try {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (path === await gitRevParse(path)) {
|
|
200
|
-
const ignore = await getIgnoreFromConfiguration(path)
|
|
202
|
+
if (D === await gitRevParse(D)) {
|
|
203
|
+
const ignore = await getIgnoreFromConfiguration(D)
|
|
201
204
|
if (!ignore) {
|
|
202
205
|
return (
|
|
203
|
-
await execute(
|
|
206
|
+
await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
|
|
204
207
|
)
|
|
205
208
|
}
|
|
206
209
|
}
|
|
@@ -212,16 +215,14 @@ async function executeFrom (directory, registry, force, message, author) {
|
|
|
212
215
|
async function executeOnly (directory, registry, force, message, author) {
|
|
213
216
|
log('executeOnly')
|
|
214
217
|
|
|
215
|
-
const
|
|
218
|
+
const D = resolve(directory)
|
|
216
219
|
|
|
217
220
|
try {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (path === await gitRevParse(path)) {
|
|
221
|
-
const ignore = await getIgnoreFromConfiguration(path)
|
|
221
|
+
if (D === await gitRevParse(D)) {
|
|
222
|
+
const ignore = await getIgnoreFromConfiguration(D)
|
|
222
223
|
if (!ignore) {
|
|
223
224
|
return (
|
|
224
|
-
await execute(
|
|
225
|
+
await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
|
|
225
226
|
)
|
|
226
227
|
}
|
|
227
228
|
}
|
|
@@ -233,16 +234,14 @@ async function executeOnly (directory, registry, force, message, author) {
|
|
|
233
234
|
async function executePath (directory, registry, force, message, author) {
|
|
234
235
|
log('executePath')
|
|
235
236
|
|
|
236
|
-
const
|
|
237
|
+
const D = resolve(directory)
|
|
237
238
|
|
|
238
239
|
try {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (path === await gitRevParse(path)) {
|
|
242
|
-
const ignore = await getIgnoreFromConfiguration(path)
|
|
240
|
+
if (D === await gitRevParse(D)) {
|
|
241
|
+
const ignore = await getIgnoreFromConfiguration(D)
|
|
243
242
|
if (!ignore) {
|
|
244
243
|
return (
|
|
245
|
-
await execute(
|
|
244
|
+
await execute(D, registry, force, message, author || await getAuthorFromConfiguration(D))
|
|
246
245
|
)
|
|
247
246
|
}
|
|
248
247
|
}
|
|
@@ -250,7 +249,7 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
250
249
|
handleCommandError(e)
|
|
251
250
|
}
|
|
252
251
|
|
|
253
|
-
const pathList = await getPathList(
|
|
252
|
+
const pathList = await getPathList(D)
|
|
254
253
|
|
|
255
254
|
if (pathList.length) {
|
|
256
255
|
const depsList = await getDepsList(pathList)
|
package/package.json
CHANGED
package/src/common/git/index.mjs
CHANGED
|
@@ -109,8 +109,6 @@ const getErrorMessage = ({ message = '' } = {}) => message
|
|
|
109
109
|
*
|
|
110
110
|
* Compatible with MacOS and Windows
|
|
111
111
|
*
|
|
112
|
-
* @param {String} directory - A directory configured for Git
|
|
113
|
-
*
|
|
114
112
|
* @return {String}
|
|
115
113
|
*/
|
|
116
114
|
function getCatGitRefsRemotesOriginHeadCommands () { /* eslint-disable no-useless-escape */
|
|
@@ -155,17 +153,16 @@ export function catGitRefsRemotesOriginHead (directory = DIRECTORY) {
|
|
|
155
153
|
|
|
156
154
|
return (
|
|
157
155
|
new Promise((resolve, reject) => {
|
|
158
|
-
// const log = use('cat-git-refs-remotes-origin-head')
|
|
159
156
|
const commands = getCatGitRefsRemotesOriginHeadCommands()
|
|
160
157
|
|
|
161
|
-
/**
|
|
162
|
-
* log(commands)
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
158
|
const {
|
|
166
159
|
stdout,
|
|
167
160
|
stderr
|
|
168
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v = '') =>
|
|
161
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v = '') => {
|
|
162
|
+
(!e)
|
|
163
|
+
? resolve(trim(v))
|
|
164
|
+
: reject(e)
|
|
165
|
+
})
|
|
169
166
|
|
|
170
167
|
stdout.on('data', out('cat-git-refs-remotes-origin-head', directory.trim()))
|
|
171
168
|
stderr.on('data', err('cat-git-refs-remotes-origin-head', directory.trim()))
|
|
@@ -187,17 +184,16 @@ export function gitRevParse (directory = DIRECTORY) {
|
|
|
187
184
|
|
|
188
185
|
return (
|
|
189
186
|
new Promise((resolve, reject) => {
|
|
190
|
-
// const log = out('git-rev-parse')
|
|
191
187
|
const commands = 'git rev-parse --show-toplevel'
|
|
192
188
|
|
|
193
|
-
/**
|
|
194
|
-
* log(commands)
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
189
|
const {
|
|
198
190
|
stdout,
|
|
199
191
|
stderr
|
|
200
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v = '') =>
|
|
192
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v = '') => {
|
|
193
|
+
(!e)
|
|
194
|
+
? resolve(trim(v))
|
|
195
|
+
: reject(e)
|
|
196
|
+
})
|
|
201
197
|
|
|
202
198
|
stdout.on('data', out('git-rev-parse', directory.trim()))
|
|
203
199
|
stderr.on('data', err('git-rev-parse', directory.trim()))
|
|
@@ -220,17 +216,20 @@ export function gitCheckout (directory = DIRECTORY, branch = BRANCH) {
|
|
|
220
216
|
|
|
221
217
|
return (
|
|
222
218
|
new Promise((resolve, reject) => {
|
|
223
|
-
const log = use('git-checkout')
|
|
224
219
|
const commands = `git checkout ${branch}`
|
|
225
220
|
|
|
226
|
-
/**
|
|
227
|
-
* log(commands)
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
221
|
const {
|
|
231
222
|
stdout,
|
|
232
223
|
stderr
|
|
233
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
224
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
225
|
+
(!e)
|
|
226
|
+
? resolve(v)
|
|
227
|
+
: isCommandError(e)
|
|
228
|
+
? resolve(v)
|
|
229
|
+
: reject(e)
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
const log = use('git-checkout')
|
|
234
233
|
|
|
235
234
|
stdout.on('data', log)
|
|
236
235
|
stderr.on('data', log)
|
|
@@ -252,17 +251,20 @@ export function gitPull (directory = DIRECTORY) {
|
|
|
252
251
|
|
|
253
252
|
return (
|
|
254
253
|
new Promise((resolve, reject) => {
|
|
255
|
-
const log = use('git-pull')
|
|
256
254
|
const commands = 'git pull'
|
|
257
255
|
|
|
258
|
-
/**
|
|
259
|
-
* log(commands)
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
256
|
const {
|
|
263
257
|
stdout,
|
|
264
258
|
stderr
|
|
265
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
259
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
260
|
+
(!e)
|
|
261
|
+
? resolve(v)
|
|
262
|
+
: isCommandError(e)
|
|
263
|
+
? resolve(v)
|
|
264
|
+
: reject(e)
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
const log = use('git-pull')
|
|
266
268
|
|
|
267
269
|
stdout.on('data', log)
|
|
268
270
|
stderr.on('data', log)
|
|
@@ -284,17 +286,20 @@ export function gitPush (directory = DIRECTORY) {
|
|
|
284
286
|
|
|
285
287
|
return (
|
|
286
288
|
new Promise((resolve, reject) => {
|
|
287
|
-
const log = use('git-push')
|
|
288
289
|
const commands = 'git push'
|
|
289
290
|
|
|
290
|
-
/**
|
|
291
|
-
* log(commands)
|
|
292
|
-
*/
|
|
293
|
-
|
|
294
291
|
const {
|
|
295
292
|
stdout,
|
|
296
293
|
stderr
|
|
297
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
294
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
295
|
+
(!e)
|
|
296
|
+
? resolve(v)
|
|
297
|
+
: isCommandError(e)
|
|
298
|
+
? resolve(v)
|
|
299
|
+
: reject(e)
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
const log = use('git-push')
|
|
298
303
|
|
|
299
304
|
stdout.on('data', log)
|
|
300
305
|
stderr.on('data', log)
|
|
@@ -316,17 +321,20 @@ export function gitPushTags (directory = DIRECTORY) {
|
|
|
316
321
|
|
|
317
322
|
return (
|
|
318
323
|
new Promise((resolve, reject) => {
|
|
319
|
-
const log = use('git-push-tags')
|
|
320
324
|
const commands = 'git push --tags'
|
|
321
325
|
|
|
322
|
-
/**
|
|
323
|
-
* log(commands)
|
|
324
|
-
*/
|
|
325
|
-
|
|
326
326
|
const {
|
|
327
327
|
stdout,
|
|
328
328
|
stderr
|
|
329
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
329
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
330
|
+
(!e)
|
|
331
|
+
? resolve(v)
|
|
332
|
+
: isCommandError(e)
|
|
333
|
+
? resolve(v)
|
|
334
|
+
: reject(e)
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
const log = use('git-push-tags')
|
|
330
338
|
|
|
331
339
|
stdout.on('data', log)
|
|
332
340
|
stderr.on('data', log)
|
|
@@ -349,17 +357,20 @@ export function gitAdd (directory = DIRECTORY, add = ADD) {
|
|
|
349
357
|
|
|
350
358
|
return (
|
|
351
359
|
new Promise((resolve, reject) => {
|
|
352
|
-
const log = use('git-add')
|
|
353
360
|
const commands = `git add ${add}`
|
|
354
361
|
|
|
355
|
-
/**
|
|
356
|
-
* log(commands)
|
|
357
|
-
*/
|
|
358
|
-
|
|
359
362
|
const {
|
|
360
363
|
stdout,
|
|
361
364
|
stderr
|
|
362
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
365
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
366
|
+
(!e)
|
|
367
|
+
? resolve(v)
|
|
368
|
+
: isCommandError(e)
|
|
369
|
+
? resolve(v)
|
|
370
|
+
: reject(e)
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
const log = use('git-add')
|
|
363
374
|
|
|
364
375
|
stdout.on('data', log)
|
|
365
376
|
stderr.on('data', log)
|
|
@@ -382,17 +393,20 @@ export function gitCommit (directory = DIRECTORY, message = MESSAGE, author = AU
|
|
|
382
393
|
|
|
383
394
|
return (
|
|
384
395
|
new Promise((resolve, reject) => {
|
|
385
|
-
const log = use('git-commit')
|
|
386
396
|
const commands = `git commit -m "${message}" --author "${author}"`
|
|
387
397
|
|
|
388
|
-
/**
|
|
389
|
-
* log(commands)
|
|
390
|
-
*/
|
|
391
|
-
|
|
392
398
|
const {
|
|
393
399
|
stdout,
|
|
394
400
|
stderr
|
|
395
|
-
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) =>
|
|
401
|
+
} = exec(commands, { ...OPTIONS, cwd: normalize(directory) }, (e, v) => {
|
|
402
|
+
(!e)
|
|
403
|
+
? resolve(v)
|
|
404
|
+
: isCommandError(e)
|
|
405
|
+
? resolve(v)
|
|
406
|
+
: reject(e)
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
const log = use('git-commit')
|
|
396
410
|
|
|
397
411
|
stdout.on('data', log)
|
|
398
412
|
stderr.on('data', log)
|
package/src/index.mjs
CHANGED
|
@@ -288,17 +288,19 @@ export function installSaveBundleSaveExact (d, p, r, f) {
|
|
|
288
288
|
|
|
289
289
|
return (
|
|
290
290
|
new Promise((resolve, reject) => {
|
|
291
|
-
const
|
|
292
|
-
const commands = getCommands(
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* log(commands)
|
|
296
|
-
*/
|
|
291
|
+
const D = normalize(d)
|
|
292
|
+
const commands = getCommands(D, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
297
293
|
|
|
298
294
|
const {
|
|
299
295
|
stdout,
|
|
300
296
|
stderr
|
|
301
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
297
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
298
|
+
(!e)
|
|
299
|
+
? resolve(v)
|
|
300
|
+
: reject(e)
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
const log = use('install-save-bundle-save-exact')
|
|
302
304
|
|
|
303
305
|
stdout.on('data', log)
|
|
304
306
|
stderr.on('data', log)
|
|
@@ -323,17 +325,19 @@ export function installSaveBundle (d, p, r, f) {
|
|
|
323
325
|
|
|
324
326
|
return (
|
|
325
327
|
new Promise((resolve, reject) => {
|
|
326
|
-
const
|
|
327
|
-
const commands = getCommands(
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* log(commands)
|
|
331
|
-
*/
|
|
328
|
+
const D = normalize(d)
|
|
329
|
+
const commands = getCommands(D, getInstallSaveBundleCommands(p, r, f))
|
|
332
330
|
|
|
333
331
|
const {
|
|
334
332
|
stdout,
|
|
335
333
|
stderr
|
|
336
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
334
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
335
|
+
(!e)
|
|
336
|
+
? resolve(v)
|
|
337
|
+
: reject(e)
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
const log = use('install-save-bundle')
|
|
337
341
|
|
|
338
342
|
stdout.on('data', log)
|
|
339
343
|
stderr.on('data', log)
|
|
@@ -358,17 +362,19 @@ export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
|
358
362
|
|
|
359
363
|
return (
|
|
360
364
|
new Promise((resolve, reject) => {
|
|
361
|
-
const
|
|
362
|
-
const commands = getCommands(
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* log(commands)
|
|
366
|
-
*/
|
|
365
|
+
const D = normalize(d)
|
|
366
|
+
const commands = getCommands(D, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
367
367
|
|
|
368
368
|
const {
|
|
369
369
|
stdout,
|
|
370
370
|
stderr
|
|
371
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
371
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
372
|
+
(!e)
|
|
373
|
+
? resolve(v)
|
|
374
|
+
: reject(e)
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
const log = use('install-save-otional-save-exact')
|
|
372
378
|
|
|
373
379
|
stdout.on('data', log)
|
|
374
380
|
stderr.on('data', log)
|
|
@@ -393,17 +399,19 @@ export function installSaveOptional (d, p, r, f) {
|
|
|
393
399
|
|
|
394
400
|
return (
|
|
395
401
|
new Promise((resolve, reject) => {
|
|
396
|
-
const
|
|
397
|
-
const commands = getCommands(
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* log(commands)
|
|
401
|
-
*/
|
|
402
|
+
const D = normalize(d)
|
|
403
|
+
const commands = getCommands(D, getInstallSaveOptionalCommands(p, r, f))
|
|
402
404
|
|
|
403
405
|
const {
|
|
404
406
|
stdout,
|
|
405
407
|
stderr
|
|
406
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
408
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
409
|
+
(!e)
|
|
410
|
+
? resolve(v)
|
|
411
|
+
: reject(e)
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
const log = use('install-save-otional')
|
|
407
415
|
|
|
408
416
|
stdout.on('data', log)
|
|
409
417
|
stderr.on('data', log)
|
|
@@ -428,17 +436,19 @@ export function installSaveDevSaveExact (d, p, r, f) {
|
|
|
428
436
|
|
|
429
437
|
return (
|
|
430
438
|
new Promise((resolve, reject) => {
|
|
431
|
-
const
|
|
432
|
-
const commands = getCommands(
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* log(commands)
|
|
436
|
-
*/
|
|
439
|
+
const D = normalize(d)
|
|
440
|
+
const commands = getCommands(D, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
437
441
|
|
|
438
442
|
const {
|
|
439
443
|
stdout,
|
|
440
444
|
stderr
|
|
441
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
445
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
446
|
+
(!e)
|
|
447
|
+
? resolve(v)
|
|
448
|
+
: reject(e)
|
|
449
|
+
})
|
|
450
|
+
|
|
451
|
+
const log = use('install-save-dev-save-exact')
|
|
442
452
|
|
|
443
453
|
stdout.on('data', log)
|
|
444
454
|
stderr.on('data', log)
|
|
@@ -463,17 +473,19 @@ export function installSaveDev (d, p, r, f) {
|
|
|
463
473
|
|
|
464
474
|
return (
|
|
465
475
|
new Promise((resolve, reject) => {
|
|
466
|
-
const
|
|
467
|
-
const commands = getCommands(
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* log(commands)
|
|
471
|
-
*/
|
|
476
|
+
const D = normalize(d)
|
|
477
|
+
const commands = getCommands(D, getInstallSaveDevCommands(p, r, f))
|
|
472
478
|
|
|
473
479
|
const {
|
|
474
480
|
stdout,
|
|
475
481
|
stderr
|
|
476
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
482
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
483
|
+
(!e)
|
|
484
|
+
? resolve(v)
|
|
485
|
+
: reject(e)
|
|
486
|
+
})
|
|
487
|
+
|
|
488
|
+
const log = use('install-save-dev')
|
|
477
489
|
|
|
478
490
|
stdout.on('data', log)
|
|
479
491
|
stderr.on('data', log)
|
|
@@ -498,17 +510,19 @@ export function installSaveProdSaveExact (d, p, r, f) {
|
|
|
498
510
|
|
|
499
511
|
return (
|
|
500
512
|
new Promise((resolve, reject) => {
|
|
501
|
-
const
|
|
502
|
-
const commands = getCommands(
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* log(commands)
|
|
506
|
-
*/
|
|
513
|
+
const D = normalize(d)
|
|
514
|
+
const commands = getCommands(D, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
507
515
|
|
|
508
516
|
const {
|
|
509
517
|
stdout,
|
|
510
518
|
stderr
|
|
511
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
519
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
520
|
+
(!e)
|
|
521
|
+
? resolve(v)
|
|
522
|
+
: reject(e)
|
|
523
|
+
})
|
|
524
|
+
|
|
525
|
+
const log = use('install-save-prod-save-exact')
|
|
512
526
|
|
|
513
527
|
stdout.on('data', log)
|
|
514
528
|
stderr.on('data', log)
|
|
@@ -533,17 +547,19 @@ export function installSaveProd (d, p, r, f) {
|
|
|
533
547
|
|
|
534
548
|
return (
|
|
535
549
|
new Promise((resolve, reject) => {
|
|
536
|
-
const
|
|
537
|
-
const commands = getCommands(
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* log(commands)
|
|
541
|
-
*/
|
|
550
|
+
const D = normalize(d)
|
|
551
|
+
const commands = getCommands(D, getInstallSaveProdCommands(p, r, f))
|
|
542
552
|
|
|
543
553
|
const {
|
|
544
554
|
stdout,
|
|
545
555
|
stderr
|
|
546
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
556
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => {
|
|
557
|
+
(!e)
|
|
558
|
+
? resolve(v)
|
|
559
|
+
: reject(e)
|
|
560
|
+
})
|
|
561
|
+
|
|
562
|
+
const log = use('install-save-prod')
|
|
547
563
|
|
|
548
564
|
stdout.on('data', log)
|
|
549
565
|
stderr.on('data', log)
|
package/src/install/index.mjs
CHANGED
|
@@ -110,12 +110,13 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
110
110
|
|
|
111
111
|
return (
|
|
112
112
|
new Promise((resolve, reject) => {
|
|
113
|
-
const
|
|
113
|
+
const D = normalize(d)
|
|
114
|
+
const commands = getCommands(D, getInstallSaveExactCommands(p, s, r, f))
|
|
114
115
|
|
|
115
116
|
const {
|
|
116
117
|
stdout,
|
|
117
118
|
stderr
|
|
118
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
119
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
119
120
|
|
|
120
121
|
stdout.on('data', log)
|
|
121
122
|
stderr.on('data', log)
|
|
@@ -141,12 +142,13 @@ export function install (d, p, s, r, f) {
|
|
|
141
142
|
|
|
142
143
|
return (
|
|
143
144
|
new Promise((resolve, reject) => {
|
|
144
|
-
const
|
|
145
|
+
const D = normalize(d)
|
|
146
|
+
const commands = getCommands(D, getInstallCommands(p, s, r, f))
|
|
145
147
|
|
|
146
148
|
const {
|
|
147
149
|
stdout,
|
|
148
150
|
stderr
|
|
149
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
151
|
+
} = exec(commands, { ...OPTIONS, cwd: D }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
150
152
|
|
|
151
153
|
stdout.on('data', log)
|
|
152
154
|
stderr.on('data', log)
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
lts/*
|