@modernpoacher/deps 2.0.16 → 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.
@@ -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 {Object} p - Packages
52
- * @param {Boolean} s - Save
53
- * @param {String} r - Registry
54
- * @param {Boolean} f - Force
61
+ * @param {Package} p - Package
62
+ * @param {boolean} s - Save
63
+ * @param {string} r - Registry
64
+ * @param {boolean} f - Force
55
65
  *
56
- * @return {Array}
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 {Object} p - Packages
75
- * @param {Boolean} s - Save
76
- * @param {String} r - Registry
77
- * @param {Boolean} f - Force
84
+ * @param {Package} p - Package
85
+ * @param {boolean} s - Save
86
+ * @param {string} r - Registry
87
+ * @param {boolean} f - Force
78
88
  *
79
- * @return {Array}
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 {String} d - Directory
98
- * @param {Object} p - Packages
99
- * @param {Object} c - Configuration
100
- * @param {Boolean} s - Save
101
- * @param {String} r - Registry
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 D = normalize(d)
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: D }, (e, v) => (!e) ? resolve(v) : reject(e))
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 {String} d - Directory
130
- * @param {Object} p - Packages
131
- * @param {Object} c - Configuration
132
- * @param {Boolean} s - Save
133
- * @param {String} r - Registry
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 D = normalize(d)
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: D }, (e, v) => (!e) ? resolve(v) : reject(e))
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 {String} d - Directory
162
- * @param {Object} p - Packages
163
- * @param {Object} c - Configuration
164
- * @param {Boolean} s - Save
165
- * @param {String} r - Registry
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
  */