@modernpoacher/deps 1.6.15 → 1.6.16
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 +14 -11
- package/bin/execute/app.js +21 -18
- package/bin/install/app.js +8 -6
- package/lib/common/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/install/index.js +1 -1
- package/package.json +3 -3
- package/src/common/index.js +14 -0
- package/src/index.js +50 -48
- package/src/install/index.js +13 -11
package/bin/app.js
CHANGED
|
@@ -66,6 +66,7 @@ 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('--author [author]', 'Git commit author')
|
|
69
70
|
.parse(argv)
|
|
70
71
|
|
|
71
72
|
/*
|
|
@@ -96,7 +97,8 @@ async function app () {
|
|
|
96
97
|
saveOptional: O,
|
|
97
98
|
saveBundle: B,
|
|
98
99
|
force,
|
|
99
|
-
registry
|
|
100
|
+
registry,
|
|
101
|
+
author
|
|
100
102
|
} = commander.opts()
|
|
101
103
|
|
|
102
104
|
log({
|
|
@@ -112,7 +114,7 @@ async function app () {
|
|
|
112
114
|
log('Prod')
|
|
113
115
|
|
|
114
116
|
try {
|
|
115
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
117
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, author)
|
|
116
118
|
} catch (e) {
|
|
117
119
|
handleError(e)
|
|
118
120
|
}
|
|
@@ -120,7 +122,7 @@ async function app () {
|
|
|
120
122
|
log('Dev')
|
|
121
123
|
|
|
122
124
|
try {
|
|
123
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
125
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, author)
|
|
124
126
|
} catch (e) {
|
|
125
127
|
handleError(e)
|
|
126
128
|
}
|
|
@@ -129,7 +131,7 @@ async function app () {
|
|
|
129
131
|
log('Prod')
|
|
130
132
|
|
|
131
133
|
try {
|
|
132
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
134
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, author)
|
|
133
135
|
} catch (e) {
|
|
134
136
|
handleError(e)
|
|
135
137
|
}
|
|
@@ -138,7 +140,7 @@ async function app () {
|
|
|
138
140
|
log('Dev')
|
|
139
141
|
|
|
140
142
|
try {
|
|
141
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
143
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, author)
|
|
142
144
|
} catch (e) {
|
|
143
145
|
handleError(e)
|
|
144
146
|
}
|
|
@@ -147,7 +149,7 @@ async function app () {
|
|
|
147
149
|
log('Optional')
|
|
148
150
|
|
|
149
151
|
try {
|
|
150
|
-
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force)
|
|
152
|
+
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force, author)
|
|
151
153
|
} catch (e) {
|
|
152
154
|
handleError(e)
|
|
153
155
|
}
|
|
@@ -156,7 +158,7 @@ async function app () {
|
|
|
156
158
|
log('Bundle')
|
|
157
159
|
|
|
158
160
|
try {
|
|
159
|
-
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force)
|
|
161
|
+
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force, author)
|
|
160
162
|
} catch (e) {
|
|
161
163
|
handleError(e)
|
|
162
164
|
}
|
package/bin/common/index.js
CHANGED
|
@@ -34,10 +34,13 @@ const {
|
|
|
34
34
|
const {
|
|
35
35
|
DIRECTORY,
|
|
36
36
|
REGISTRY,
|
|
37
|
+
AUTHOR,
|
|
38
|
+
|
|
37
39
|
NVM,
|
|
38
40
|
|
|
39
41
|
getRegistryParameter,
|
|
40
|
-
getForceParameter
|
|
42
|
+
getForceParameter,
|
|
43
|
+
getAuthorParameter
|
|
41
44
|
} = require('@modernpoacher/deps/common')
|
|
42
45
|
|
|
43
46
|
const log = debug('@modernpoacher/deps')
|
|
@@ -76,19 +79,19 @@ rm -rf node_modules package-lock.json
|
|
|
76
79
|
`)
|
|
77
80
|
|
|
78
81
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
79
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
|
|
80
|
-
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
82
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) => tidy(getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'npm i'))))
|
|
83
|
+
: (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) => tidy(`
|
|
81
84
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
82
85
|
. "${NVM}" 2> /dev/null
|
|
83
|
-
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
86
|
+
${getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'npm i')))}
|
|
84
87
|
`)
|
|
85
88
|
|
|
86
89
|
const getDepsCommands = PLATFORM === 'win32'
|
|
87
|
-
? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
|
|
88
|
-
: (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(`
|
|
90
|
+
? (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) => tidy(getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'deps'))))
|
|
91
|
+
: (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) => tidy(`
|
|
89
92
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
90
93
|
. "${NVM}" 2> /dev/null
|
|
91
|
-
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
94
|
+
${getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'deps')))}
|
|
92
95
|
`)
|
|
93
96
|
|
|
94
97
|
function use (key) {
|
|
@@ -258,13 +261,13 @@ function rmrf (directory = DIRECTORY) {
|
|
|
258
261
|
)
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
264
|
+
function npmi (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
262
265
|
log('npmi')
|
|
263
266
|
|
|
264
267
|
return (
|
|
265
268
|
new Promise((resolve, reject) => {
|
|
266
269
|
const log = use('npmi')
|
|
267
|
-
const commands = getNpmiCommands(directory, registry, force)
|
|
270
|
+
const commands = getNpmiCommands(directory, registry, force, author)
|
|
268
271
|
|
|
269
272
|
/**
|
|
270
273
|
* log(commands)
|
|
@@ -281,13 +284,13 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
281
284
|
)
|
|
282
285
|
}
|
|
283
286
|
|
|
284
|
-
function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
287
|
+
function deps (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
285
288
|
log('deps')
|
|
286
289
|
|
|
287
290
|
return (
|
|
288
291
|
new Promise((resolve, reject) => {
|
|
289
292
|
const log = use('deps')
|
|
290
|
-
const commands = getDepsCommands(directory, registry, force)
|
|
293
|
+
const commands = getDepsCommands(directory, registry, force, author)
|
|
291
294
|
|
|
292
295
|
/**
|
|
293
296
|
* log(commands)
|
package/bin/execute/app.js
CHANGED
|
@@ -32,7 +32,8 @@ const {
|
|
|
32
32
|
} = require('@modernpoacher/deps/common/git')
|
|
33
33
|
|
|
34
34
|
const {
|
|
35
|
-
REGISTRY
|
|
35
|
+
REGISTRY,
|
|
36
|
+
AUTHOR
|
|
36
37
|
} = require('@modernpoacher/deps/common')
|
|
37
38
|
|
|
38
39
|
const {
|
|
@@ -116,15 +117,15 @@ async function mapRevParse (directory) {
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false) {
|
|
120
|
+
async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false, author = AUTHOR) {
|
|
120
121
|
log('iterate')
|
|
121
122
|
|
|
122
|
-
if (directory) await execute(directory, registry, force)
|
|
123
|
+
if (directory) await execute(directory, registry, force, author)
|
|
123
124
|
|
|
124
|
-
if (directories.length) await iterate(directories, registry, force)
|
|
125
|
+
if (directories.length) await iterate(directories, registry, force, author)
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
128
|
+
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
128
129
|
log('execute')
|
|
129
130
|
|
|
130
131
|
try {
|
|
@@ -133,8 +134,8 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
133
134
|
await gitCheckout(directory, await catGitRefsRemotesOriginHead(directory))
|
|
134
135
|
await gitPull(directory)
|
|
135
136
|
await rmrf(directory)
|
|
136
|
-
await npmi(directory, registry, force)
|
|
137
|
-
await deps(directory, registry, force)
|
|
137
|
+
await npmi(directory, registry, force, author)
|
|
138
|
+
await deps(directory, registry, force, author)
|
|
138
139
|
await gitAdd(directory)
|
|
139
140
|
await gitCommit(directory)
|
|
140
141
|
await gitPush(directory)
|
|
@@ -144,7 +145,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
148
|
+
async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
148
149
|
log('executeFrom')
|
|
149
150
|
|
|
150
151
|
const path = resolve(directory)
|
|
@@ -152,7 +153,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
152
153
|
try {
|
|
153
154
|
if (path === await gitRevParse(path)) {
|
|
154
155
|
return (
|
|
155
|
-
await execute(path, registry, force)
|
|
156
|
+
await execute(path, registry, force, author)
|
|
156
157
|
)
|
|
157
158
|
}
|
|
158
159
|
} catch (e) {
|
|
@@ -160,7 +161,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
164
|
+
async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
164
165
|
log('executeOnly')
|
|
165
166
|
|
|
166
167
|
const path = resolve(directory)
|
|
@@ -168,7 +169,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
168
169
|
try {
|
|
169
170
|
if (path === await gitRevParse(path)) {
|
|
170
171
|
return (
|
|
171
|
-
await execute(path, registry, force)
|
|
172
|
+
await execute(path, registry, force, author)
|
|
172
173
|
)
|
|
173
174
|
}
|
|
174
175
|
} catch (e) {
|
|
@@ -176,7 +177,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
180
|
+
async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
180
181
|
log('executePath')
|
|
181
182
|
|
|
182
183
|
const path = resolve(directory)
|
|
@@ -184,7 +185,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
184
185
|
try {
|
|
185
186
|
if (path === await gitRevParse(path)) {
|
|
186
187
|
return (
|
|
187
|
-
await execute(path, registry, force)
|
|
188
|
+
await execute(path, registry, force, author)
|
|
188
189
|
)
|
|
189
190
|
}
|
|
190
191
|
} catch (e) {
|
|
@@ -198,7 +199,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
|
|
|
198
199
|
|
|
199
200
|
if (depsList.length) {
|
|
200
201
|
return (
|
|
201
|
-
await iterate(depsList, registry, force)
|
|
202
|
+
await iterate(depsList, registry, force, author)
|
|
202
203
|
)
|
|
203
204
|
}
|
|
204
205
|
}
|
|
@@ -221,6 +222,7 @@ async function app () {
|
|
|
221
222
|
.option('-o, --only [only]', 'Update only directory')
|
|
222
223
|
.option('--registry [registry]', 'Installation registry')
|
|
223
224
|
.option('--force [force]', 'Force installation`', false)
|
|
225
|
+
.option('--author [author]', 'Git commit author')
|
|
224
226
|
.parse(argv)
|
|
225
227
|
|
|
226
228
|
const {
|
|
@@ -228,7 +230,8 @@ async function app () {
|
|
|
228
230
|
from: F,
|
|
229
231
|
only: O,
|
|
230
232
|
registry,
|
|
231
|
-
force
|
|
233
|
+
force,
|
|
234
|
+
author
|
|
232
235
|
} = commander.opts()
|
|
233
236
|
|
|
234
237
|
log({
|
|
@@ -243,7 +246,7 @@ async function app () {
|
|
|
243
246
|
log('Path')
|
|
244
247
|
|
|
245
248
|
try {
|
|
246
|
-
await executePath(P, registry, force)
|
|
249
|
+
await executePath(P, registry, force, author)
|
|
247
250
|
} catch (e) {
|
|
248
251
|
handleError(e)
|
|
249
252
|
}
|
|
@@ -252,7 +255,7 @@ async function app () {
|
|
|
252
255
|
log('From')
|
|
253
256
|
|
|
254
257
|
try {
|
|
255
|
-
await executeFrom(P, registry, force)
|
|
258
|
+
await executeFrom(P, registry, force, author)
|
|
256
259
|
} catch (e) {
|
|
257
260
|
handleError(e)
|
|
258
261
|
}
|
|
@@ -261,7 +264,7 @@ async function app () {
|
|
|
261
264
|
log('Only')
|
|
262
265
|
|
|
263
266
|
try {
|
|
264
|
-
await executeOnly(P, registry, force)
|
|
267
|
+
await executeOnly(P, registry, force, author)
|
|
265
268
|
} catch (e) {
|
|
266
269
|
handleError(e)
|
|
267
270
|
}
|
package/bin/install/app.js
CHANGED
|
@@ -66,6 +66,7 @@ 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('--author [author]', 'Git commit author')
|
|
69
70
|
.parse(argv)
|
|
70
71
|
|
|
71
72
|
/*
|
|
@@ -98,7 +99,8 @@ async function app () {
|
|
|
98
99
|
peer: p,
|
|
99
100
|
save,
|
|
100
101
|
registry,
|
|
101
|
-
force
|
|
102
|
+
force,
|
|
103
|
+
author
|
|
102
104
|
} = commander.opts()
|
|
103
105
|
|
|
104
106
|
log({
|
|
@@ -116,7 +118,7 @@ async function app () {
|
|
|
116
118
|
log('Prod')
|
|
117
119
|
|
|
118
120
|
try {
|
|
119
|
-
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
|
|
121
|
+
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force, author)
|
|
120
122
|
} catch (e) {
|
|
121
123
|
handleError(e)
|
|
122
124
|
}
|
|
@@ -125,7 +127,7 @@ async function app () {
|
|
|
125
127
|
log('Dev')
|
|
126
128
|
|
|
127
129
|
try {
|
|
128
|
-
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
|
|
130
|
+
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force, author)
|
|
129
131
|
} catch (e) {
|
|
130
132
|
handleError(e)
|
|
131
133
|
}
|
|
@@ -134,7 +136,7 @@ async function app () {
|
|
|
134
136
|
log('Optional')
|
|
135
137
|
|
|
136
138
|
try {
|
|
137
|
-
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
|
|
139
|
+
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force, author)
|
|
138
140
|
} catch (e) {
|
|
139
141
|
handleError(e)
|
|
140
142
|
}
|
|
@@ -143,7 +145,7 @@ async function app () {
|
|
|
143
145
|
log('Bundle')
|
|
144
146
|
|
|
145
147
|
try {
|
|
146
|
-
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
|
|
148
|
+
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force, author)
|
|
147
149
|
} catch (e) {
|
|
148
150
|
handleError(e)
|
|
149
151
|
}
|
|
@@ -152,7 +154,7 @@ async function app () {
|
|
|
152
154
|
log('Peer')
|
|
153
155
|
|
|
154
156
|
try {
|
|
155
|
-
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
|
|
157
|
+
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force, author)
|
|
156
158
|
} catch (e) {
|
|
157
159
|
handleError(e)
|
|
158
160
|
}
|
package/lib/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.REGISTRY=exports.NVM=exports.DIRECTORY=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 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(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=exports.getAuthorParameter=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 getAuthorParameter=(a,commands)=>a?commands.concat(` --author ${a}`):commands;exports.getAuthorParameter=getAuthorParameter;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)=>{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);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry);}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);}
|
|
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,a)=>{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.getAuthorParameter)(a,(0,_common.getSaveExactParameter)(commands)))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,r,f,a)=>{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,(0,_common.getAuthorParameter)(a,commands))));};exports.getInstallCommands=getInstallCommands;function getInstallSaveBundleSaveExactCommands(p,r,f,a){log('getInstallSaveBundleSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f,a){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f,a){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f,a){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f,a){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f,a){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f,a){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f,a){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f,a);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,r,f,a){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,a));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,a){log('installSaveBundle');return new Promise((resolve,reject)=>{const log=use('install-save-bundle');const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,r,f,a));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,a){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,a));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,a){log('installSaveOptional');return new Promise((resolve,reject)=>{const log=use('install-save-otional');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,r,f,a));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,a){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,a));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,a){log('installSaveDev');return new Promise((resolve,reject)=>{const log=use('install-save-dev');const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,r,f,a));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,a){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,a));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,a){log('installSaveProd');return new Promise((resolve,reject)=>{const log=use('install-save-prod');const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,r,f,a));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,author=_common.AUTHOR){log('executeBundle');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveBundleSaveExact(directory,depsExact,registry,force,author);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveBundle(directory,deps,registry,force,author);}async function executeOptional(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false,author=_common.AUTHOR){log('executeOptional');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveOptionalSaveExact(directory,depsExact,registry,force,author);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry,force,author);}async function executeDev(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false,author=_common.AUTHOR){log('executeDev');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveDevSaveExact(directory,depsExact,registry,force,author);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveDev(directory,deps,registry,force,author);}async function executeProd(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false,author=_common.AUTHOR){log('executeProd');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveProdSaveExact(directory,depsExact,registry,force,author);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveProd(directory,deps,registry,force,author);}
|
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)=>{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);}
|
|
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,a)=>{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.getAuthorParameter)(a,(0,_common.getSaveExactParameter)(commands))))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,s,r,f,a)=>{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,(0,_common.getAuthorParameter)(a,commands)))));};exports.getInstallCommands=getInstallCommands;function installSaveExact(d,p,s,r,f,a){log('installSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveExactCommands(p,s,r,f,a));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,a){log('install');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallCommands(p,s,r,f,a));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,author=_common.AUTHOR){log('execute');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveExact(directory,depsExact,save,registry,force,author);const deps=(0,_common.getDeps)(packages);if(deps.length)await install(directory,deps,save,registry,force,author);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.16",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"deps-head": "bin/head.sh"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"commander": "^9.
|
|
53
|
+
"commander": "^9.2.0",
|
|
54
54
|
"debug": "^4.3.4",
|
|
55
55
|
"glob-all": "^3.3.0",
|
|
56
56
|
"module-alias": "^2.2.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
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.
|
|
67
|
+
"core-js": "^3.22.0",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
69
|
"eslint": "7.32.0",
|
|
70
70
|
"eslint-config-standard": "^16.0.3",
|
package/src/common/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export const DIRECTORY = '.'
|
|
|
16
16
|
|
|
17
17
|
export const REGISTRY = 'https://registry.npmjs.org'
|
|
18
18
|
|
|
19
|
+
export const AUTHOR = 'Modern Poacher Limited <modernpoacher@modernpoacher.com>'
|
|
20
|
+
|
|
19
21
|
export const NVM = resolve(MODULE_PATH, '../../nvm.sh')
|
|
20
22
|
|
|
21
23
|
const log = debug('@modernpoacher/deps')
|
|
@@ -92,6 +94,18 @@ export const getRegistryParameter = (r, commands) => r ? commands.concat(` --reg
|
|
|
92
94
|
*/
|
|
93
95
|
export const getForceParameter = (f, commands) => f ? commands.concat(' --force') : commands
|
|
94
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
|
+
|
|
95
109
|
/**
|
|
96
110
|
* @function getNoSaveParameter
|
|
97
111
|
*
|
package/src/index.js
CHANGED
|
@@ -15,8 +15,10 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
DIRECTORY,
|
|
17
17
|
REGISTRY,
|
|
18
|
+
AUTHOR,
|
|
18
19
|
getRegistryParameter,
|
|
19
20
|
getForceParameter,
|
|
21
|
+
getAuthorParameter,
|
|
20
22
|
getSaveExactParameter,
|
|
21
23
|
getSaveBundleParameter,
|
|
22
24
|
getSaveOptionalParameter,
|
|
@@ -70,14 +72,14 @@ function use (key) {
|
|
|
70
72
|
*
|
|
71
73
|
* @return {Array}
|
|
72
74
|
*/
|
|
73
|
-
export const getInstallSaveExactCommands = (p, r, f) => {
|
|
75
|
+
export const getInstallSaveExactCommands = (p, r, f, a) => {
|
|
74
76
|
log('getInstallSaveExactCommands')
|
|
75
77
|
|
|
76
78
|
const c = transform(p)
|
|
77
79
|
const commands = `npm i ${c}`
|
|
78
80
|
|
|
79
81
|
return normalizeCommands(
|
|
80
|
-
getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands)))
|
|
82
|
+
getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, getSaveExactParameter(commands))))
|
|
81
83
|
)
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -92,14 +94,14 @@ export const getInstallSaveExactCommands = (p, r, f) => {
|
|
|
92
94
|
*
|
|
93
95
|
* @return {Array}
|
|
94
96
|
*/
|
|
95
|
-
export const getInstallCommands = (p, r, f) => {
|
|
97
|
+
export const getInstallCommands = (p, r, f, a) => {
|
|
96
98
|
log('getInstallCommands')
|
|
97
99
|
|
|
98
100
|
const c = transform(p)
|
|
99
101
|
const commands = `npm i ${c}`
|
|
100
102
|
|
|
101
103
|
return normalizeCommands(
|
|
102
|
-
getRegistryParameter(r, getForceParameter(f, commands))
|
|
104
|
+
getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, commands)))
|
|
103
105
|
)
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -114,10 +116,10 @@ export const getInstallCommands = (p, r, f) => {
|
|
|
114
116
|
*
|
|
115
117
|
* @return {Array}
|
|
116
118
|
*/
|
|
117
|
-
export function getInstallSaveBundleSaveExactCommands (p, r, f) {
|
|
119
|
+
export function getInstallSaveBundleSaveExactCommands (p, r, f, a) {
|
|
118
120
|
log('getInstallSaveBundleSaveExactCommands')
|
|
119
121
|
|
|
120
|
-
const commands = getInstallSaveExactCommands(p, r, f)
|
|
122
|
+
const commands = getInstallSaveExactCommands(p, r, f, a)
|
|
121
123
|
|
|
122
124
|
return normalizeCommands(
|
|
123
125
|
getSaveBundleParameter(commands)
|
|
@@ -135,10 +137,10 @@ export function getInstallSaveBundleSaveExactCommands (p, r, f) {
|
|
|
135
137
|
*
|
|
136
138
|
* @return {Array}
|
|
137
139
|
*/
|
|
138
|
-
export function getInstallSaveBundleCommands (p, r, f) {
|
|
140
|
+
export function getInstallSaveBundleCommands (p, r, f, a) {
|
|
139
141
|
log('getInstallSaveBundleCommands')
|
|
140
142
|
|
|
141
|
-
const commands = getInstallCommands(p, r, f)
|
|
143
|
+
const commands = getInstallCommands(p, r, f, a)
|
|
142
144
|
|
|
143
145
|
return normalizeCommands(
|
|
144
146
|
getSaveBundleParameter(commands)
|
|
@@ -156,10 +158,10 @@ export function getInstallSaveBundleCommands (p, r, f) {
|
|
|
156
158
|
*
|
|
157
159
|
* @return {Array}
|
|
158
160
|
*/
|
|
159
|
-
export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
|
|
161
|
+
export function getInstallSaveOptionalSaveExactCommands (p, r, f, a) {
|
|
160
162
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
161
163
|
|
|
162
|
-
const commands = getInstallSaveExactCommands(p, r, f)
|
|
164
|
+
const commands = getInstallSaveExactCommands(p, r, f, a)
|
|
163
165
|
|
|
164
166
|
return normalizeCommands(
|
|
165
167
|
getSaveOptionalParameter(commands)
|
|
@@ -177,10 +179,10 @@ export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
|
|
|
177
179
|
*
|
|
178
180
|
* @return {Array}
|
|
179
181
|
*/
|
|
180
|
-
export function getInstallSaveOptionalCommands (p, r, f) {
|
|
182
|
+
export function getInstallSaveOptionalCommands (p, r, f, a) {
|
|
181
183
|
log('getInstallSaveOptionalCommands')
|
|
182
184
|
|
|
183
|
-
const commands = getInstallCommands(p, r, f)
|
|
185
|
+
const commands = getInstallCommands(p, r, f, a)
|
|
184
186
|
|
|
185
187
|
return normalizeCommands(
|
|
186
188
|
getSaveOptionalParameter(commands)
|
|
@@ -198,10 +200,10 @@ export function getInstallSaveOptionalCommands (p, r, f) {
|
|
|
198
200
|
*
|
|
199
201
|
* @return {Array}
|
|
200
202
|
*/
|
|
201
|
-
export function getInstallSaveDevSaveExactCommands (p, r, f) {
|
|
203
|
+
export function getInstallSaveDevSaveExactCommands (p, r, f, a) {
|
|
202
204
|
log('getInstallSaveDevSaveExactCommands')
|
|
203
205
|
|
|
204
|
-
const commands = getInstallSaveExactCommands(p, r, f)
|
|
206
|
+
const commands = getInstallSaveExactCommands(p, r, f, a)
|
|
205
207
|
|
|
206
208
|
return normalizeCommands(
|
|
207
209
|
getSaveDevParameter(commands)
|
|
@@ -219,10 +221,10 @@ export function getInstallSaveDevSaveExactCommands (p, r, f) {
|
|
|
219
221
|
*
|
|
220
222
|
* @return {Array}
|
|
221
223
|
*/
|
|
222
|
-
export function getInstallSaveDevCommands (p, r, f) {
|
|
224
|
+
export function getInstallSaveDevCommands (p, r, f, a) {
|
|
223
225
|
log('getInstallSaveDevCommands')
|
|
224
226
|
|
|
225
|
-
const commands = getInstallCommands(p, r, f)
|
|
227
|
+
const commands = getInstallCommands(p, r, f, a)
|
|
226
228
|
|
|
227
229
|
return normalizeCommands(
|
|
228
230
|
getSaveDevParameter(commands)
|
|
@@ -240,10 +242,10 @@ export function getInstallSaveDevCommands (p, r, f) {
|
|
|
240
242
|
*
|
|
241
243
|
* @return {Array}
|
|
242
244
|
*/
|
|
243
|
-
export function getInstallSaveProdSaveExactCommands (p, r, f) {
|
|
245
|
+
export function getInstallSaveProdSaveExactCommands (p, r, f, a) {
|
|
244
246
|
log('getInstallSaveProdSaveExactCommands')
|
|
245
247
|
|
|
246
|
-
const commands = getInstallSaveExactCommands(p, r, f)
|
|
248
|
+
const commands = getInstallSaveExactCommands(p, r, f, a)
|
|
247
249
|
|
|
248
250
|
return normalizeCommands(
|
|
249
251
|
getSaveProdParameter(commands)
|
|
@@ -261,10 +263,10 @@ export function getInstallSaveProdSaveExactCommands (p, r, f) {
|
|
|
261
263
|
*
|
|
262
264
|
* @return {Array}
|
|
263
265
|
*/
|
|
264
|
-
export function getInstallSaveProdCommands (p, r, f) {
|
|
266
|
+
export function getInstallSaveProdCommands (p, r, f, a) {
|
|
265
267
|
log('getInstallSaveProdCommands')
|
|
266
268
|
|
|
267
|
-
const commands = getInstallCommands(p, r, f)
|
|
269
|
+
const commands = getInstallCommands(p, r, f, a)
|
|
268
270
|
|
|
269
271
|
return normalizeCommands(
|
|
270
272
|
getSaveProdParameter(commands)
|
|
@@ -283,13 +285,13 @@ export function getInstallSaveProdCommands (p, r, f) {
|
|
|
283
285
|
*
|
|
284
286
|
* @return {Promise}
|
|
285
287
|
*/
|
|
286
|
-
export function installSaveBundleSaveExact (d, p, r, f) {
|
|
288
|
+
export function installSaveBundleSaveExact (d, p, r, f, a) {
|
|
287
289
|
log('installSaveBundleSaveExact')
|
|
288
290
|
|
|
289
291
|
return (
|
|
290
292
|
new Promise((resolve, reject) => {
|
|
291
293
|
const log = use('install-save-bundle-save-exact')
|
|
292
|
-
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
294
|
+
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f, a))
|
|
293
295
|
|
|
294
296
|
/**
|
|
295
297
|
* log(commands)
|
|
@@ -318,13 +320,13 @@ export function installSaveBundleSaveExact (d, p, r, f) {
|
|
|
318
320
|
*
|
|
319
321
|
* @return {Promise}
|
|
320
322
|
*/
|
|
321
|
-
export function installSaveBundle (d, p, r, f) {
|
|
323
|
+
export function installSaveBundle (d, p, r, f, a) {
|
|
322
324
|
log('installSaveBundle')
|
|
323
325
|
|
|
324
326
|
return (
|
|
325
327
|
new Promise((resolve, reject) => {
|
|
326
328
|
const log = use('install-save-bundle')
|
|
327
|
-
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f))
|
|
329
|
+
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f, a))
|
|
328
330
|
|
|
329
331
|
/**
|
|
330
332
|
* log(commands)
|
|
@@ -353,13 +355,13 @@ export function installSaveBundle (d, p, r, f) {
|
|
|
353
355
|
*
|
|
354
356
|
* @return {Promise}
|
|
355
357
|
*/
|
|
356
|
-
export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
358
|
+
export function installSaveOptionalSaveExact (d, p, r, f, a) {
|
|
357
359
|
log('installSaveOptionalSaveExact')
|
|
358
360
|
|
|
359
361
|
return (
|
|
360
362
|
new Promise((resolve, reject) => {
|
|
361
363
|
const log = use('install-save-otional-save-exact')
|
|
362
|
-
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
364
|
+
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f, a))
|
|
363
365
|
|
|
364
366
|
/**
|
|
365
367
|
* log(commands)
|
|
@@ -388,13 +390,13 @@ export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
|
388
390
|
*
|
|
389
391
|
* @return {Promise}
|
|
390
392
|
*/
|
|
391
|
-
export function installSaveOptional (d, p, r, f) {
|
|
393
|
+
export function installSaveOptional (d, p, r, f, a) {
|
|
392
394
|
log('installSaveOptional')
|
|
393
395
|
|
|
394
396
|
return (
|
|
395
397
|
new Promise((resolve, reject) => {
|
|
396
398
|
const log = use('install-save-otional')
|
|
397
|
-
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f))
|
|
399
|
+
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f, a))
|
|
398
400
|
|
|
399
401
|
/**
|
|
400
402
|
* log(commands)
|
|
@@ -423,13 +425,13 @@ export function installSaveOptional (d, p, r, f) {
|
|
|
423
425
|
*
|
|
424
426
|
* @return {Promise}
|
|
425
427
|
*/
|
|
426
|
-
export function installSaveDevSaveExact (d, p, r, f) {
|
|
428
|
+
export function installSaveDevSaveExact (d, p, r, f, a) {
|
|
427
429
|
log('installSaveDevSaveExact')
|
|
428
430
|
|
|
429
431
|
return (
|
|
430
432
|
new Promise((resolve, reject) => {
|
|
431
433
|
const log = use('install-save-dev-save-exact')
|
|
432
|
-
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
434
|
+
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f, a))
|
|
433
435
|
|
|
434
436
|
/**
|
|
435
437
|
* log(commands)
|
|
@@ -458,13 +460,13 @@ export function installSaveDevSaveExact (d, p, r, f) {
|
|
|
458
460
|
*
|
|
459
461
|
* @return {Promise}
|
|
460
462
|
*/
|
|
461
|
-
export function installSaveDev (d, p, r, f) {
|
|
463
|
+
export function installSaveDev (d, p, r, f, a) {
|
|
462
464
|
log('installSaveDev')
|
|
463
465
|
|
|
464
466
|
return (
|
|
465
467
|
new Promise((resolve, reject) => {
|
|
466
468
|
const log = use('install-save-dev')
|
|
467
|
-
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f))
|
|
469
|
+
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f, a))
|
|
468
470
|
|
|
469
471
|
/**
|
|
470
472
|
* log(commands)
|
|
@@ -493,13 +495,13 @@ export function installSaveDev (d, p, r, f) {
|
|
|
493
495
|
*
|
|
494
496
|
* @return {Promise}
|
|
495
497
|
*/
|
|
496
|
-
export function installSaveProdSaveExact (d, p, r, f) {
|
|
498
|
+
export function installSaveProdSaveExact (d, p, r, f, a) {
|
|
497
499
|
log('installSaveProdSaveExact')
|
|
498
500
|
|
|
499
501
|
return (
|
|
500
502
|
new Promise((resolve, reject) => {
|
|
501
503
|
const log = use('install-save-prod-save-exact')
|
|
502
|
-
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
504
|
+
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f, a))
|
|
503
505
|
|
|
504
506
|
/**
|
|
505
507
|
* log(commands)
|
|
@@ -528,13 +530,13 @@ export function installSaveProdSaveExact (d, p, r, f) {
|
|
|
528
530
|
*
|
|
529
531
|
* @return {Promise}
|
|
530
532
|
*/
|
|
531
|
-
export function installSaveProd (d, p, r, f) {
|
|
533
|
+
export function installSaveProd (d, p, r, f, a) {
|
|
532
534
|
log('installSaveProd')
|
|
533
535
|
|
|
534
536
|
return (
|
|
535
537
|
new Promise((resolve, reject) => {
|
|
536
538
|
const log = use('install-save-prod')
|
|
537
|
-
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f))
|
|
539
|
+
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f, a))
|
|
538
540
|
|
|
539
541
|
/**
|
|
540
542
|
* log(commands)
|
|
@@ -564,16 +566,16 @@ export function installSaveProd (d, p, r, f) {
|
|
|
564
566
|
*
|
|
565
567
|
* @return {Promise}
|
|
566
568
|
*/
|
|
567
|
-
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
569
|
+
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
568
570
|
log('executeBundle')
|
|
569
571
|
|
|
570
572
|
const depsExact = getDepsExact(packages, configuration)
|
|
571
573
|
|
|
572
|
-
if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force)
|
|
574
|
+
if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force, author)
|
|
573
575
|
|
|
574
576
|
const deps = getDeps(packages)
|
|
575
577
|
|
|
576
|
-
if (deps.length) await installSaveBundle(directory, deps, registry, force)
|
|
578
|
+
if (deps.length) await installSaveBundle(directory, deps, registry, force, author)
|
|
577
579
|
}
|
|
578
580
|
|
|
579
581
|
/**
|
|
@@ -589,16 +591,16 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
|
|
|
589
591
|
*
|
|
590
592
|
* @return {Promise}
|
|
591
593
|
*/
|
|
592
|
-
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
594
|
+
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
593
595
|
log('executeOptional')
|
|
594
596
|
|
|
595
597
|
const depsExact = getDepsExact(packages, configuration)
|
|
596
598
|
|
|
597
|
-
if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry)
|
|
599
|
+
if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry, force, author)
|
|
598
600
|
|
|
599
601
|
const deps = getDeps(packages)
|
|
600
602
|
|
|
601
|
-
if (deps.length) await installSaveOptional(directory, deps, registry)
|
|
603
|
+
if (deps.length) await installSaveOptional(directory, deps, registry, force, author)
|
|
602
604
|
}
|
|
603
605
|
|
|
604
606
|
/**
|
|
@@ -614,16 +616,16 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
|
|
|
614
616
|
*
|
|
615
617
|
* @return {Promise}
|
|
616
618
|
*/
|
|
617
|
-
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
619
|
+
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
618
620
|
log('executeDev')
|
|
619
621
|
|
|
620
622
|
const depsExact = getDepsExact(packages, configuration)
|
|
621
623
|
|
|
622
|
-
if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force)
|
|
624
|
+
if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force, author)
|
|
623
625
|
|
|
624
626
|
const deps = getDeps(packages)
|
|
625
627
|
|
|
626
|
-
if (deps.length) await installSaveDev(directory, deps, registry, force)
|
|
628
|
+
if (deps.length) await installSaveDev(directory, deps, registry, force, author)
|
|
627
629
|
}
|
|
628
630
|
|
|
629
631
|
/**
|
|
@@ -639,14 +641,14 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
|
|
|
639
641
|
*
|
|
640
642
|
* @return {Promise}
|
|
641
643
|
*/
|
|
642
|
-
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
644
|
+
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
643
645
|
log('executeProd')
|
|
644
646
|
|
|
645
647
|
const depsExact = getDepsExact(packages, configuration)
|
|
646
648
|
|
|
647
|
-
if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force)
|
|
649
|
+
if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force, author)
|
|
648
650
|
|
|
649
651
|
const deps = getDeps(packages)
|
|
650
652
|
|
|
651
|
-
if (deps.length) await installSaveProd(directory, deps, registry, force)
|
|
653
|
+
if (deps.length) await installSaveProd(directory, deps, registry, force, author)
|
|
652
654
|
}
|
package/src/install/index.js
CHANGED
|
@@ -19,9 +19,11 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
DIRECTORY,
|
|
21
21
|
REGISTRY,
|
|
22
|
+
AUTHOR,
|
|
22
23
|
getNoSaveParameter,
|
|
23
24
|
getRegistryParameter,
|
|
24
25
|
getForceParameter,
|
|
26
|
+
getAuthorParameter,
|
|
25
27
|
getSaveExactParameter,
|
|
26
28
|
getCommands,
|
|
27
29
|
normalizeCommands,
|
|
@@ -58,14 +60,14 @@ const OPTIONS = {
|
|
|
58
60
|
*
|
|
59
61
|
* @return {Array}
|
|
60
62
|
*/
|
|
61
|
-
export const getInstallSaveExactCommands = (p, s, r, f) => {
|
|
63
|
+
export const getInstallSaveExactCommands = (p, s, r, f, a) => {
|
|
62
64
|
log('getInstallSaveExactCommands')
|
|
63
65
|
|
|
64
66
|
const c = transform(p)
|
|
65
67
|
const commands = `npm i ${c}`
|
|
66
68
|
|
|
67
69
|
return normalizeCommands(
|
|
68
|
-
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands))))
|
|
70
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, getSaveExactParameter(commands)))))
|
|
69
71
|
)
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -81,14 +83,14 @@ export const getInstallSaveExactCommands = (p, s, r, f) => {
|
|
|
81
83
|
*
|
|
82
84
|
* @return {Array}
|
|
83
85
|
*/
|
|
84
|
-
export const getInstallCommands = (p, s, r, f) => {
|
|
86
|
+
export const getInstallCommands = (p, s, r, f, a) => {
|
|
85
87
|
log('getInstallCommands')
|
|
86
88
|
|
|
87
89
|
const c = transform(p)
|
|
88
90
|
const commands = `npm i ${c}`
|
|
89
91
|
|
|
90
92
|
return normalizeCommands(
|
|
91
|
-
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, commands)))
|
|
93
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, commands))))
|
|
92
94
|
)
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -105,12 +107,12 @@ export const getInstallCommands = (p, s, r, f) => {
|
|
|
105
107
|
*
|
|
106
108
|
* @return {Promise}
|
|
107
109
|
*/
|
|
108
|
-
export function installSaveExact (d, p, s, r, f) {
|
|
110
|
+
export function installSaveExact (d, p, s, r, f, a) {
|
|
109
111
|
log('installSaveExact')
|
|
110
112
|
|
|
111
113
|
return (
|
|
112
114
|
new Promise((resolve, reject) => {
|
|
113
|
-
const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f))
|
|
115
|
+
const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f, a))
|
|
114
116
|
|
|
115
117
|
const {
|
|
116
118
|
stdout,
|
|
@@ -136,12 +138,12 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
136
138
|
*
|
|
137
139
|
* @return {Promise}
|
|
138
140
|
*/
|
|
139
|
-
export function install (d, p, s, r, f) {
|
|
141
|
+
export function install (d, p, s, r, f, a) {
|
|
140
142
|
log('install')
|
|
141
143
|
|
|
142
144
|
return (
|
|
143
145
|
new Promise((resolve, reject) => {
|
|
144
|
-
const commands = getCommands(d, getInstallCommands(p, s, r, f))
|
|
146
|
+
const commands = getCommands(d, getInstallCommands(p, s, r, f, a))
|
|
145
147
|
|
|
146
148
|
const {
|
|
147
149
|
stdout,
|
|
@@ -167,14 +169,14 @@ export function install (d, p, s, r, f) {
|
|
|
167
169
|
*
|
|
168
170
|
* @return {Promise}
|
|
169
171
|
*/
|
|
170
|
-
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false) {
|
|
172
|
+
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false, author = AUTHOR) {
|
|
171
173
|
log('execute')
|
|
172
174
|
|
|
173
175
|
const depsExact = getDepsExact(packages, configuration)
|
|
174
176
|
|
|
175
|
-
if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force)
|
|
177
|
+
if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force, author)
|
|
176
178
|
|
|
177
179
|
const deps = getDeps(packages)
|
|
178
180
|
|
|
179
|
-
if (deps.length) await install(directory, deps, save, registry, force)
|
|
181
|
+
if (deps.length) await install(directory, deps, save, registry, force, author)
|
|
180
182
|
}
|