@modernpoacher/deps 1.6.16 → 1.6.19
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/app.js +9 -7
- package/bin/common/index.js +12 -12
- package/bin/deps.sh +5 -2
- package/bin/execute/app.js +24 -21
- package/bin/get-default-branch.sh +4 -0
- package/bin/head.sh +4 -0
- package/bin/install/app.js +8 -6
- package/bin/push.sh +4 -0
- package/bin/wipe.sh +4 -0
- package/lib/common/git/index.js +2 -2
- package/lib/common/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/install/index.js +1 -1
- package/package.json +10 -10
- package/src/common/git/index.js +7 -5
- package/src/common/index.js +0 -12
- package/src/index.js +48 -50
- package/src/install/index.js +11 -13
package/bin/app.js
CHANGED
|
@@ -66,7 +66,8 @@ async function app () {
|
|
|
66
66
|
.option('-B, --save-bundle [bundleDependencies]', 'Install `bundleDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
68
|
.option('--force [force]', 'Force installation`', false)
|
|
69
|
-
.option('--
|
|
69
|
+
.option('-m, --message [message]', 'Git commit message')
|
|
70
|
+
.option('-a, --author [author]', 'Git commit author')
|
|
70
71
|
.parse(argv)
|
|
71
72
|
|
|
72
73
|
/*
|
|
@@ -98,6 +99,7 @@ async function app () {
|
|
|
98
99
|
saveBundle: B,
|
|
99
100
|
force,
|
|
100
101
|
registry,
|
|
102
|
+
message,
|
|
101
103
|
author
|
|
102
104
|
} = commander.opts()
|
|
103
105
|
|
|
@@ -114,7 +116,7 @@ async function app () {
|
|
|
114
116
|
log('Prod')
|
|
115
117
|
|
|
116
118
|
try {
|
|
117
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, author)
|
|
119
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, message, author)
|
|
118
120
|
} catch (e) {
|
|
119
121
|
handleError(e)
|
|
120
122
|
}
|
|
@@ -122,7 +124,7 @@ async function app () {
|
|
|
122
124
|
log('Dev')
|
|
123
125
|
|
|
124
126
|
try {
|
|
125
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, author)
|
|
127
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, message, author)
|
|
126
128
|
} catch (e) {
|
|
127
129
|
handleError(e)
|
|
128
130
|
}
|
|
@@ -131,7 +133,7 @@ async function app () {
|
|
|
131
133
|
log('Prod')
|
|
132
134
|
|
|
133
135
|
try {
|
|
134
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, author)
|
|
136
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, message, author)
|
|
135
137
|
} catch (e) {
|
|
136
138
|
handleError(e)
|
|
137
139
|
}
|
|
@@ -140,7 +142,7 @@ async function app () {
|
|
|
140
142
|
log('Dev')
|
|
141
143
|
|
|
142
144
|
try {
|
|
143
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, author)
|
|
145
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, message, author)
|
|
144
146
|
} catch (e) {
|
|
145
147
|
handleError(e)
|
|
146
148
|
}
|
|
@@ -149,7 +151,7 @@ async function app () {
|
|
|
149
151
|
log('Optional')
|
|
150
152
|
|
|
151
153
|
try {
|
|
152
|
-
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force, author)
|
|
154
|
+
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force, message, author)
|
|
153
155
|
} catch (e) {
|
|
154
156
|
handleError(e)
|
|
155
157
|
}
|
|
@@ -158,7 +160,7 @@ async function app () {
|
|
|
158
160
|
log('Bundle')
|
|
159
161
|
|
|
160
162
|
try {
|
|
161
|
-
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force, author)
|
|
163
|
+
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force, message, author)
|
|
162
164
|
} catch (e) {
|
|
163
165
|
handleError(e)
|
|
164
166
|
}
|
package/bin/common/index.js
CHANGED
|
@@ -39,8 +39,7 @@ const {
|
|
|
39
39
|
NVM,
|
|
40
40
|
|
|
41
41
|
getRegistryParameter,
|
|
42
|
-
getForceParameter
|
|
43
|
-
getAuthorParameter
|
|
42
|
+
getForceParameter
|
|
44
43
|
} = require('@modernpoacher/deps/common')
|
|
45
44
|
|
|
46
45
|
const log = debug('@modernpoacher/deps')
|
|
@@ -79,19 +78,19 @@ rm -rf node_modules package-lock.json
|
|
|
79
78
|
`)
|
|
80
79
|
|
|
81
80
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
82
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
83
|
-
: (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
81
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
|
|
82
|
+
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
84
83
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
85
84
|
. "${NVM}" 2> /dev/null
|
|
86
|
-
${getRegistryParameter(registry, getForceParameter(force,
|
|
85
|
+
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
87
86
|
`)
|
|
88
87
|
|
|
89
88
|
const getDepsCommands = PLATFORM === 'win32'
|
|
90
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
91
|
-
: (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
89
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
|
|
90
|
+
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
92
91
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
93
92
|
. "${NVM}" 2> /dev/null
|
|
94
|
-
${getRegistryParameter(registry, getForceParameter(force,
|
|
93
|
+
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
95
94
|
`)
|
|
96
95
|
|
|
97
96
|
function use (key) {
|
|
@@ -261,13 +260,13 @@ function rmrf (directory = DIRECTORY) {
|
|
|
261
260
|
)
|
|
262
261
|
}
|
|
263
262
|
|
|
264
|
-
function npmi (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
263
|
+
function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
265
264
|
log('npmi')
|
|
266
265
|
|
|
267
266
|
return (
|
|
268
267
|
new Promise((resolve, reject) => {
|
|
269
268
|
const log = use('npmi')
|
|
270
|
-
const commands = getNpmiCommands(directory, registry, force
|
|
269
|
+
const commands = getNpmiCommands(directory, registry, force)
|
|
271
270
|
|
|
272
271
|
/**
|
|
273
272
|
* log(commands)
|
|
@@ -284,13 +283,13 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false, author
|
|
|
284
283
|
)
|
|
285
284
|
}
|
|
286
285
|
|
|
287
|
-
function deps (directory = DIRECTORY, registry = REGISTRY, force = false
|
|
286
|
+
function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
288
287
|
log('deps')
|
|
289
288
|
|
|
290
289
|
return (
|
|
291
290
|
new Promise((resolve, reject) => {
|
|
292
291
|
const log = use('deps')
|
|
293
|
-
const commands = getDepsCommands(directory, registry, force
|
|
292
|
+
const commands = getDepsCommands(directory, registry, force)
|
|
294
293
|
|
|
295
294
|
/**
|
|
296
295
|
* log(commands)
|
|
@@ -310,6 +309,7 @@ function deps (directory = DIRECTORY, registry = REGISTRY, force = false, author
|
|
|
310
309
|
module.exports = {
|
|
311
310
|
DIRECTORY,
|
|
312
311
|
REGISTRY,
|
|
312
|
+
AUTHOR,
|
|
313
313
|
NVM,
|
|
314
314
|
handleError,
|
|
315
315
|
handlePackageError,
|
package/bin/deps.sh
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
#
|
|
3
3
|
# https://google.github.io/styleguide/shellguide.html#s7-naming-conventions
|
|
4
4
|
|
|
5
|
+
export PATH=/usr/local/bin:$PATH
|
|
6
|
+
|
|
7
|
+
eval \`ssh-agent\`
|
|
8
|
+
|
|
5
9
|
EXP="[-0-9a-zA-Z]*$"
|
|
6
10
|
|
|
7
11
|
function update {
|
|
8
12
|
git checkout $default_branch
|
|
9
|
-
|
|
10
13
|
git pull
|
|
11
14
|
|
|
12
15
|
rm -rf node_modules package-lock.json
|
|
@@ -15,8 +18,8 @@ function update {
|
|
|
15
18
|
|
|
16
19
|
git add package.json package-lock.json
|
|
17
20
|
git commit -m "Updated \`package.json\` &/ \`package-lock.json\`"
|
|
18
|
-
|
|
19
21
|
git push
|
|
22
|
+
git push --tags
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
function can_update {
|
package/bin/execute/app.js
CHANGED
|
@@ -21,6 +21,8 @@ const {
|
|
|
21
21
|
} = require('@modernpoacher/deps/common/env')
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
|
+
MESSAGE,
|
|
25
|
+
AUTHOR,
|
|
24
26
|
catGitRefsRemotesOriginHead,
|
|
25
27
|
gitRevParse,
|
|
26
28
|
gitCheckout,
|
|
@@ -32,8 +34,7 @@ const {
|
|
|
32
34
|
} = require('@modernpoacher/deps/common/git')
|
|
33
35
|
|
|
34
36
|
const {
|
|
35
|
-
REGISTRY
|
|
36
|
-
AUTHOR
|
|
37
|
+
REGISTRY
|
|
37
38
|
} = require('@modernpoacher/deps/common')
|
|
38
39
|
|
|
39
40
|
const {
|
|
@@ -117,27 +118,27 @@ async function mapRevParse (directory) {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false, author = AUTHOR) {
|
|
121
|
+
async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
121
122
|
log('iterate')
|
|
122
123
|
|
|
123
|
-
if (directory) await execute(directory, registry, force, author)
|
|
124
|
+
if (directory) await execute(directory, registry, force, message, author)
|
|
124
125
|
|
|
125
|
-
if (directories.length) await iterate(directories, registry, force, author)
|
|
126
|
+
if (directories.length) await iterate(directories, registry, force, message, author)
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
129
|
+
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
129
130
|
log('execute')
|
|
130
131
|
|
|
131
132
|
try {
|
|
132
|
-
log({ directory, registry })
|
|
133
|
+
log({ directory, registry, force, message, author })
|
|
133
134
|
|
|
134
135
|
await gitCheckout(directory, await catGitRefsRemotesOriginHead(directory))
|
|
135
136
|
await gitPull(directory)
|
|
136
137
|
await rmrf(directory)
|
|
137
|
-
await npmi(directory, registry, force
|
|
138
|
-
await deps(directory, registry, force
|
|
138
|
+
await npmi(directory, registry, force)
|
|
139
|
+
await deps(directory, registry, force)
|
|
139
140
|
await gitAdd(directory)
|
|
140
|
-
await gitCommit(directory)
|
|
141
|
+
await gitCommit(directory, message, author)
|
|
141
142
|
await gitPush(directory)
|
|
142
143
|
await gitPushTags(directory)
|
|
143
144
|
} catch (e) {
|
|
@@ -145,7 +146,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
149
|
+
async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
149
150
|
log('executeFrom')
|
|
150
151
|
|
|
151
152
|
const path = resolve(directory)
|
|
@@ -153,7 +154,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
153
154
|
try {
|
|
154
155
|
if (path === await gitRevParse(path)) {
|
|
155
156
|
return (
|
|
156
|
-
await execute(path, registry, force, author)
|
|
157
|
+
await execute(path, registry, force, message, author)
|
|
157
158
|
)
|
|
158
159
|
}
|
|
159
160
|
} catch (e) {
|
|
@@ -161,7 +162,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
165
|
+
async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
165
166
|
log('executeOnly')
|
|
166
167
|
|
|
167
168
|
const path = resolve(directory)
|
|
@@ -169,7 +170,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
169
170
|
try {
|
|
170
171
|
if (path === await gitRevParse(path)) {
|
|
171
172
|
return (
|
|
172
|
-
await execute(path, registry, force, author)
|
|
173
|
+
await execute(path, registry, force, message, author)
|
|
173
174
|
)
|
|
174
175
|
}
|
|
175
176
|
} catch (e) {
|
|
@@ -177,7 +178,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
181
|
+
async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
181
182
|
log('executePath')
|
|
182
183
|
|
|
183
184
|
const path = resolve(directory)
|
|
@@ -185,7 +186,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
185
186
|
try {
|
|
186
187
|
if (path === await gitRevParse(path)) {
|
|
187
188
|
return (
|
|
188
|
-
await execute(path, registry, force, author)
|
|
189
|
+
await execute(path, registry, force, message, author)
|
|
189
190
|
)
|
|
190
191
|
}
|
|
191
192
|
} catch (e) {
|
|
@@ -199,7 +200,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
199
200
|
|
|
200
201
|
if (depsList.length) {
|
|
201
202
|
return (
|
|
202
|
-
await iterate(depsList, registry, force, author)
|
|
203
|
+
await iterate(depsList, registry, force, message, author)
|
|
203
204
|
)
|
|
204
205
|
}
|
|
205
206
|
}
|
|
@@ -222,7 +223,8 @@ async function app () {
|
|
|
222
223
|
.option('-o, --only [only]', 'Update only directory')
|
|
223
224
|
.option('--registry [registry]', 'Installation registry')
|
|
224
225
|
.option('--force [force]', 'Force installation`', false)
|
|
225
|
-
.option('--
|
|
226
|
+
.option('-m, --message [author]', 'Git commit message')
|
|
227
|
+
.option('-a, --author [author]', 'Git commit author')
|
|
226
228
|
.parse(argv)
|
|
227
229
|
|
|
228
230
|
const {
|
|
@@ -231,6 +233,7 @@ async function app () {
|
|
|
231
233
|
only: O,
|
|
232
234
|
registry,
|
|
233
235
|
force,
|
|
236
|
+
message,
|
|
234
237
|
author
|
|
235
238
|
} = commander.opts()
|
|
236
239
|
|
|
@@ -246,7 +249,7 @@ async function app () {
|
|
|
246
249
|
log('Path')
|
|
247
250
|
|
|
248
251
|
try {
|
|
249
|
-
await executePath(P, registry, force, author)
|
|
252
|
+
await executePath(P, registry, force, message, author)
|
|
250
253
|
} catch (e) {
|
|
251
254
|
handleError(e)
|
|
252
255
|
}
|
|
@@ -255,7 +258,7 @@ async function app () {
|
|
|
255
258
|
log('From')
|
|
256
259
|
|
|
257
260
|
try {
|
|
258
|
-
await executeFrom(P, registry, force, author)
|
|
261
|
+
await executeFrom(P, registry, force, message, author)
|
|
259
262
|
} catch (e) {
|
|
260
263
|
handleError(e)
|
|
261
264
|
}
|
|
@@ -264,7 +267,7 @@ async function app () {
|
|
|
264
267
|
log('Only')
|
|
265
268
|
|
|
266
269
|
try {
|
|
267
|
-
await executeOnly(P, registry, force, author)
|
|
270
|
+
await executeOnly(P, registry, force, message, author)
|
|
268
271
|
} catch (e) {
|
|
269
272
|
handleError(e)
|
|
270
273
|
}
|
package/bin/head.sh
CHANGED
package/bin/install/app.js
CHANGED
|
@@ -66,7 +66,8 @@ async function app () {
|
|
|
66
66
|
.option('-s, --save [save]', 'Install `peerDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
68
|
.option('--force [force]', 'Force installation`', false)
|
|
69
|
-
.option('--
|
|
69
|
+
.option('-m, --message [message]', 'Git commit message')
|
|
70
|
+
.option('-a, --author [author]', 'Git commit author')
|
|
70
71
|
.parse(argv)
|
|
71
72
|
|
|
72
73
|
/*
|
|
@@ -100,6 +101,7 @@ async function app () {
|
|
|
100
101
|
save,
|
|
101
102
|
registry,
|
|
102
103
|
force,
|
|
104
|
+
message,
|
|
103
105
|
author
|
|
104
106
|
} = commander.opts()
|
|
105
107
|
|
|
@@ -118,7 +120,7 @@ async function app () {
|
|
|
118
120
|
log('Prod')
|
|
119
121
|
|
|
120
122
|
try {
|
|
121
|
-
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force, author)
|
|
123
|
+
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force, message, author)
|
|
122
124
|
} catch (e) {
|
|
123
125
|
handleError(e)
|
|
124
126
|
}
|
|
@@ -127,7 +129,7 @@ async function app () {
|
|
|
127
129
|
log('Dev')
|
|
128
130
|
|
|
129
131
|
try {
|
|
130
|
-
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force, author)
|
|
132
|
+
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force, message, author)
|
|
131
133
|
} catch (e) {
|
|
132
134
|
handleError(e)
|
|
133
135
|
}
|
|
@@ -136,7 +138,7 @@ async function app () {
|
|
|
136
138
|
log('Optional')
|
|
137
139
|
|
|
138
140
|
try {
|
|
139
|
-
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force, author)
|
|
141
|
+
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force, message, author)
|
|
140
142
|
} catch (e) {
|
|
141
143
|
handleError(e)
|
|
142
144
|
}
|
|
@@ -145,7 +147,7 @@ async function app () {
|
|
|
145
147
|
log('Bundle')
|
|
146
148
|
|
|
147
149
|
try {
|
|
148
|
-
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force, author)
|
|
150
|
+
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force, message, author)
|
|
149
151
|
} catch (e) {
|
|
150
152
|
handleError(e)
|
|
151
153
|
}
|
|
@@ -154,7 +156,7 @@ async function app () {
|
|
|
154
156
|
log('Peer')
|
|
155
157
|
|
|
156
158
|
try {
|
|
157
|
-
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force, author)
|
|
159
|
+
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force, message, author)
|
|
158
160
|
} catch (e) {
|
|
159
161
|
handleError(e)
|
|
160
162
|
}
|
package/bin/push.sh
CHANGED
package/bin/wipe.sh
CHANGED
package/lib/common/git/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.gitAdd=gitAdd;exports.gitCheckout=gitCheckout;exports.gitCommit=gitCommit;exports.gitPull=gitPull;exports.gitPush=gitPush;exports.gitPushTags=gitPushTags;exports.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("../env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';const BRANCH='master';const ADD='package.json package-lock.json';const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MESSAGE=exports.DIRECTORY=exports.AUTHOR=void 0;exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.gitAdd=gitAdd;exports.gitCheckout=gitCheckout;exports.gitCommit=gitCommit;exports.gitPull=gitPull;exports.gitPush=gitPush;exports.gitPushTags=gitPushTags;exports.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("../env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';exports.DIRECTORY=DIRECTORY;const BRANCH='master';const ADD='package.json package-lock.json';const MESSAGE=_env.PLATFORM==='win32'?'Updated `package.json` &/ `package-lock.json`':'Updated \\`package.json\\` &/ \\`package-lock.json\\`';exports.MESSAGE=MESSAGE;const AUTHOR='Modern Poacher Limited <modernpoacher@modernpoacher.com>';exports.AUTHOR=AUTHOR;const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const log=(0,_debug.default)('@modernpoacher/deps');log(`\`git\` (${_env.PLATFORM}) is awake`);const trim=v=>v.split('\n').map(v=>v.trimEnd()).join('\n').trim();function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){if(v.trim()==='')return;return log(trim(v));};}function out(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function out(v){const s=v.trim();if(s===''||directory===s)return;return log(trim(s));};}function err(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function err(v){const s=v.trim();if(s===''||directory===s||s.toLowerCase().startsWith('fatal: not a git repository'))return;return log(trim(s));};}const getErrorCode=({code=0}={})=>code;const getErrorMessage=({message=''}={})=>message;function getCatGitRefsRemotesOriginHeadCommands(){log('getCatGitRefsRemotesOriginHeadCommands');return`
|
|
2
2
|
DIR=$(echo "./.git/refs/remotes/origin/HEAD'" | sed -e "s/\\//\\\\\\/g" -e "s/://" | cat 2> /dev/null)
|
|
3
3
|
[[ $DIR =~ "[-0-9a-zA-Z]*$" ]]
|
|
4
4
|
echo "$\{BASH_REMATCH[0]}"
|
|
5
|
-
`;}function isCommandError(e){log('isCommandError');return getErrorCode(e)===1&&getErrorMessage(e).toLowerCase().startsWith('command failed:');}function catGitRefsRemotesOriginHead(directory=DIRECTORY){log('catGitRefsRemotesOriginHead');return new Promise((resolve,reject)=>{const commands=getCatGitRefsRemotesOriginHeadCommands();const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('cat-git-refs-remotes-origin-head',directory.trim()));stderr.on('data',err('cat-git-refs-remotes-origin-head',directory.trim()));});}function gitRevParse(directory=DIRECTORY){log('gitRevParse');return new Promise((resolve,reject)=>{const commands='git rev-parse --show-toplevel';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('git-rev-parse',directory.trim()));stderr.on('data',err('git-rev-parse',directory.trim()));});}function gitCheckout(directory=DIRECTORY,branch=BRANCH){log('gitCheckout');return new Promise((resolve,reject)=>{const log=use('git-checkout');const commands=`git checkout ${branch}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPull(directory=DIRECTORY){log('gitPull');return new Promise((resolve,reject)=>{const log=use('git-pull');const commands='git pull';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPush(directory=DIRECTORY){log('gitPush');return new Promise((resolve,reject)=>{const log=use('git-push');const commands='git push';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPushTags(directory=DIRECTORY){log('gitPushTags');return new Promise((resolve,reject)=>{const log=use('git-push-tags');const commands='git push --tags';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitAdd(directory=DIRECTORY,add=ADD){log('gitAdd');return new Promise((resolve,reject)=>{const log=use('git-add');const commands=`git add ${add}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitCommit(directory=DIRECTORY,
|
|
5
|
+
`;}function isCommandError(e){log('isCommandError');return getErrorCode(e)===1&&getErrorMessage(e).toLowerCase().startsWith('command failed:');}function catGitRefsRemotesOriginHead(directory=DIRECTORY){log('catGitRefsRemotesOriginHead');return new Promise((resolve,reject)=>{const commands=getCatGitRefsRemotesOriginHeadCommands();const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('cat-git-refs-remotes-origin-head',directory.trim()));stderr.on('data',err('cat-git-refs-remotes-origin-head',directory.trim()));});}function gitRevParse(directory=DIRECTORY){log('gitRevParse');return new Promise((resolve,reject)=>{const commands='git rev-parse --show-toplevel';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v='')=>!e?resolve(trim(v)):reject(e));stdout.on('data',out('git-rev-parse',directory.trim()));stderr.on('data',err('git-rev-parse',directory.trim()));});}function gitCheckout(directory=DIRECTORY,branch=BRANCH){log('gitCheckout');return new Promise((resolve,reject)=>{const log=use('git-checkout');const commands=`git checkout ${branch}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPull(directory=DIRECTORY){log('gitPull');return new Promise((resolve,reject)=>{const log=use('git-pull');const commands='git pull';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPush(directory=DIRECTORY){log('gitPush');return new Promise((resolve,reject)=>{const log=use('git-push');const commands='git push';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitPushTags(directory=DIRECTORY){log('gitPushTags');return new Promise((resolve,reject)=>{const log=use('git-push-tags');const commands='git push --tags';const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitAdd(directory=DIRECTORY,add=ADD){log('gitAdd');return new Promise((resolve,reject)=>{const log=use('git-add');const commands=`git add ${add}`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}function gitCommit(directory=DIRECTORY,message=MESSAGE,author=AUTHOR){log('gitCommit');return new Promise((resolve,reject)=>{const log=use('git-commit');const commands=`git commit -m "${message}" --author "${author}"`;const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(directory)},(e,v)=>e?isCommandError(e)?resolve(v):reject(e):resolve(v));stdout.on('data',log);stderr.on('data',log);});}
|
package/lib/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.REGISTRY=exports.NVM=exports.DIRECTORY=exports.AUTHOR=void 0;exports.getDeps=getDeps;exports.getDepsExact=getDepsExact;exports.isPreRelease=exports.isExact=exports.getSaveProdParameter=exports.getSaveOptionalParameter=exports.getSaveExactParameter=exports.getSaveDevParameter=exports.getSaveBundleParameter=exports.getRegistryParameter=exports.getProdDependencies=exports.getPeerDependencies=exports.getOptionalDependencies=exports.getNoSaveParameter=exports.getForceParameter=exports.getDevDependencies=void 0;exports.normalizeCommands=normalizeCommands;exports.transform=transform;exports.transformDependency=void 0;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _env=require("./env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const{path:MODULE_PATH}=module;const DIRECTORY='.';exports.DIRECTORY=DIRECTORY;const REGISTRY='https://registry.npmjs.org';exports.REGISTRY=REGISTRY;const AUTHOR='Modern Poacher Limited <modernpoacher@modernpoacher.com>';exports.AUTHOR=AUTHOR;const NVM=(0,_path.resolve)(MODULE_PATH,'../../nvm.sh');exports.NVM=NVM;const log=(0,_debug.default)('@modernpoacher/deps');log(`\`common\` (${_env.PLATFORM}) is awake`);const tidy=v=>v.replace(/\n\n/gm,String.fromCharCode(10)).trim();const getSaveProdParameter=commands=>commands.concat(' --save-prod');exports.getSaveProdParameter=getSaveProdParameter;const getSaveDevParameter=commands=>commands.concat(' --save-dev');exports.getSaveDevParameter=getSaveDevParameter;const getSaveBundleParameter=commands=>commands.concat(' --save-bundle');exports.getSaveBundleParameter=getSaveBundleParameter;const getSaveOptionalParameter=commands=>commands.concat(' --save-optional');exports.getSaveOptionalParameter=getSaveOptionalParameter;const getRegistryParameter=(r,commands)=>r?commands.concat(` --registry ${r}`):commands;exports.getRegistryParameter=getRegistryParameter;const getForceParameter=(f,commands)=>f?commands.concat(' --force'):commands;exports.getForceParameter=getForceParameter;const getNoSaveParameter=(s,commands)=>s?commands:commands.concat(' --no-save');exports.getNoSaveParameter=getNoSaveParameter;const getSaveExactParameter=commands=>commands.concat(' --save-exact');exports.getSaveExactParameter=getSaveExactParameter;const getCommands=_env.PLATFORM==='win32'?(directory=DIRECTORY,commands='npm i')=>tidy(commands):(directory=DIRECTORY,commands='npm i')=>tidy(`
|
|
2
2
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
3
3
|
. "${NVM}" 2> /dev/null
|
|
4
4
|
${commands}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.executeBundle=executeBundle;exports.executeDev=executeDev;exports.executeOptional=executeOptional;exports.executeProd=executeProd;exports.getInstallCommands=void 0;exports.getInstallSaveBundleCommands=getInstallSaveBundleCommands;exports.getInstallSaveBundleSaveExactCommands=getInstallSaveBundleSaveExactCommands;exports.getInstallSaveDevCommands=getInstallSaveDevCommands;exports.getInstallSaveDevSaveExactCommands=getInstallSaveDevSaveExactCommands;exports.getInstallSaveExactCommands=void 0;exports.getInstallSaveOptionalCommands=getInstallSaveOptionalCommands;exports.getInstallSaveOptionalSaveExactCommands=getInstallSaveOptionalSaveExactCommands;exports.getInstallSaveProdCommands=getInstallSaveProdCommands;exports.getInstallSaveProdSaveExactCommands=getInstallSaveProdSaveExactCommands;exports.installSaveBundle=installSaveBundle;exports.installSaveBundleSaveExact=installSaveBundleSaveExact;exports.installSaveDev=installSaveDev;exports.installSaveDevSaveExact=installSaveDevSaveExact;exports.installSaveOptional=installSaveOptional;exports.installSaveOptionalSaveExact=installSaveOptionalSaveExact;exports.installSaveProd=installSaveProd;exports.installSaveProdSaveExact=installSaveProdSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("./common/env");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_env.PLATFORM}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){const s=v.trim();if(s==='')return;return log(s);};}const getInstallSaveExactCommands=(p,r,f
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.executeBundle=executeBundle;exports.executeDev=executeDev;exports.executeOptional=executeOptional;exports.executeProd=executeProd;exports.getInstallCommands=void 0;exports.getInstallSaveBundleCommands=getInstallSaveBundleCommands;exports.getInstallSaveBundleSaveExactCommands=getInstallSaveBundleSaveExactCommands;exports.getInstallSaveDevCommands=getInstallSaveDevCommands;exports.getInstallSaveDevSaveExactCommands=getInstallSaveDevSaveExactCommands;exports.getInstallSaveExactCommands=void 0;exports.getInstallSaveOptionalCommands=getInstallSaveOptionalCommands;exports.getInstallSaveOptionalSaveExactCommands=getInstallSaveOptionalSaveExactCommands;exports.getInstallSaveProdCommands=getInstallSaveProdCommands;exports.getInstallSaveProdSaveExactCommands=getInstallSaveProdSaveExactCommands;exports.installSaveBundle=installSaveBundle;exports.installSaveBundleSaveExact=installSaveBundleSaveExact;exports.installSaveDev=installSaveDev;exports.installSaveDevSaveExact=installSaveDevSaveExact;exports.installSaveOptional=installSaveOptional;exports.installSaveOptionalSaveExact=installSaveOptionalSaveExact;exports.installSaveProd=installSaveProd;exports.installSaveProdSaveExact=installSaveProdSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("./common/env");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_env.PLATFORM}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){const s=v.trim();if(s==='')return;return log(s);};}const getInstallSaveExactCommands=(p,r,f)=>{log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,r,f)=>{log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands)));};exports.getInstallCommands=getInstallCommands;function getInstallSaveBundleSaveExactCommands(p,r,f){log('getInstallSaveBundleSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,r,f){log('installSaveBundleSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-bundle-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveBundleSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveBundle(d,p,r,f){log('installSaveBundle');return new Promise((resolve,reject)=>{const log=use('install-save-bundle');const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptionalSaveExact(d,p,r,f){log('installSaveOptionalSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-otional-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptional(d,p,r,f){log('installSaveOptional');return new Promise((resolve,reject)=>{const log=use('install-save-otional');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDevSaveExact(d,p,r,f){log('installSaveDevSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-dev-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveDevSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDev(d,p,r,f){log('installSaveDev');return new Promise((resolve,reject)=>{const log=use('install-save-dev');const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProdSaveExact(d,p,r,f){log('installSaveProdSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-prod-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveProdSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProd(d,p,r,f){log('installSaveProd');return new Promise((resolve,reject)=>{const log=use('install-save-prod');const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveBundleSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveBundle(directory,deps,registry,force);}async function executeOptional(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeOptional');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveOptionalSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry,force);}async function executeDev(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeDev');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveDevSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveDev(directory,deps,registry,force);}async function executeProd(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeProd');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveProdSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveProd(directory,deps,registry,force);}
|
package/lib/install/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.execute=execute;exports.getInstallSaveExactCommands=exports.getInstallCommands=void 0;exports.install=install;exports.installSaveExact=installSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _os=require("os");var _child_process=require("child_process");var _env=require("../common/env");var _common=require("../common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps:install');log(`\`install\` (${_os.platform}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const getInstallSaveExactCommands=(p,s,r,f
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.execute=execute;exports.getInstallSaveExactCommands=exports.getInstallCommands=void 0;exports.install=install;exports.installSaveExact=installSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _os=require("os");var _child_process=require("child_process");var _env=require("../common/env");var _common=require("../common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps:install');log(`\`install\` (${_os.platform}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const getInstallSaveExactCommands=(p,s,r,f)=>{log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands)))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,s,r,f)=>{log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands))));};exports.getInstallCommands=getInstallCommands;function installSaveExact(d,p,s,r,f){log('installSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveExactCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function install(d,p,s,r,f){log('install');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function execute(directory=_common.DIRECTORY,packages={},configuration={},save=false,registry=_common.REGISTRY,force=false){log('execute');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveExact(directory,depsExact,save,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await install(directory,deps,save,registry,force);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.19",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -57,23 +57,23 @@
|
|
|
57
57
|
"supports-color": "8.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.17.
|
|
61
|
-
"@babel/core": "^7.17.
|
|
60
|
+
"@babel/cli": "^7.17.10",
|
|
61
|
+
"@babel/core": "^7.17.10",
|
|
62
62
|
"@babel/eslint-parser": "^7.17.0",
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
63
|
+
"@babel/preset-env": "^7.17.10",
|
|
64
64
|
"@babel/register": "^7.17.7",
|
|
65
65
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
66
66
|
"chai": "^4.3.6",
|
|
67
|
-
"core-js": "^3.22.
|
|
67
|
+
"core-js": "^3.22.5",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
|
-
"eslint": "
|
|
70
|
-
"eslint-config-standard": "^
|
|
69
|
+
"eslint": "^8.15.0",
|
|
70
|
+
"eslint-config-standard": "^17.0.0",
|
|
71
71
|
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
72
72
|
"eslint-plugin-import": "^2.26.0",
|
|
73
73
|
"eslint-plugin-node": "^11.1.0",
|
|
74
|
-
"eslint-plugin-promise": "
|
|
75
|
-
"husky": "^
|
|
76
|
-
"mocha": "^
|
|
74
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
75
|
+
"husky": "^8.0.1",
|
|
76
|
+
"mocha": "^10.0.0",
|
|
77
77
|
"rimraf": "^3.0.2"
|
|
78
78
|
},
|
|
79
79
|
"_moduleAliases": {
|
package/src/common/git/index.js
CHANGED
|
@@ -12,16 +12,18 @@ import {
|
|
|
12
12
|
PLATFORM
|
|
13
13
|
} from '@modernpoacher/deps/common/env'
|
|
14
14
|
|
|
15
|
-
const DIRECTORY = '.'
|
|
15
|
+
export const DIRECTORY = '.'
|
|
16
16
|
|
|
17
17
|
const BRANCH = 'master'
|
|
18
18
|
|
|
19
19
|
const ADD = 'package.json package-lock.json'
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
export const MESSAGE = PLATFORM === 'win32'
|
|
22
22
|
? 'Updated `package.json` &/ `package-lock.json`'
|
|
23
23
|
: 'Updated \\`package.json\\` &/ \\`package-lock.json\\`' /* eslint-disable-line no-useless-escape */
|
|
24
24
|
|
|
25
|
+
export const AUTHOR = 'Modern Poacher Limited <modernpoacher@modernpoacher.com>'
|
|
26
|
+
|
|
25
27
|
const OPTIONS = {
|
|
26
28
|
maxBuffer: 1024 * 2000,
|
|
27
29
|
shell: true,
|
|
@@ -371,17 +373,17 @@ export function gitAdd (directory = DIRECTORY, add = ADD) {
|
|
|
371
373
|
* Commit changes to Git with a default value if none is supplied
|
|
372
374
|
*
|
|
373
375
|
* @param {String} directory - A directory configured for Git
|
|
374
|
-
* @param {String}
|
|
376
|
+
* @param {String} message - A commit message
|
|
375
377
|
*
|
|
376
378
|
* @return {Promise}
|
|
377
379
|
*/
|
|
378
|
-
export function gitCommit (directory = DIRECTORY,
|
|
380
|
+
export function gitCommit (directory = DIRECTORY, message = MESSAGE, author = AUTHOR) {
|
|
379
381
|
log('gitCommit')
|
|
380
382
|
|
|
381
383
|
return (
|
|
382
384
|
new Promise((resolve, reject) => {
|
|
383
385
|
const log = use('git-commit')
|
|
384
|
-
const commands = `git commit -m "${
|
|
386
|
+
const commands = `git commit -m "${message}" --author "${author}"`
|
|
385
387
|
|
|
386
388
|
/**
|
|
387
389
|
* log(commands)
|
package/src/common/index.js
CHANGED
|
@@ -94,18 +94,6 @@ export const getRegistryParameter = (r, commands) => r ? commands.concat(` --reg
|
|
|
94
94
|
*/
|
|
95
95
|
export const getForceParameter = (f, commands) => f ? commands.concat(' --force') : commands
|
|
96
96
|
|
|
97
|
-
/**
|
|
98
|
-
* @function getAuthorParameter
|
|
99
|
-
*
|
|
100
|
-
* Get the "author" parameter and argument
|
|
101
|
-
*
|
|
102
|
-
* @param {String} author
|
|
103
|
-
* @param {String} current commands string
|
|
104
|
-
*
|
|
105
|
-
* @return {String}
|
|
106
|
-
*/
|
|
107
|
-
export const getAuthorParameter = (a, commands) => a ? commands.concat(` --author ${a}`) : commands
|
|
108
|
-
|
|
109
97
|
/**
|
|
110
98
|
* @function getNoSaveParameter
|
|
111
99
|
*
|
package/src/index.js
CHANGED
|
@@ -15,10 +15,8 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
DIRECTORY,
|
|
17
17
|
REGISTRY,
|
|
18
|
-
AUTHOR,
|
|
19
18
|
getRegistryParameter,
|
|
20
19
|
getForceParameter,
|
|
21
|
-
getAuthorParameter,
|
|
22
20
|
getSaveExactParameter,
|
|
23
21
|
getSaveBundleParameter,
|
|
24
22
|
getSaveOptionalParameter,
|
|
@@ -72,14 +70,14 @@ function use (key) {
|
|
|
72
70
|
*
|
|
73
71
|
* @return {Array}
|
|
74
72
|
*/
|
|
75
|
-
export const getInstallSaveExactCommands = (p, r, f
|
|
73
|
+
export const getInstallSaveExactCommands = (p, r, f) => {
|
|
76
74
|
log('getInstallSaveExactCommands')
|
|
77
75
|
|
|
78
76
|
const c = transform(p)
|
|
79
77
|
const commands = `npm i ${c}`
|
|
80
78
|
|
|
81
79
|
return normalizeCommands(
|
|
82
|
-
getRegistryParameter(r, getForceParameter(f,
|
|
80
|
+
getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands)))
|
|
83
81
|
)
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -94,14 +92,14 @@ export const getInstallSaveExactCommands = (p, r, f, a) => {
|
|
|
94
92
|
*
|
|
95
93
|
* @return {Array}
|
|
96
94
|
*/
|
|
97
|
-
export const getInstallCommands = (p, r, f
|
|
95
|
+
export const getInstallCommands = (p, r, f) => {
|
|
98
96
|
log('getInstallCommands')
|
|
99
97
|
|
|
100
98
|
const c = transform(p)
|
|
101
99
|
const commands = `npm i ${c}`
|
|
102
100
|
|
|
103
101
|
return normalizeCommands(
|
|
104
|
-
getRegistryParameter(r, getForceParameter(f,
|
|
102
|
+
getRegistryParameter(r, getForceParameter(f, commands))
|
|
105
103
|
)
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -116,10 +114,10 @@ export const getInstallCommands = (p, r, f, a) => {
|
|
|
116
114
|
*
|
|
117
115
|
* @return {Array}
|
|
118
116
|
*/
|
|
119
|
-
export function getInstallSaveBundleSaveExactCommands (p, r, f
|
|
117
|
+
export function getInstallSaveBundleSaveExactCommands (p, r, f) {
|
|
120
118
|
log('getInstallSaveBundleSaveExactCommands')
|
|
121
119
|
|
|
122
|
-
const commands = getInstallSaveExactCommands(p, r, f
|
|
120
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
123
121
|
|
|
124
122
|
return normalizeCommands(
|
|
125
123
|
getSaveBundleParameter(commands)
|
|
@@ -137,10 +135,10 @@ export function getInstallSaveBundleSaveExactCommands (p, r, f, a) {
|
|
|
137
135
|
*
|
|
138
136
|
* @return {Array}
|
|
139
137
|
*/
|
|
140
|
-
export function getInstallSaveBundleCommands (p, r, f
|
|
138
|
+
export function getInstallSaveBundleCommands (p, r, f) {
|
|
141
139
|
log('getInstallSaveBundleCommands')
|
|
142
140
|
|
|
143
|
-
const commands = getInstallCommands(p, r, f
|
|
141
|
+
const commands = getInstallCommands(p, r, f)
|
|
144
142
|
|
|
145
143
|
return normalizeCommands(
|
|
146
144
|
getSaveBundleParameter(commands)
|
|
@@ -158,10 +156,10 @@ export function getInstallSaveBundleCommands (p, r, f, a) {
|
|
|
158
156
|
*
|
|
159
157
|
* @return {Array}
|
|
160
158
|
*/
|
|
161
|
-
export function getInstallSaveOptionalSaveExactCommands (p, r, f
|
|
159
|
+
export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
|
|
162
160
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
163
161
|
|
|
164
|
-
const commands = getInstallSaveExactCommands(p, r, f
|
|
162
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
165
163
|
|
|
166
164
|
return normalizeCommands(
|
|
167
165
|
getSaveOptionalParameter(commands)
|
|
@@ -179,10 +177,10 @@ export function getInstallSaveOptionalSaveExactCommands (p, r, f, a) {
|
|
|
179
177
|
*
|
|
180
178
|
* @return {Array}
|
|
181
179
|
*/
|
|
182
|
-
export function getInstallSaveOptionalCommands (p, r, f
|
|
180
|
+
export function getInstallSaveOptionalCommands (p, r, f) {
|
|
183
181
|
log('getInstallSaveOptionalCommands')
|
|
184
182
|
|
|
185
|
-
const commands = getInstallCommands(p, r, f
|
|
183
|
+
const commands = getInstallCommands(p, r, f)
|
|
186
184
|
|
|
187
185
|
return normalizeCommands(
|
|
188
186
|
getSaveOptionalParameter(commands)
|
|
@@ -200,10 +198,10 @@ export function getInstallSaveOptionalCommands (p, r, f, a) {
|
|
|
200
198
|
*
|
|
201
199
|
* @return {Array}
|
|
202
200
|
*/
|
|
203
|
-
export function getInstallSaveDevSaveExactCommands (p, r, f
|
|
201
|
+
export function getInstallSaveDevSaveExactCommands (p, r, f) {
|
|
204
202
|
log('getInstallSaveDevSaveExactCommands')
|
|
205
203
|
|
|
206
|
-
const commands = getInstallSaveExactCommands(p, r, f
|
|
204
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
207
205
|
|
|
208
206
|
return normalizeCommands(
|
|
209
207
|
getSaveDevParameter(commands)
|
|
@@ -221,10 +219,10 @@ export function getInstallSaveDevSaveExactCommands (p, r, f, a) {
|
|
|
221
219
|
*
|
|
222
220
|
* @return {Array}
|
|
223
221
|
*/
|
|
224
|
-
export function getInstallSaveDevCommands (p, r, f
|
|
222
|
+
export function getInstallSaveDevCommands (p, r, f) {
|
|
225
223
|
log('getInstallSaveDevCommands')
|
|
226
224
|
|
|
227
|
-
const commands = getInstallCommands(p, r, f
|
|
225
|
+
const commands = getInstallCommands(p, r, f)
|
|
228
226
|
|
|
229
227
|
return normalizeCommands(
|
|
230
228
|
getSaveDevParameter(commands)
|
|
@@ -242,10 +240,10 @@ export function getInstallSaveDevCommands (p, r, f, a) {
|
|
|
242
240
|
*
|
|
243
241
|
* @return {Array}
|
|
244
242
|
*/
|
|
245
|
-
export function getInstallSaveProdSaveExactCommands (p, r, f
|
|
243
|
+
export function getInstallSaveProdSaveExactCommands (p, r, f) {
|
|
246
244
|
log('getInstallSaveProdSaveExactCommands')
|
|
247
245
|
|
|
248
|
-
const commands = getInstallSaveExactCommands(p, r, f
|
|
246
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
249
247
|
|
|
250
248
|
return normalizeCommands(
|
|
251
249
|
getSaveProdParameter(commands)
|
|
@@ -263,10 +261,10 @@ export function getInstallSaveProdSaveExactCommands (p, r, f, a) {
|
|
|
263
261
|
*
|
|
264
262
|
* @return {Array}
|
|
265
263
|
*/
|
|
266
|
-
export function getInstallSaveProdCommands (p, r, f
|
|
264
|
+
export function getInstallSaveProdCommands (p, r, f) {
|
|
267
265
|
log('getInstallSaveProdCommands')
|
|
268
266
|
|
|
269
|
-
const commands = getInstallCommands(p, r, f
|
|
267
|
+
const commands = getInstallCommands(p, r, f)
|
|
270
268
|
|
|
271
269
|
return normalizeCommands(
|
|
272
270
|
getSaveProdParameter(commands)
|
|
@@ -285,13 +283,13 @@ export function getInstallSaveProdCommands (p, r, f, a) {
|
|
|
285
283
|
*
|
|
286
284
|
* @return {Promise}
|
|
287
285
|
*/
|
|
288
|
-
export function installSaveBundleSaveExact (d, p, r, f
|
|
286
|
+
export function installSaveBundleSaveExact (d, p, r, f) {
|
|
289
287
|
log('installSaveBundleSaveExact')
|
|
290
288
|
|
|
291
289
|
return (
|
|
292
290
|
new Promise((resolve, reject) => {
|
|
293
291
|
const log = use('install-save-bundle-save-exact')
|
|
294
|
-
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f
|
|
292
|
+
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
295
293
|
|
|
296
294
|
/**
|
|
297
295
|
* log(commands)
|
|
@@ -320,13 +318,13 @@ export function installSaveBundleSaveExact (d, p, r, f, a) {
|
|
|
320
318
|
*
|
|
321
319
|
* @return {Promise}
|
|
322
320
|
*/
|
|
323
|
-
export function installSaveBundle (d, p, r, f
|
|
321
|
+
export function installSaveBundle (d, p, r, f) {
|
|
324
322
|
log('installSaveBundle')
|
|
325
323
|
|
|
326
324
|
return (
|
|
327
325
|
new Promise((resolve, reject) => {
|
|
328
326
|
const log = use('install-save-bundle')
|
|
329
|
-
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f
|
|
327
|
+
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f))
|
|
330
328
|
|
|
331
329
|
/**
|
|
332
330
|
* log(commands)
|
|
@@ -355,13 +353,13 @@ export function installSaveBundle (d, p, r, f, a) {
|
|
|
355
353
|
*
|
|
356
354
|
* @return {Promise}
|
|
357
355
|
*/
|
|
358
|
-
export function installSaveOptionalSaveExact (d, p, r, f
|
|
356
|
+
export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
359
357
|
log('installSaveOptionalSaveExact')
|
|
360
358
|
|
|
361
359
|
return (
|
|
362
360
|
new Promise((resolve, reject) => {
|
|
363
361
|
const log = use('install-save-otional-save-exact')
|
|
364
|
-
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f
|
|
362
|
+
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
365
363
|
|
|
366
364
|
/**
|
|
367
365
|
* log(commands)
|
|
@@ -390,13 +388,13 @@ export function installSaveOptionalSaveExact (d, p, r, f, a) {
|
|
|
390
388
|
*
|
|
391
389
|
* @return {Promise}
|
|
392
390
|
*/
|
|
393
|
-
export function installSaveOptional (d, p, r, f
|
|
391
|
+
export function installSaveOptional (d, p, r, f) {
|
|
394
392
|
log('installSaveOptional')
|
|
395
393
|
|
|
396
394
|
return (
|
|
397
395
|
new Promise((resolve, reject) => {
|
|
398
396
|
const log = use('install-save-otional')
|
|
399
|
-
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f
|
|
397
|
+
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f))
|
|
400
398
|
|
|
401
399
|
/**
|
|
402
400
|
* log(commands)
|
|
@@ -425,13 +423,13 @@ export function installSaveOptional (d, p, r, f, a) {
|
|
|
425
423
|
*
|
|
426
424
|
* @return {Promise}
|
|
427
425
|
*/
|
|
428
|
-
export function installSaveDevSaveExact (d, p, r, f
|
|
426
|
+
export function installSaveDevSaveExact (d, p, r, f) {
|
|
429
427
|
log('installSaveDevSaveExact')
|
|
430
428
|
|
|
431
429
|
return (
|
|
432
430
|
new Promise((resolve, reject) => {
|
|
433
431
|
const log = use('install-save-dev-save-exact')
|
|
434
|
-
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f
|
|
432
|
+
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
435
433
|
|
|
436
434
|
/**
|
|
437
435
|
* log(commands)
|
|
@@ -460,13 +458,13 @@ export function installSaveDevSaveExact (d, p, r, f, a) {
|
|
|
460
458
|
*
|
|
461
459
|
* @return {Promise}
|
|
462
460
|
*/
|
|
463
|
-
export function installSaveDev (d, p, r, f
|
|
461
|
+
export function installSaveDev (d, p, r, f) {
|
|
464
462
|
log('installSaveDev')
|
|
465
463
|
|
|
466
464
|
return (
|
|
467
465
|
new Promise((resolve, reject) => {
|
|
468
466
|
const log = use('install-save-dev')
|
|
469
|
-
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f
|
|
467
|
+
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f))
|
|
470
468
|
|
|
471
469
|
/**
|
|
472
470
|
* log(commands)
|
|
@@ -495,13 +493,13 @@ export function installSaveDev (d, p, r, f, a) {
|
|
|
495
493
|
*
|
|
496
494
|
* @return {Promise}
|
|
497
495
|
*/
|
|
498
|
-
export function installSaveProdSaveExact (d, p, r, f
|
|
496
|
+
export function installSaveProdSaveExact (d, p, r, f) {
|
|
499
497
|
log('installSaveProdSaveExact')
|
|
500
498
|
|
|
501
499
|
return (
|
|
502
500
|
new Promise((resolve, reject) => {
|
|
503
501
|
const log = use('install-save-prod-save-exact')
|
|
504
|
-
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f
|
|
502
|
+
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
505
503
|
|
|
506
504
|
/**
|
|
507
505
|
* log(commands)
|
|
@@ -530,13 +528,13 @@ export function installSaveProdSaveExact (d, p, r, f, a) {
|
|
|
530
528
|
*
|
|
531
529
|
* @return {Promise}
|
|
532
530
|
*/
|
|
533
|
-
export function installSaveProd (d, p, r, f
|
|
531
|
+
export function installSaveProd (d, p, r, f) {
|
|
534
532
|
log('installSaveProd')
|
|
535
533
|
|
|
536
534
|
return (
|
|
537
535
|
new Promise((resolve, reject) => {
|
|
538
536
|
const log = use('install-save-prod')
|
|
539
|
-
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f
|
|
537
|
+
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f))
|
|
540
538
|
|
|
541
539
|
/**
|
|
542
540
|
* log(commands)
|
|
@@ -566,16 +564,16 @@ export function installSaveProd (d, p, r, f, a) {
|
|
|
566
564
|
*
|
|
567
565
|
* @return {Promise}
|
|
568
566
|
*/
|
|
569
|
-
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false
|
|
567
|
+
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
570
568
|
log('executeBundle')
|
|
571
569
|
|
|
572
570
|
const depsExact = getDepsExact(packages, configuration)
|
|
573
571
|
|
|
574
|
-
if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force
|
|
572
|
+
if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force)
|
|
575
573
|
|
|
576
574
|
const deps = getDeps(packages)
|
|
577
575
|
|
|
578
|
-
if (deps.length) await installSaveBundle(directory, deps, registry, force
|
|
576
|
+
if (deps.length) await installSaveBundle(directory, deps, registry, force)
|
|
579
577
|
}
|
|
580
578
|
|
|
581
579
|
/**
|
|
@@ -591,16 +589,16 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
|
|
|
591
589
|
*
|
|
592
590
|
* @return {Promise}
|
|
593
591
|
*/
|
|
594
|
-
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false
|
|
592
|
+
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
595
593
|
log('executeOptional')
|
|
596
594
|
|
|
597
595
|
const depsExact = getDepsExact(packages, configuration)
|
|
598
596
|
|
|
599
|
-
if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry, force
|
|
597
|
+
if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry, force)
|
|
600
598
|
|
|
601
599
|
const deps = getDeps(packages)
|
|
602
600
|
|
|
603
|
-
if (deps.length) await installSaveOptional(directory, deps, registry, force
|
|
601
|
+
if (deps.length) await installSaveOptional(directory, deps, registry, force)
|
|
604
602
|
}
|
|
605
603
|
|
|
606
604
|
/**
|
|
@@ -616,16 +614,16 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
|
|
|
616
614
|
*
|
|
617
615
|
* @return {Promise}
|
|
618
616
|
*/
|
|
619
|
-
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false
|
|
617
|
+
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
620
618
|
log('executeDev')
|
|
621
619
|
|
|
622
620
|
const depsExact = getDepsExact(packages, configuration)
|
|
623
621
|
|
|
624
|
-
if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force
|
|
622
|
+
if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force)
|
|
625
623
|
|
|
626
624
|
const deps = getDeps(packages)
|
|
627
625
|
|
|
628
|
-
if (deps.length) await installSaveDev(directory, deps, registry, force
|
|
626
|
+
if (deps.length) await installSaveDev(directory, deps, registry, force)
|
|
629
627
|
}
|
|
630
628
|
|
|
631
629
|
/**
|
|
@@ -641,14 +639,14 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
|
|
|
641
639
|
*
|
|
642
640
|
* @return {Promise}
|
|
643
641
|
*/
|
|
644
|
-
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false
|
|
642
|
+
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
645
643
|
log('executeProd')
|
|
646
644
|
|
|
647
645
|
const depsExact = getDepsExact(packages, configuration)
|
|
648
646
|
|
|
649
|
-
if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force
|
|
647
|
+
if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force)
|
|
650
648
|
|
|
651
649
|
const deps = getDeps(packages)
|
|
652
650
|
|
|
653
|
-
if (deps.length) await installSaveProd(directory, deps, registry, force
|
|
651
|
+
if (deps.length) await installSaveProd(directory, deps, registry, force)
|
|
654
652
|
}
|
package/src/install/index.js
CHANGED
|
@@ -19,11 +19,9 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
DIRECTORY,
|
|
21
21
|
REGISTRY,
|
|
22
|
-
AUTHOR,
|
|
23
22
|
getNoSaveParameter,
|
|
24
23
|
getRegistryParameter,
|
|
25
24
|
getForceParameter,
|
|
26
|
-
getAuthorParameter,
|
|
27
25
|
getSaveExactParameter,
|
|
28
26
|
getCommands,
|
|
29
27
|
normalizeCommands,
|
|
@@ -60,14 +58,14 @@ const OPTIONS = {
|
|
|
60
58
|
*
|
|
61
59
|
* @return {Array}
|
|
62
60
|
*/
|
|
63
|
-
export const getInstallSaveExactCommands = (p, s, r, f
|
|
61
|
+
export const getInstallSaveExactCommands = (p, s, r, f) => {
|
|
64
62
|
log('getInstallSaveExactCommands')
|
|
65
63
|
|
|
66
64
|
const c = transform(p)
|
|
67
65
|
const commands = `npm i ${c}`
|
|
68
66
|
|
|
69
67
|
return normalizeCommands(
|
|
70
|
-
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f,
|
|
68
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands))))
|
|
71
69
|
)
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -83,14 +81,14 @@ export const getInstallSaveExactCommands = (p, s, r, f, a) => {
|
|
|
83
81
|
*
|
|
84
82
|
* @return {Array}
|
|
85
83
|
*/
|
|
86
|
-
export const getInstallCommands = (p, s, r, f
|
|
84
|
+
export const getInstallCommands = (p, s, r, f) => {
|
|
87
85
|
log('getInstallCommands')
|
|
88
86
|
|
|
89
87
|
const c = transform(p)
|
|
90
88
|
const commands = `npm i ${c}`
|
|
91
89
|
|
|
92
90
|
return normalizeCommands(
|
|
93
|
-
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f,
|
|
91
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, commands)))
|
|
94
92
|
)
|
|
95
93
|
}
|
|
96
94
|
|
|
@@ -107,12 +105,12 @@ export const getInstallCommands = (p, s, r, f, a) => {
|
|
|
107
105
|
*
|
|
108
106
|
* @return {Promise}
|
|
109
107
|
*/
|
|
110
|
-
export function installSaveExact (d, p, s, r, f
|
|
108
|
+
export function installSaveExact (d, p, s, r, f) {
|
|
111
109
|
log('installSaveExact')
|
|
112
110
|
|
|
113
111
|
return (
|
|
114
112
|
new Promise((resolve, reject) => {
|
|
115
|
-
const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f
|
|
113
|
+
const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f))
|
|
116
114
|
|
|
117
115
|
const {
|
|
118
116
|
stdout,
|
|
@@ -138,12 +136,12 @@ export function installSaveExact (d, p, s, r, f, a) {
|
|
|
138
136
|
*
|
|
139
137
|
* @return {Promise}
|
|
140
138
|
*/
|
|
141
|
-
export function install (d, p, s, r, f
|
|
139
|
+
export function install (d, p, s, r, f) {
|
|
142
140
|
log('install')
|
|
143
141
|
|
|
144
142
|
return (
|
|
145
143
|
new Promise((resolve, reject) => {
|
|
146
|
-
const commands = getCommands(d, getInstallCommands(p, s, r, f
|
|
144
|
+
const commands = getCommands(d, getInstallCommands(p, s, r, f))
|
|
147
145
|
|
|
148
146
|
const {
|
|
149
147
|
stdout,
|
|
@@ -169,14 +167,14 @@ export function install (d, p, s, r, f, a) {
|
|
|
169
167
|
*
|
|
170
168
|
* @return {Promise}
|
|
171
169
|
*/
|
|
172
|
-
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false
|
|
170
|
+
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false) {
|
|
173
171
|
log('execute')
|
|
174
172
|
|
|
175
173
|
const depsExact = getDepsExact(packages, configuration)
|
|
176
174
|
|
|
177
|
-
if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force
|
|
175
|
+
if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force)
|
|
178
176
|
|
|
179
177
|
const deps = getDeps(packages)
|
|
180
178
|
|
|
181
|
-
if (deps.length) await install(directory, deps, save, registry, force
|
|
179
|
+
if (deps.length) await install(directory, deps, save, registry, force)
|
|
182
180
|
}
|