@modernpoacher/deps 2.0.15 → 2.0.17
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/deps.sh +2 -2
- package/bin/push.sh +2 -2
- package/bin/wipe.sh +2 -2
- package/package.json +6 -6
- package/src/common/git/index.mjs +42 -47
- package/src/common/index.mjs +104 -74
- package/src/index.mjs +198 -164
- package/src/install/index.mjs +47 -31
package/src/install/index.mjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A package
|
|
3
|
+
* @typedef {import('../common/index.mjs').Package} Package
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A configuration
|
|
8
|
+
* @typedef {import('../common/index.mjs').Configuration} Configuration
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import debug from 'debug'
|
|
2
12
|
|
|
3
13
|
import {
|
|
@@ -48,12 +58,12 @@ const OPTIONS = {
|
|
|
48
58
|
*
|
|
49
59
|
* Get the `install --save-exact` commands as a string of parameters and arguments
|
|
50
60
|
*
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
61
|
+
* @param {Package} p - Package
|
|
62
|
+
* @param {boolean} s - Save
|
|
63
|
+
* @param {string} r - Registry
|
|
64
|
+
* @param {boolean} f - Force
|
|
55
65
|
*
|
|
56
|
-
* @return {
|
|
66
|
+
* @return {string}
|
|
57
67
|
*/
|
|
58
68
|
export function getInstallSaveExactCommands (p, s, r, f) {
|
|
59
69
|
log('getInstallSaveExactCommands')
|
|
@@ -71,12 +81,12 @@ export function getInstallSaveExactCommands (p, s, r, f) {
|
|
|
71
81
|
*
|
|
72
82
|
* Get the `install` commands as a string of parameters and arguments
|
|
73
83
|
*
|
|
74
|
-
* @param {
|
|
75
|
-
* @param {
|
|
76
|
-
* @param {
|
|
77
|
-
* @param {
|
|
84
|
+
* @param {Package} p - Package
|
|
85
|
+
* @param {boolean} s - Save
|
|
86
|
+
* @param {string} r - Registry
|
|
87
|
+
* @param {boolean} f - Force
|
|
78
88
|
*
|
|
79
|
-
* @return {
|
|
89
|
+
* @return {string}
|
|
80
90
|
*/
|
|
81
91
|
export function getInstallCommands (p, s, r, f) {
|
|
82
92
|
log('getInstallCommands')
|
|
@@ -94,26 +104,29 @@ export function getInstallCommands (p, s, r, f) {
|
|
|
94
104
|
*
|
|
95
105
|
* Spawn the `install --save-exact` commands
|
|
96
106
|
*
|
|
97
|
-
* @param {
|
|
98
|
-
* @param {
|
|
99
|
-
* @param {
|
|
100
|
-
* @param {
|
|
101
|
-
* @param {
|
|
107
|
+
* @param {string} d - Directory
|
|
108
|
+
* @param {Package} p - Package
|
|
109
|
+
* @param {Configuration} c - Configuration
|
|
110
|
+
* @param {boolean} s - Save
|
|
111
|
+
* @param {string} r - Registry
|
|
102
112
|
*
|
|
103
113
|
* @return {Promise}
|
|
104
114
|
*/
|
|
105
115
|
export function installSaveExact (d, p, s, r, f) {
|
|
106
116
|
log('installSaveExact')
|
|
107
117
|
|
|
118
|
+
const directory = normalize(d)
|
|
119
|
+
|
|
120
|
+
log(`Directory is "${directory}"`)
|
|
121
|
+
|
|
108
122
|
return (
|
|
109
123
|
new Promise((resolve, reject) => {
|
|
110
|
-
const
|
|
111
|
-
const commands = getCommands(D, getInstallSaveExactCommands(p, s, r, f))
|
|
124
|
+
const commands = getCommands(getInstallSaveExactCommands(p, s, r, f))
|
|
112
125
|
|
|
113
126
|
const {
|
|
114
127
|
stdout,
|
|
115
128
|
stderr
|
|
116
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
129
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
117
130
|
|
|
118
131
|
stdout.on('data', log)
|
|
119
132
|
stderr.on('data', log)
|
|
@@ -126,26 +139,29 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
126
139
|
*
|
|
127
140
|
* Spawn the `install` commands
|
|
128
141
|
*
|
|
129
|
-
* @param {
|
|
130
|
-
* @param {
|
|
131
|
-
* @param {
|
|
132
|
-
* @param {
|
|
133
|
-
* @param {
|
|
142
|
+
* @param {string} d - Directory
|
|
143
|
+
* @param {Package} p - Package
|
|
144
|
+
* @param {Configuration} c - Configuration
|
|
145
|
+
* @param {boolean} s - Save
|
|
146
|
+
* @param {string} r - Registry
|
|
134
147
|
*
|
|
135
148
|
* @return {Promise}
|
|
136
149
|
*/
|
|
137
150
|
export function install (d, p, s, r, f) {
|
|
138
151
|
log('install')
|
|
139
152
|
|
|
153
|
+
const directory = normalize(d)
|
|
154
|
+
|
|
155
|
+
log(`Directory is "${directory}"`)
|
|
156
|
+
|
|
140
157
|
return (
|
|
141
158
|
new Promise((resolve, reject) => {
|
|
142
|
-
const
|
|
143
|
-
const commands = getCommands(D, getInstallCommands(p, s, r, f))
|
|
159
|
+
const commands = getCommands(getInstallCommands(p, s, r, f))
|
|
144
160
|
|
|
145
161
|
const {
|
|
146
162
|
stdout,
|
|
147
163
|
stderr
|
|
148
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
164
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
149
165
|
|
|
150
166
|
stdout.on('data', log)
|
|
151
167
|
stderr.on('data', log)
|
|
@@ -158,11 +174,11 @@ export function install (d, p, s, r, f) {
|
|
|
158
174
|
*
|
|
159
175
|
* Execute the `install --save-exact` and `install` commands according to configuration and parameters
|
|
160
176
|
*
|
|
161
|
-
* @param {
|
|
162
|
-
* @param {
|
|
163
|
-
* @param {
|
|
164
|
-
* @param {
|
|
165
|
-
* @param {
|
|
177
|
+
* @param {string} d - Directory
|
|
178
|
+
* @param {Package} p - Package
|
|
179
|
+
* @param {Configuration} c - Configuration
|
|
180
|
+
* @param {boolean} s - Save
|
|
181
|
+
* @param {string} r - Registry
|
|
166
182
|
*
|
|
167
183
|
* @return {Promise}
|
|
168
184
|
*/
|