@modernpoacher/deps 1.4.11 → 1.4.15
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 +10 -7
- package/bin/common/index.js +14 -9
- package/bin/execute/app.js +21 -18
- package/bin/install/app.js +10 -7
- package/lib/common/git/index.js +1 -1
- package/lib/common/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/install/index.js +1 -1
- package/package.json +15 -15
- package/src/common/git/index.js +3 -3
- package/src/index.js +47 -46
- package/src/install/index.js +12 -11
package/bin/app.js
CHANGED
|
@@ -65,6 +65,7 @@ async function app () {
|
|
|
65
65
|
.option('-O, --save-optional [optionalDependencies]', 'Install `optionalDependencies`', false)
|
|
66
66
|
.option('-B, --save-bundle [bundleDependencies]', 'Install `bundleDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
|
+
.option('--force [force]', 'Force installation`', false)
|
|
68
69
|
.parse(argv)
|
|
69
70
|
|
|
70
71
|
/*
|
|
@@ -94,6 +95,7 @@ async function app () {
|
|
|
94
95
|
saveDev: D,
|
|
95
96
|
saveOptional: O,
|
|
96
97
|
saveBundle: B,
|
|
98
|
+
force,
|
|
97
99
|
registry
|
|
98
100
|
} = commander.opts()
|
|
99
101
|
|
|
@@ -102,14 +104,15 @@ async function app () {
|
|
|
102
104
|
saveDev: D,
|
|
103
105
|
saveOptional: O,
|
|
104
106
|
saveBundle: B,
|
|
105
|
-
...(registry ? { registry } : {})
|
|
107
|
+
...(registry ? { registry } : {}),
|
|
108
|
+
...(force ? { force } : {})
|
|
106
109
|
})
|
|
107
110
|
|
|
108
111
|
if ((P && D) || (!P && !D && !O && !B)) {
|
|
109
112
|
log('Prod')
|
|
110
113
|
|
|
111
114
|
try {
|
|
112
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry)
|
|
115
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
113
116
|
} catch (e) {
|
|
114
117
|
handleError(e)
|
|
115
118
|
}
|
|
@@ -117,7 +120,7 @@ async function app () {
|
|
|
117
120
|
log('Dev')
|
|
118
121
|
|
|
119
122
|
try {
|
|
120
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry)
|
|
123
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
121
124
|
} catch (e) {
|
|
122
125
|
handleError(e)
|
|
123
126
|
}
|
|
@@ -126,7 +129,7 @@ async function app () {
|
|
|
126
129
|
log('Prod')
|
|
127
130
|
|
|
128
131
|
try {
|
|
129
|
-
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry)
|
|
132
|
+
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
130
133
|
} catch (e) {
|
|
131
134
|
handleError(e)
|
|
132
135
|
}
|
|
@@ -135,7 +138,7 @@ async function app () {
|
|
|
135
138
|
log('Dev')
|
|
136
139
|
|
|
137
140
|
try {
|
|
138
|
-
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry)
|
|
141
|
+
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
139
142
|
} catch (e) {
|
|
140
143
|
handleError(e)
|
|
141
144
|
}
|
|
@@ -144,7 +147,7 @@ async function app () {
|
|
|
144
147
|
log('Optional')
|
|
145
148
|
|
|
146
149
|
try {
|
|
147
|
-
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry)
|
|
150
|
+
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force)
|
|
148
151
|
} catch (e) {
|
|
149
152
|
handleError(e)
|
|
150
153
|
}
|
|
@@ -153,7 +156,7 @@ async function app () {
|
|
|
153
156
|
log('Bundle')
|
|
154
157
|
|
|
155
158
|
try {
|
|
156
|
-
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry)
|
|
159
|
+
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force)
|
|
157
160
|
} catch (e) {
|
|
158
161
|
handleError(e)
|
|
159
162
|
}
|
package/bin/common/index.js
CHANGED
|
@@ -33,7 +33,10 @@ const {
|
|
|
33
33
|
const {
|
|
34
34
|
DIRECTORY,
|
|
35
35
|
REGISTRY,
|
|
36
|
-
NVM
|
|
36
|
+
NVM,
|
|
37
|
+
|
|
38
|
+
getRegistryParameter,
|
|
39
|
+
getForceParameter
|
|
37
40
|
} = require('@modernpoacher/deps/common')
|
|
38
41
|
|
|
39
42
|
const log = debug('@modernpoacher/deps')
|
|
@@ -58,20 +61,22 @@ rm -rf node_modules package-lock.json
|
|
|
58
61
|
exit 0
|
|
59
62
|
`)
|
|
60
63
|
|
|
61
|
-
const getNpmiCommands = (directory = DIRECTORY, registry = REGISTRY) => normalise(`
|
|
64
|
+
const getNpmiCommands = (directory = DIRECTORY, registry = REGISTRY, force = false) => normalise(`
|
|
62
65
|
cd "${directory}"
|
|
63
66
|
|
|
64
67
|
. "${NVM}"
|
|
65
68
|
|
|
66
|
-
npm i
|
|
69
|
+
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
67
70
|
|
|
68
71
|
exit 0
|
|
69
72
|
`)
|
|
70
73
|
|
|
71
|
-
const getDepsCommands = (directory = DIRECTORY, registry = REGISTRY) => normalise(`
|
|
74
|
+
const getDepsCommands = (directory = DIRECTORY, registry = REGISTRY, force = false) => normalise(`
|
|
72
75
|
cd "${directory}"
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
. "${NVM}"
|
|
78
|
+
|
|
79
|
+
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
75
80
|
|
|
76
81
|
exit 0
|
|
77
82
|
`)
|
|
@@ -232,12 +237,12 @@ function rmrf (directory = DIRECTORY) {
|
|
|
232
237
|
)
|
|
233
238
|
}
|
|
234
239
|
|
|
235
|
-
function npmi (directory = DIRECTORY, registry = REGISTRY) {
|
|
240
|
+
function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
236
241
|
log('npmi')
|
|
237
242
|
|
|
238
243
|
return (
|
|
239
244
|
new Promise((resolve, reject) => {
|
|
240
|
-
const commands = getNpmiCommands(directory, registry)
|
|
245
|
+
const commands = getNpmiCommands(directory, registry, force)
|
|
241
246
|
|
|
242
247
|
const {
|
|
243
248
|
stdout,
|
|
@@ -250,12 +255,12 @@ function npmi (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
250
255
|
)
|
|
251
256
|
}
|
|
252
257
|
|
|
253
|
-
function deps (directory = DIRECTORY, registry = REGISTRY) {
|
|
258
|
+
function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
254
259
|
log('deps')
|
|
255
260
|
|
|
256
261
|
return (
|
|
257
262
|
new Promise((resolve, reject) => {
|
|
258
|
-
const commands = getDepsCommands(directory, registry)
|
|
263
|
+
const commands = getDepsCommands(directory, registry, force)
|
|
259
264
|
|
|
260
265
|
const {
|
|
261
266
|
stdout,
|
package/bin/execute/app.js
CHANGED
|
@@ -112,15 +112,15 @@ async function mapRevParse (directory) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async function iterate ([directory, ...directories] = [], registry = REGISTRY) {
|
|
115
|
+
async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false) {
|
|
116
116
|
log('iterate')
|
|
117
117
|
|
|
118
|
-
if (directory) await execute(directory, registry)
|
|
118
|
+
if (directory) await execute(directory, registry, force)
|
|
119
119
|
|
|
120
|
-
if (directories.length) await iterate(directories, registry)
|
|
120
|
+
if (directories.length) await iterate(directories, registry, force)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
async function execute (directory = DIRECTORY, registry = REGISTRY) {
|
|
123
|
+
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
124
124
|
log('execute')
|
|
125
125
|
|
|
126
126
|
try {
|
|
@@ -129,8 +129,8 @@ async function execute (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
129
129
|
await gitCheckout(directory, await catGitRefsRemotesOriginHead(directory))
|
|
130
130
|
await gitPull(directory)
|
|
131
131
|
await rmrf(directory)
|
|
132
|
-
await npmi(directory, registry)
|
|
133
|
-
await deps(directory, registry)
|
|
132
|
+
await npmi(directory, registry, force)
|
|
133
|
+
await deps(directory, registry, force)
|
|
134
134
|
await gitAdd(directory)
|
|
135
135
|
await gitCommit(directory)
|
|
136
136
|
await gitPush(directory)
|
|
@@ -139,7 +139,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
async function executeFrom (directory = DIRECTORY, registry = REGISTRY) {
|
|
142
|
+
async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
143
143
|
log('executeFrom')
|
|
144
144
|
|
|
145
145
|
const path = resolve(directory)
|
|
@@ -147,7 +147,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
147
147
|
try {
|
|
148
148
|
if (path === await gitRevParse(path)) {
|
|
149
149
|
return (
|
|
150
|
-
await execute(path, registry)
|
|
150
|
+
await execute(path, registry, force)
|
|
151
151
|
)
|
|
152
152
|
}
|
|
153
153
|
} catch (e) {
|
|
@@ -155,7 +155,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
async function executeOnly (directory = DIRECTORY, registry = REGISTRY) {
|
|
158
|
+
async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
159
159
|
log('executeOnly')
|
|
160
160
|
|
|
161
161
|
const path = resolve(directory)
|
|
@@ -163,7 +163,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
163
163
|
try {
|
|
164
164
|
if (path === await gitRevParse(path)) {
|
|
165
165
|
return (
|
|
166
|
-
await execute(path, registry)
|
|
166
|
+
await execute(path, registry, force)
|
|
167
167
|
)
|
|
168
168
|
}
|
|
169
169
|
} catch (e) {
|
|
@@ -171,7 +171,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
async function executePath (directory = DIRECTORY, registry = REGISTRY) {
|
|
174
|
+
async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
175
175
|
log('executePath')
|
|
176
176
|
|
|
177
177
|
const path = resolve(directory)
|
|
@@ -179,7 +179,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
179
179
|
try {
|
|
180
180
|
if (path === await gitRevParse(path)) {
|
|
181
181
|
return (
|
|
182
|
-
await execute(path, registry)
|
|
182
|
+
await execute(path, registry, force)
|
|
183
183
|
)
|
|
184
184
|
}
|
|
185
185
|
} catch (e) {
|
|
@@ -193,7 +193,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY) {
|
|
|
193
193
|
|
|
194
194
|
if (depsList.length) {
|
|
195
195
|
return (
|
|
196
|
-
await iterate(depsList, registry)
|
|
196
|
+
await iterate(depsList, registry, force)
|
|
197
197
|
)
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -215,27 +215,30 @@ async function app () {
|
|
|
215
215
|
.option('-f, --from [from]', 'Update from directory')
|
|
216
216
|
.option('-o, --only [only]', 'Update only directory')
|
|
217
217
|
.option('--registry [registry]', 'Installation registry')
|
|
218
|
+
.option('--force [force]', 'Force installation`', false)
|
|
218
219
|
.parse(argv)
|
|
219
220
|
|
|
220
221
|
const {
|
|
221
222
|
path: P,
|
|
222
223
|
from: F,
|
|
223
224
|
only: O,
|
|
224
|
-
registry
|
|
225
|
+
registry,
|
|
226
|
+
force
|
|
225
227
|
} = commander.opts()
|
|
226
228
|
|
|
227
229
|
log({
|
|
228
230
|
...(P ? { path: P } : {}),
|
|
229
231
|
...(F ? { from: F } : {}),
|
|
230
232
|
...(O ? { only: O } : {}),
|
|
231
|
-
...(registry ? { registry } : {})
|
|
233
|
+
...(registry ? { registry } : {}),
|
|
234
|
+
...(force ? { force } : {})
|
|
232
235
|
})
|
|
233
236
|
|
|
234
237
|
if (P || (!F && !O)) {
|
|
235
238
|
log('Path')
|
|
236
239
|
|
|
237
240
|
try {
|
|
238
|
-
await executePath(P, registry)
|
|
241
|
+
await executePath(P, registry, force)
|
|
239
242
|
} catch (e) {
|
|
240
243
|
handleError(e)
|
|
241
244
|
}
|
|
@@ -244,7 +247,7 @@ async function app () {
|
|
|
244
247
|
log('From')
|
|
245
248
|
|
|
246
249
|
try {
|
|
247
|
-
await executeFrom(P, registry)
|
|
250
|
+
await executeFrom(P, registry, force)
|
|
248
251
|
} catch (e) {
|
|
249
252
|
handleError(e)
|
|
250
253
|
}
|
|
@@ -253,7 +256,7 @@ async function app () {
|
|
|
253
256
|
log('Only')
|
|
254
257
|
|
|
255
258
|
try {
|
|
256
|
-
await executeOnly(P, registry)
|
|
259
|
+
await executeOnly(P, registry, force)
|
|
257
260
|
} catch (e) {
|
|
258
261
|
handleError(e)
|
|
259
262
|
}
|
package/bin/install/app.js
CHANGED
|
@@ -65,6 +65,7 @@ async function app () {
|
|
|
65
65
|
.option('-p, --peer [peerDependencies]', 'Install `peerDependencies`', false)
|
|
66
66
|
.option('-s, --save [save]', 'Install `peerDependencies`', false)
|
|
67
67
|
.option('--registry [registry]', 'Installation registry')
|
|
68
|
+
.option('--force [force]', 'Force installation`', false)
|
|
68
69
|
.parse(argv)
|
|
69
70
|
|
|
70
71
|
/*
|
|
@@ -96,7 +97,8 @@ async function app () {
|
|
|
96
97
|
bundle: B,
|
|
97
98
|
peer: p,
|
|
98
99
|
save,
|
|
99
|
-
registry
|
|
100
|
+
registry,
|
|
101
|
+
force
|
|
100
102
|
} = commander.opts()
|
|
101
103
|
|
|
102
104
|
log({
|
|
@@ -106,14 +108,15 @@ async function app () {
|
|
|
106
108
|
bundle: B,
|
|
107
109
|
peer: p,
|
|
108
110
|
save,
|
|
109
|
-
...(registry ? { registry } : {})
|
|
111
|
+
...(registry ? { registry } : {}),
|
|
112
|
+
...(force ? { force } : {})
|
|
110
113
|
})
|
|
111
114
|
|
|
112
115
|
if (P) {
|
|
113
116
|
log('Prod')
|
|
114
117
|
|
|
115
118
|
try {
|
|
116
|
-
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry)
|
|
119
|
+
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
|
|
117
120
|
} catch (e) {
|
|
118
121
|
handleError(e)
|
|
119
122
|
}
|
|
@@ -122,7 +125,7 @@ async function app () {
|
|
|
122
125
|
log('Dev')
|
|
123
126
|
|
|
124
127
|
try {
|
|
125
|
-
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry)
|
|
128
|
+
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
|
|
126
129
|
} catch (e) {
|
|
127
130
|
handleError(e)
|
|
128
131
|
}
|
|
@@ -131,7 +134,7 @@ async function app () {
|
|
|
131
134
|
log('Optional')
|
|
132
135
|
|
|
133
136
|
try {
|
|
134
|
-
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry)
|
|
137
|
+
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
|
|
135
138
|
} catch (e) {
|
|
136
139
|
handleError(e)
|
|
137
140
|
}
|
|
@@ -140,7 +143,7 @@ async function app () {
|
|
|
140
143
|
log('Bundle')
|
|
141
144
|
|
|
142
145
|
try {
|
|
143
|
-
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry)
|
|
146
|
+
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
|
|
144
147
|
} catch (e) {
|
|
145
148
|
handleError(e)
|
|
146
149
|
}
|
|
@@ -149,7 +152,7 @@ async function app () {
|
|
|
149
152
|
log('Peer')
|
|
150
153
|
|
|
151
154
|
try {
|
|
152
|
-
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry)
|
|
155
|
+
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
|
|
153
156
|
} catch (e) {
|
|
154
157
|
handleError(e)
|
|
155
158
|
}
|
package/lib/common/git/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.
|
|
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.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _os=require("os");var _child_process=require("child_process");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';const BRANCH='master';const ADD='package.json package-lock.json';const COMMIT=(0,_os.platform)()==='win32'?'Updated `package.json` &/ `package-lock.json`':'Updated \\`package.json\\` &/ \\`package-lock.json\\`';const OPTIONS={maxBuffer:1024*2000};const log=(0,_debug.default)('@modernpoacher/deps');log(`\`git\` (${_os.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){log(trim(v));};}function out(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function out(v){const s=v.trim();if(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(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 getCatGitRefsRemotesOriginHeadCommand(directory=DIRECTORY){log('getCatGitRefsRemotesOriginHeadCommand');return`
|
|
2
2
|
DIR=$(echo "${directory}/.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]}"
|
package/lib/common/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
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.isExact=exports.getSaveProdParameter=exports.getSaveOptionalParameter=exports.getSaveExactParameter=exports.getSaveDevParameter=exports.getSaveBundleParameter=exports.getRegistryParameter=exports.getProdDependencies=exports.getPeerDependencies=exports.getOptionalDependencies=exports.getNoSaveParameter=exports.getDevDependencies=void 0;exports.normalise=normalise;exports.transform=transform;exports.transformDependency=void 0;var _debug=_interopRequireDefault(require("debug"));var _os=require("os");var _path=require("path");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`common\` (${_os.platform}) is awake`);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 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 getNoSaveParameter=(s,commands)=>s?commands:commands.concat(' --no-save');exports.getNoSaveParameter=getNoSaveParameter;const getSaveExactParameter=commands=>commands.concat(' --save-exact');exports.getSaveExactParameter=getSaveExactParameter;const getCommands=(directory=DIRECTORY,commands='npm i')=>`
|
|
2
2
|
export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
3
3
|
|
|
4
4
|
cd "${directory}"
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
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 _os=require("os");var _child_process=require("child_process");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_os.platform}) is awake`);const getInstallSaveExactCommands=(p,c,r,f)=>{log('getInstallSaveExactCommands');const commands=`npm i ${(0,_common.transform)(p,c)}`;return(0,_common.normalise)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,c,r,f)=>{log('getInstallCommands');const commands=`npm i ${(0,_common.transform)(p,c)}`;return(0,_common.normalise)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands)));};exports.getInstallCommands=getInstallCommands;function getInstallSaveBundleSaveExactCommands(p,c,r,f){log('getInstallSaveBundleSaveExactCommands');const commands=getInstallSaveExactCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,c,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,c,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,c,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,c,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,c,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,c,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,c,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,c,r,f);return(0,_common.normalise)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,c,r,f){log('installSaveBundleSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveBundleSaveExactCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveBundle(d,p,c,r,f){log('installSaveBundle');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptionalSaveExact(d,p,c,r,f){log('installSaveOptionalSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveOptionalSaveExactCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptional(d,p,c,r,f){log('installSaveOptional');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDevSaveExact(d,p,c,r,f){log('installSaveDevSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveDevSaveExactCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDev(d,p,c,r,f){log('installSaveDev');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProdSaveExact(d,p,c,r,f){log('installSaveProdSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveProdSaveExactCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProd(d,p,c,r,f){log('installSaveProd');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,c,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const depsSaveExact=(0,_common.getDepsExact)(packages,configuration);if(depsSaveExact.length)await installSaveBundleSaveExact(directory,depsSaveExact,configuration,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveBundle(directory,deps,configuration,registry,force);}async function executeOptional(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeOptional');const depsSaveExact=(0,_common.getDepsExact)(packages,configuration);if(depsSaveExact.length)await installSaveOptionalSaveExact(directory,depsSaveExact,configuration,registry);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,configuration,registry);}async function executeDev(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeDev');const depsSaveExact=(0,_common.getDepsExact)(packages,configuration);if(depsSaveExact.length)await installSaveDevSaveExact(directory,depsSaveExact,configuration,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveDev(directory,deps,configuration,registry,force);}async function executeProd(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeProd');const depsSaveExact=(0,_common.getDepsExact)(packages,configuration);if(depsSaveExact.length)await installSaveProdSaveExact(directory,depsSaveExact,configuration,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveProd(directory,deps,configuration,registry,force);}
|
package/lib/install/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.
|
|
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 _os=require("os");var _child_process=require("child_process");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 getInstallSaveExactCommands=(p,c,s,r,f)=>{log('getInstallSaveExactCommands');const commands=`npm i ${(0,_common.transform)(p,c)}`;return(0,_common.normalise)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands)))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,c,s,r,f)=>{log('getInstallCommands');const commands=`npm i ${(0,_common.transform)(p,c)}`;return(0,_common.normalise)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands))));};exports.getInstallCommands=getInstallCommands;function installSaveExact(d,p,c,s,r,f){log('installSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveExactCommands(p,c,s,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function install(d,p,c,s,r,f){log('install');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallCommands(p,c,s,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}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,configuration,save,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await install(directory,deps,configuration,save,registry,force);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.15",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"author": "Jonathan Perry for Modern Poacher Limited <modernpoacher@modernpoacher.com>",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=16.13.0"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -50,30 +50,30 @@
|
|
|
50
50
|
"deps-head": "bin/head.sh"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"commander": "^8.
|
|
53
|
+
"commander": "^8.3.0",
|
|
54
54
|
"debug": "^4.3.2",
|
|
55
55
|
"glob-all": "^3.2.1",
|
|
56
56
|
"module-alias": "^2.2.2",
|
|
57
|
-
"supports-color": "^9.0
|
|
57
|
+
"supports-color": "^9.1.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.
|
|
61
|
-
"@babel/core": "^7.
|
|
62
|
-
"@babel/eslint-parser": "^7.
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
64
|
-
"@babel/register": "^7.
|
|
60
|
+
"@babel/cli": "^7.16.0",
|
|
61
|
+
"@babel/core": "^7.16.0",
|
|
62
|
+
"@babel/eslint-parser": "^7.16.3",
|
|
63
|
+
"@babel/preset-env": "^7.16.4",
|
|
64
|
+
"@babel/register": "^7.16.0",
|
|
65
65
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
66
66
|
"chai": "^4.3.4",
|
|
67
|
-
"core-js": "^3.
|
|
67
|
+
"core-js": "^3.19.1",
|
|
68
68
|
"cross-env": "^7.0.3",
|
|
69
|
-
"eslint": "
|
|
69
|
+
"eslint": "7.32.0",
|
|
70
70
|
"eslint-config-standard": "^16.0.3",
|
|
71
71
|
"eslint-import-resolver-babel-module": "^5.3.1",
|
|
72
|
-
"eslint-plugin-import": "^2.
|
|
72
|
+
"eslint-plugin-import": "^2.25.3",
|
|
73
73
|
"eslint-plugin-node": "^11.1.0",
|
|
74
|
-
"eslint-plugin-promise": "^5.1.
|
|
75
|
-
"husky": "^7.0.
|
|
76
|
-
"mocha": "^9.1.
|
|
74
|
+
"eslint-plugin-promise": "^5.1.1",
|
|
75
|
+
"husky": "^7.0.4",
|
|
76
|
+
"mocha": "^9.1.3",
|
|
77
77
|
"rimraf": "^3.0.2"
|
|
78
78
|
},
|
|
79
79
|
"_moduleAliases": {
|
package/src/common/git/index.js
CHANGED
|
@@ -14,9 +14,9 @@ const BRANCH = 'master'
|
|
|
14
14
|
|
|
15
15
|
const ADD = 'package.json package-lock.json'
|
|
16
16
|
|
|
17
|
-
const COMMIT = platform
|
|
18
|
-
? 'Updated
|
|
19
|
-
: 'Updated
|
|
17
|
+
const COMMIT = platform() === 'win32'
|
|
18
|
+
? 'Updated `package.json` &/ `package-lock.json`'
|
|
19
|
+
: 'Updated \\`package.json\\` &/ \\`package-lock.json\\`' /* eslint-disable-line no-useless-escape */
|
|
20
20
|
|
|
21
21
|
const OPTIONS = {
|
|
22
22
|
maxBuffer: 1024 * 2000
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
DIRECTORY,
|
|
13
13
|
REGISTRY,
|
|
14
14
|
getRegistryParameter,
|
|
15
|
+
getForceParameter,
|
|
15
16
|
getSaveExactParameter,
|
|
16
17
|
getSaveBundleParameter,
|
|
17
18
|
getSaveOptionalParameter,
|
|
@@ -40,13 +41,13 @@ log(`\`deps\` (${platform}) is awake`)
|
|
|
40
41
|
*
|
|
41
42
|
* @return {Array}
|
|
42
43
|
*/
|
|
43
|
-
export const getInstallSaveExactCommands = (p, c, r) => {
|
|
44
|
+
export const getInstallSaveExactCommands = (p, c, r, f) => {
|
|
44
45
|
log('getInstallSaveExactCommands')
|
|
45
46
|
|
|
46
47
|
const commands = `npm i ${transform(p, c)}`
|
|
47
48
|
|
|
48
49
|
return normalise(
|
|
49
|
-
getRegistryParameter(r, getSaveExactParameter(commands))
|
|
50
|
+
getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands)))
|
|
50
51
|
)
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -62,13 +63,13 @@ export const getInstallSaveExactCommands = (p, c, r) => {
|
|
|
62
63
|
*
|
|
63
64
|
* @return {Array}
|
|
64
65
|
*/
|
|
65
|
-
export const getInstallCommands = (p, c, r) => {
|
|
66
|
+
export const getInstallCommands = (p, c, r, f) => {
|
|
66
67
|
log('getInstallCommands')
|
|
67
68
|
|
|
68
69
|
const commands = `npm i ${transform(p, c)}`
|
|
69
70
|
|
|
70
71
|
return normalise(
|
|
71
|
-
getRegistryParameter(r, commands)
|
|
72
|
+
getRegistryParameter(r, getForceParameter(f, commands))
|
|
72
73
|
)
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -84,10 +85,10 @@ export const getInstallCommands = (p, c, r) => {
|
|
|
84
85
|
*
|
|
85
86
|
* @return {Array}
|
|
86
87
|
*/
|
|
87
|
-
export function getInstallSaveBundleSaveExactCommands (p, c, r) {
|
|
88
|
+
export function getInstallSaveBundleSaveExactCommands (p, c, r, f) {
|
|
88
89
|
log('getInstallSaveBundleSaveExactCommands')
|
|
89
90
|
|
|
90
|
-
const commands = getInstallSaveExactCommands(p, c, r)
|
|
91
|
+
const commands = getInstallSaveExactCommands(p, c, r, f)
|
|
91
92
|
|
|
92
93
|
return normalise(
|
|
93
94
|
getSaveBundleParameter(commands)
|
|
@@ -106,10 +107,10 @@ export function getInstallSaveBundleSaveExactCommands (p, c, r) {
|
|
|
106
107
|
*
|
|
107
108
|
* @return {Array}
|
|
108
109
|
*/
|
|
109
|
-
export function getInstallSaveBundleCommands (p, c, r) {
|
|
110
|
+
export function getInstallSaveBundleCommands (p, c, r, f) {
|
|
110
111
|
log('getInstallSaveBundleCommands')
|
|
111
112
|
|
|
112
|
-
const commands = getInstallCommands(p, c, r)
|
|
113
|
+
const commands = getInstallCommands(p, c, r, f)
|
|
113
114
|
|
|
114
115
|
return normalise(
|
|
115
116
|
getSaveBundleParameter(commands)
|
|
@@ -128,10 +129,10 @@ export function getInstallSaveBundleCommands (p, c, r) {
|
|
|
128
129
|
*
|
|
129
130
|
* @return {Array}
|
|
130
131
|
*/
|
|
131
|
-
export function getInstallSaveOptionalSaveExactCommands (p, c, r) {
|
|
132
|
+
export function getInstallSaveOptionalSaveExactCommands (p, c, r, f) {
|
|
132
133
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
133
134
|
|
|
134
|
-
const commands = getInstallSaveExactCommands(p, c, r)
|
|
135
|
+
const commands = getInstallSaveExactCommands(p, c, r, f)
|
|
135
136
|
|
|
136
137
|
return normalise(
|
|
137
138
|
getSaveOptionalParameter(commands)
|
|
@@ -150,10 +151,10 @@ export function getInstallSaveOptionalSaveExactCommands (p, c, r) {
|
|
|
150
151
|
*
|
|
151
152
|
* @return {Array}
|
|
152
153
|
*/
|
|
153
|
-
export function getInstallSaveOptionalCommands (p, c, r) {
|
|
154
|
+
export function getInstallSaveOptionalCommands (p, c, r, f) {
|
|
154
155
|
log('getInstallSaveOptionalCommands')
|
|
155
156
|
|
|
156
|
-
const commands = getInstallCommands(p, c, r)
|
|
157
|
+
const commands = getInstallCommands(p, c, r, f)
|
|
157
158
|
|
|
158
159
|
return normalise(
|
|
159
160
|
getSaveOptionalParameter(commands)
|
|
@@ -172,10 +173,10 @@ export function getInstallSaveOptionalCommands (p, c, r) {
|
|
|
172
173
|
*
|
|
173
174
|
* @return {Array}
|
|
174
175
|
*/
|
|
175
|
-
export function getInstallSaveDevSaveExactCommands (p, c, r) {
|
|
176
|
+
export function getInstallSaveDevSaveExactCommands (p, c, r, f) {
|
|
176
177
|
log('getInstallSaveDevSaveExactCommands')
|
|
177
178
|
|
|
178
|
-
const commands = getInstallSaveExactCommands(p, c, r)
|
|
179
|
+
const commands = getInstallSaveExactCommands(p, c, r, f)
|
|
179
180
|
|
|
180
181
|
return normalise(
|
|
181
182
|
getSaveDevParameter(commands)
|
|
@@ -194,10 +195,10 @@ export function getInstallSaveDevSaveExactCommands (p, c, r) {
|
|
|
194
195
|
*
|
|
195
196
|
* @return {Array}
|
|
196
197
|
*/
|
|
197
|
-
export function getInstallSaveDevCommands (p, c, r) {
|
|
198
|
+
export function getInstallSaveDevCommands (p, c, r, f) {
|
|
198
199
|
log('getInstallSaveDevCommands')
|
|
199
200
|
|
|
200
|
-
const commands = getInstallCommands(p, c, r)
|
|
201
|
+
const commands = getInstallCommands(p, c, r, f)
|
|
201
202
|
|
|
202
203
|
return normalise(
|
|
203
204
|
getSaveDevParameter(commands)
|
|
@@ -216,10 +217,10 @@ export function getInstallSaveDevCommands (p, c, r) {
|
|
|
216
217
|
*
|
|
217
218
|
* @return {Array}
|
|
218
219
|
*/
|
|
219
|
-
export function getInstallSaveProdSaveExactCommands (p, c, r) {
|
|
220
|
+
export function getInstallSaveProdSaveExactCommands (p, c, r, f) {
|
|
220
221
|
log('getInstallSaveProdSaveExactCommands')
|
|
221
222
|
|
|
222
|
-
const commands = getInstallSaveExactCommands(p, c, r)
|
|
223
|
+
const commands = getInstallSaveExactCommands(p, c, r, f)
|
|
223
224
|
|
|
224
225
|
return normalise(
|
|
225
226
|
getSaveProdParameter(commands)
|
|
@@ -238,10 +239,10 @@ export function getInstallSaveProdSaveExactCommands (p, c, r) {
|
|
|
238
239
|
*
|
|
239
240
|
* @return {Array}
|
|
240
241
|
*/
|
|
241
|
-
export function getInstallSaveProdCommands (p, c, r) {
|
|
242
|
+
export function getInstallSaveProdCommands (p, c, r, f) {
|
|
242
243
|
log('getInstallSaveProdCommands')
|
|
243
244
|
|
|
244
|
-
const commands = getInstallCommands(p, c, r)
|
|
245
|
+
const commands = getInstallCommands(p, c, r, f)
|
|
245
246
|
|
|
246
247
|
return normalise(
|
|
247
248
|
getSaveProdParameter(commands)
|
|
@@ -260,12 +261,12 @@ export function getInstallSaveProdCommands (p, c, r) {
|
|
|
260
261
|
*
|
|
261
262
|
* @return {Promise}
|
|
262
263
|
*/
|
|
263
|
-
export function installSaveBundleSaveExact (d, p, c, r) {
|
|
264
|
+
export function installSaveBundleSaveExact (d, p, c, r, f) {
|
|
264
265
|
log('installSaveBundleSaveExact')
|
|
265
266
|
|
|
266
267
|
return (
|
|
267
268
|
new Promise((resolve, reject) => {
|
|
268
|
-
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, c, r))
|
|
269
|
+
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, c, r, f))
|
|
269
270
|
|
|
270
271
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
271
272
|
.on('close', resolve)
|
|
@@ -286,12 +287,12 @@ export function installSaveBundleSaveExact (d, p, c, r) {
|
|
|
286
287
|
*
|
|
287
288
|
* @return {Promise}
|
|
288
289
|
*/
|
|
289
|
-
export function installSaveBundle (d, p, c, r) {
|
|
290
|
+
export function installSaveBundle (d, p, c, r, f) {
|
|
290
291
|
log('installSaveBundle')
|
|
291
292
|
|
|
292
293
|
return (
|
|
293
294
|
new Promise((resolve, reject) => {
|
|
294
|
-
const commands = getCommands(d, getInstallSaveBundleCommands(p, c, r))
|
|
295
|
+
const commands = getCommands(d, getInstallSaveBundleCommands(p, c, r, f))
|
|
295
296
|
|
|
296
297
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
297
298
|
.on('close', resolve)
|
|
@@ -312,12 +313,12 @@ export function installSaveBundle (d, p, c, r) {
|
|
|
312
313
|
*
|
|
313
314
|
* @return {Promise}
|
|
314
315
|
*/
|
|
315
|
-
export function installSaveOptionalSaveExact (d, p, c, r) {
|
|
316
|
+
export function installSaveOptionalSaveExact (d, p, c, r, f) {
|
|
316
317
|
log('installSaveOptionalSaveExact')
|
|
317
318
|
|
|
318
319
|
return (
|
|
319
320
|
new Promise((resolve, reject) => {
|
|
320
|
-
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, c, r))
|
|
321
|
+
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, c, r, f))
|
|
321
322
|
|
|
322
323
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
323
324
|
.on('close', resolve)
|
|
@@ -338,12 +339,12 @@ export function installSaveOptionalSaveExact (d, p, c, r) {
|
|
|
338
339
|
*
|
|
339
340
|
* @return {Promise}
|
|
340
341
|
*/
|
|
341
|
-
export function installSaveOptional (d, p, c, r) {
|
|
342
|
+
export function installSaveOptional (d, p, c, r, f) {
|
|
342
343
|
log('installSaveOptional')
|
|
343
344
|
|
|
344
345
|
return (
|
|
345
346
|
new Promise((resolve, reject) => {
|
|
346
|
-
const commands = getCommands(d, getInstallSaveOptionalCommands(p, c, r))
|
|
347
|
+
const commands = getCommands(d, getInstallSaveOptionalCommands(p, c, r, f))
|
|
347
348
|
|
|
348
349
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
349
350
|
.on('close', resolve)
|
|
@@ -364,12 +365,12 @@ export function installSaveOptional (d, p, c, r) {
|
|
|
364
365
|
*
|
|
365
366
|
* @return {Promise}
|
|
366
367
|
*/
|
|
367
|
-
export function installSaveDevSaveExact (d, p, c, r) {
|
|
368
|
+
export function installSaveDevSaveExact (d, p, c, r, f) {
|
|
368
369
|
log('installSaveDevSaveExact')
|
|
369
370
|
|
|
370
371
|
return (
|
|
371
372
|
new Promise((resolve, reject) => {
|
|
372
|
-
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, c, r))
|
|
373
|
+
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, c, r, f))
|
|
373
374
|
|
|
374
375
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
375
376
|
.on('close', resolve)
|
|
@@ -390,12 +391,12 @@ export function installSaveDevSaveExact (d, p, c, r) {
|
|
|
390
391
|
*
|
|
391
392
|
* @return {Promise}
|
|
392
393
|
*/
|
|
393
|
-
export function installSaveDev (d, p, c, r) {
|
|
394
|
+
export function installSaveDev (d, p, c, r, f) {
|
|
394
395
|
log('installSaveDev')
|
|
395
396
|
|
|
396
397
|
return (
|
|
397
398
|
new Promise((resolve, reject) => {
|
|
398
|
-
const commands = getCommands(d, getInstallSaveDevCommands(p, c, r))
|
|
399
|
+
const commands = getCommands(d, getInstallSaveDevCommands(p, c, r, f))
|
|
399
400
|
|
|
400
401
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
401
402
|
.on('close', resolve)
|
|
@@ -416,12 +417,12 @@ export function installSaveDev (d, p, c, r) {
|
|
|
416
417
|
*
|
|
417
418
|
* @return {Promise}
|
|
418
419
|
*/
|
|
419
|
-
export function installSaveProdSaveExact (d, p, c, r) {
|
|
420
|
+
export function installSaveProdSaveExact (d, p, c, r, f) {
|
|
420
421
|
log('installSaveProdSaveExact')
|
|
421
422
|
|
|
422
423
|
return (
|
|
423
424
|
new Promise((resolve, reject) => {
|
|
424
|
-
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, c, r))
|
|
425
|
+
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, c, r, f))
|
|
425
426
|
|
|
426
427
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
427
428
|
.on('close', resolve)
|
|
@@ -442,12 +443,12 @@ export function installSaveProdSaveExact (d, p, c, r) {
|
|
|
442
443
|
*
|
|
443
444
|
* @return {Promise}
|
|
444
445
|
*/
|
|
445
|
-
export function installSaveProd (d, p, c, r) {
|
|
446
|
+
export function installSaveProd (d, p, c, r, f) {
|
|
446
447
|
log('installSaveProd')
|
|
447
448
|
|
|
448
449
|
return (
|
|
449
450
|
new Promise((resolve, reject) => {
|
|
450
|
-
const commands = getCommands(d, getInstallSaveProdCommands(p, c, r))
|
|
451
|
+
const commands = getCommands(d, getInstallSaveProdCommands(p, c, r, f))
|
|
451
452
|
|
|
452
453
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
453
454
|
.on('close', resolve)
|
|
@@ -469,16 +470,16 @@ export function installSaveProd (d, p, c, r) {
|
|
|
469
470
|
*
|
|
470
471
|
* @return {Promise}
|
|
471
472
|
*/
|
|
472
|
-
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
473
|
+
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
473
474
|
log('executeBundle')
|
|
474
475
|
|
|
475
476
|
const depsSaveExact = getDepsExact(packages, configuration)
|
|
476
477
|
|
|
477
|
-
if (depsSaveExact.length) await installSaveBundleSaveExact(directory, depsSaveExact, configuration, registry)
|
|
478
|
+
if (depsSaveExact.length) await installSaveBundleSaveExact(directory, depsSaveExact, configuration, registry, force)
|
|
478
479
|
|
|
479
480
|
const deps = getDeps(packages)
|
|
480
481
|
|
|
481
|
-
if (deps.length) await installSaveBundle(directory, deps, configuration, registry)
|
|
482
|
+
if (deps.length) await installSaveBundle(directory, deps, configuration, registry, force)
|
|
482
483
|
}
|
|
483
484
|
|
|
484
485
|
/**
|
|
@@ -494,7 +495,7 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
|
|
|
494
495
|
*
|
|
495
496
|
* @return {Promise}
|
|
496
497
|
*/
|
|
497
|
-
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
498
|
+
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
498
499
|
log('executeOptional')
|
|
499
500
|
|
|
500
501
|
const depsSaveExact = getDepsExact(packages, configuration)
|
|
@@ -519,16 +520,16 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
|
|
|
519
520
|
*
|
|
520
521
|
* @return {Promise}
|
|
521
522
|
*/
|
|
522
|
-
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
523
|
+
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
523
524
|
log('executeDev')
|
|
524
525
|
|
|
525
526
|
const depsSaveExact = getDepsExact(packages, configuration)
|
|
526
527
|
|
|
527
|
-
if (depsSaveExact.length) await installSaveDevSaveExact(directory, depsSaveExact, configuration, registry)
|
|
528
|
+
if (depsSaveExact.length) await installSaveDevSaveExact(directory, depsSaveExact, configuration, registry, force)
|
|
528
529
|
|
|
529
530
|
const deps = getDeps(packages)
|
|
530
531
|
|
|
531
|
-
if (deps.length) await installSaveDev(directory, deps, configuration, registry)
|
|
532
|
+
if (deps.length) await installSaveDev(directory, deps, configuration, registry, force)
|
|
532
533
|
}
|
|
533
534
|
|
|
534
535
|
/**
|
|
@@ -544,14 +545,14 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
|
|
|
544
545
|
*
|
|
545
546
|
* @return {Promise}
|
|
546
547
|
*/
|
|
547
|
-
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
548
|
+
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
548
549
|
log('executeProd')
|
|
549
550
|
|
|
550
551
|
const depsSaveExact = getDepsExact(packages, configuration)
|
|
551
552
|
|
|
552
|
-
if (depsSaveExact.length) await installSaveProdSaveExact(directory, depsSaveExact, configuration, registry)
|
|
553
|
+
if (depsSaveExact.length) await installSaveProdSaveExact(directory, depsSaveExact, configuration, registry, force)
|
|
553
554
|
|
|
554
555
|
const deps = getDeps(packages)
|
|
555
556
|
|
|
556
|
-
if (deps.length) await installSaveProd(directory, deps, configuration, registry)
|
|
557
|
+
if (deps.length) await installSaveProd(directory, deps, configuration, registry, force)
|
|
557
558
|
}
|
package/src/install/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
REGISTRY,
|
|
14
14
|
getNoSaveParameter,
|
|
15
15
|
getRegistryParameter,
|
|
16
|
+
getForceParameter,
|
|
16
17
|
getSaveExactParameter,
|
|
17
18
|
getCommands,
|
|
18
19
|
normalise,
|
|
@@ -38,13 +39,13 @@ log(`\`install\` (${platform}) is awake`)
|
|
|
38
39
|
*
|
|
39
40
|
* @return {Array}
|
|
40
41
|
*/
|
|
41
|
-
export const getInstallSaveExactCommands = (p, c, s, r) => {
|
|
42
|
+
export const getInstallSaveExactCommands = (p, c, s, r, f) => {
|
|
42
43
|
log('getInstallSaveExactCommands')
|
|
43
44
|
|
|
44
45
|
const commands = `npm i ${transform(p, c)}`
|
|
45
46
|
|
|
46
47
|
return normalise(
|
|
47
|
-
getNoSaveParameter(s, getRegistryParameter(r, getSaveExactParameter(commands)))
|
|
48
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands))))
|
|
48
49
|
)
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -61,13 +62,13 @@ export const getInstallSaveExactCommands = (p, c, s, r) => {
|
|
|
61
62
|
*
|
|
62
63
|
* @return {Array}
|
|
63
64
|
*/
|
|
64
|
-
export const getInstallCommands = (p, c, s, r) => {
|
|
65
|
+
export const getInstallCommands = (p, c, s, r, f) => {
|
|
65
66
|
log('getInstallCommands')
|
|
66
67
|
|
|
67
68
|
const commands = `npm i ${transform(p, c)}`
|
|
68
69
|
|
|
69
70
|
return normalise(
|
|
70
|
-
getNoSaveParameter(s, getRegistryParameter(r, commands))
|
|
71
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, commands)))
|
|
71
72
|
)
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -84,12 +85,12 @@ export const getInstallCommands = (p, c, s, r) => {
|
|
|
84
85
|
*
|
|
85
86
|
* @return {Promise}
|
|
86
87
|
*/
|
|
87
|
-
export function installSaveExact (d, p, c, s, r) {
|
|
88
|
+
export function installSaveExact (d, p, c, s, r, f) {
|
|
88
89
|
log('installSaveExact')
|
|
89
90
|
|
|
90
91
|
return (
|
|
91
92
|
new Promise((resolve, reject) => {
|
|
92
|
-
const commands = getCommands(d, getInstallSaveExactCommands(p, c, s, r))
|
|
93
|
+
const commands = getCommands(d, getInstallSaveExactCommands(p, c, s, r, f))
|
|
93
94
|
|
|
94
95
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
95
96
|
.on('close', resolve)
|
|
@@ -111,12 +112,12 @@ export function installSaveExact (d, p, c, s, r) {
|
|
|
111
112
|
*
|
|
112
113
|
* @return {Promise}
|
|
113
114
|
*/
|
|
114
|
-
export function install (d, p, c, s, r) {
|
|
115
|
+
export function install (d, p, c, s, r, f) {
|
|
115
116
|
log('install')
|
|
116
117
|
|
|
117
118
|
return (
|
|
118
119
|
new Promise((resolve, reject) => {
|
|
119
|
-
const commands = getCommands(d, getInstallCommands(p, c, s, r))
|
|
120
|
+
const commands = getCommands(d, getInstallCommands(p, c, s, r, f))
|
|
120
121
|
|
|
121
122
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
122
123
|
.on('close', resolve)
|
|
@@ -138,14 +139,14 @@ export function install (d, p, c, s, r) {
|
|
|
138
139
|
*
|
|
139
140
|
* @return {Promise}
|
|
140
141
|
*/
|
|
141
|
-
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY) {
|
|
142
|
+
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false) {
|
|
142
143
|
log('execute')
|
|
143
144
|
|
|
144
145
|
const depsExact = getDepsExact(packages, configuration)
|
|
145
146
|
|
|
146
|
-
if (depsExact.length) await installSaveExact(directory, depsExact, configuration, save, registry)
|
|
147
|
+
if (depsExact.length) await installSaveExact(directory, depsExact, configuration, save, registry, force)
|
|
147
148
|
|
|
148
149
|
const deps = getDeps(packages)
|
|
149
150
|
|
|
150
|
-
if (deps.length) await install(directory, deps, configuration, save, registry)
|
|
151
|
+
if (deps.length) await install(directory, deps, configuration, save, registry, force)
|
|
151
152
|
}
|