@modernpoacher/deps 1.6.13 → 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 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
  }
@@ -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')
@@ -49,9 +52,10 @@ const OPTIONS = {
49
52
  shell: true,
50
53
  stdio: 'inherit',
51
54
  env: {
55
+ DEBUG_COLORS: 'yes',
52
56
  FORCE_COLOR: PLATFORM === 'win32'
53
- ? 2
54
- : 3
57
+ ? 3
58
+ : 2
55
59
  }
56
60
  }
57
61
 
@@ -61,7 +65,7 @@ const MESSAGE = 'Either no error message has been defined or no error has been s
61
65
 
62
66
  const tidy = (v) => v.replace(/\n\n/gm, '\n').trim()
63
67
 
64
- const trim = (v) => v.split('\n').map((v) => v.trimEnd()).join('\n').trim()
68
+ const trim = (v) => v.split('\n').map((v) => v.trim()).join('\n').trim()
65
69
 
66
70
  const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePath = relative.bind(null, process.cwd())
67
71
 
@@ -75,29 +79,31 @@ rm -rf node_modules package-lock.json
75
79
  `)
76
80
 
77
81
  const getNpmiCommands = PLATFORM === 'win32'
78
- ? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
79
- : (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(`
80
84
  export PATH=/usr/local/bin:$PATH &> /dev/null
81
85
  . "${NVM}" 2> /dev/null
82
- ${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
86
+ ${getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'npm i')))}
83
87
  `)
84
88
 
85
89
  const getDepsCommands = PLATFORM === 'win32'
86
- ? (directory = DIRECTORY, registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
87
- : (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(`
88
92
  export PATH=/usr/local/bin:$PATH &> /dev/null
89
93
  . "${NVM}" 2> /dev/null
90
- ${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
94
+ ${getRegistryParameter(registry, getForceParameter(force, getAuthorParameter(author, 'deps')))}
91
95
  `)
92
96
 
93
97
  function use (key) {
94
98
  const log = debug(`@modernpoacher/deps:${key}`)
95
99
 
96
100
  return function use (v) {
97
- if (v.trim() === '') return
101
+ const s = v.trim()
102
+
103
+ if (s === '') return
98
104
 
99
105
  return (
100
- log(trim(v)) // log(v.trim()) // .replace(/(\s+)$/g, '')
106
+ log(trim(s))
101
107
  )
102
108
  }
103
109
  }
@@ -255,13 +261,13 @@ function rmrf (directory = DIRECTORY) {
255
261
  )
256
262
  }
257
263
 
258
- function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
264
+ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
259
265
  log('npmi')
260
266
 
261
267
  return (
262
268
  new Promise((resolve, reject) => {
263
269
  const log = use('npmi')
264
- const commands = getNpmiCommands(directory, registry, force)
270
+ const commands = getNpmiCommands(directory, registry, force, author)
265
271
 
266
272
  /**
267
273
  * log(commands)
@@ -278,13 +284,13 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
278
284
  )
279
285
  }
280
286
 
281
- function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
287
+ function deps (directory = DIRECTORY, registry = REGISTRY, force = false, author = AUTHOR) {
282
288
  log('deps')
283
289
 
284
290
  return (
285
291
  new Promise((resolve, reject) => {
286
292
  const log = use('deps')
287
- const commands = getDepsCommands(directory, registry, force)
293
+ const commands = getDepsCommands(directory, registry, force, author)
288
294
 
289
295
  /**
290
296
  * log(commands)
@@ -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
  }
@@ -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
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.gitAdd=gitAdd;exports.gitCheckout=gitCheckout;exports.gitCommit=gitCommit;exports.gitPull=gitPull;exports.gitPush=gitPush;exports.gitPushTags=gitPushTags;exports.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("../env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';const BRANCH='master';const ADD='package.json package-lock.json';const COMMIT=_env.PLATFORM==='win32'?'Updated `package.json` &/ `package-lock.json`':'Updated \\`package.json\\` &/ \\`package-lock.json\\`';const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{FORCE_COLOR:_env.PLATFORM==='win32'?2:3}};const log=(0,_debug.default)('@modernpoacher/deps');log(`\`git\` (${_env.PLATFORM}) is awake`);const trim=v=>v.split('\n').map(v=>v.trimEnd()).join('\n').trim();function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){if(v.trim()==='')return;return log(trim(v));};}function out(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function out(v){const s=v.trim();if(s===''||directory===s)return;return log(trim(s));};}function err(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function err(v){const s=v.trim();if(s===''||directory===s||s.toLowerCase().startsWith('fatal: not a git repository'))return;return log(trim(s));};}const getErrorCode=({code=0}={})=>code;const getErrorMessage=({message=''}={})=>message;function getCatGitRefsRemotesOriginHeadCommands(){log('getCatGitRefsRemotesOriginHeadCommands');return`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.catGitRefsRemotesOriginHead=catGitRefsRemotesOriginHead;exports.gitAdd=gitAdd;exports.gitCheckout=gitCheckout;exports.gitCommit=gitCommit;exports.gitPull=gitPull;exports.gitPush=gitPush;exports.gitPushTags=gitPushTags;exports.gitRevParse=gitRevParse;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("../env");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const DIRECTORY='.';const BRANCH='master';const ADD='package.json package-lock.json';const COMMIT=_env.PLATFORM==='win32'?'Updated `package.json` &/ `package-lock.json`':'Updated \\`package.json\\` &/ \\`package-lock.json\\`';const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const log=(0,_debug.default)('@modernpoacher/deps');log(`\`git\` (${_env.PLATFORM}) is awake`);const trim=v=>v.split('\n').map(v=>v.trimEnd()).join('\n').trim();function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){if(v.trim()==='')return;return log(trim(v));};}function out(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function out(v){const s=v.trim();if(s===''||directory===s)return;return log(trim(s));};}function err(key,directory){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function err(v){const s=v.trim();if(s===''||directory===s||s.toLowerCase().startsWith('fatal: not a git repository'))return;return log(trim(s));};}const getErrorCode=({code=0}={})=>code;const getErrorMessage=({message=''}={})=>message;function getCatGitRefsRemotesOriginHeadCommands(){log('getCatGitRefsRemotesOriginHeadCommands');return`
2
2
  DIR=$(echo "./.git/refs/remotes/origin/HEAD'" | sed -e "s/\\//\\\\\\/g" -e "s/://" | cat 2> /dev/null)
3
3
  [[ $DIR =~ "[-0-9a-zA-Z]*$" ]]
4
4
  echo "$\{BASH_REMATCH[0]}"
@@ -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:{FORCE_COLOR:_env.PLATFORM==='win32'?2:3}};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);}
@@ -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:{FORCE_COLOR:_env.PLATFORM==='win32'?2:3}};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.13",
3
+ "version": "1.6.16",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -25,11 +25,11 @@
25
25
  "url": "https://github.com/modernpoacher/deps/issues"
26
26
  },
27
27
  "scripts": {
28
- "prepublishOnly": "cross-env NODE_ENV=production npm run build",
28
+ "prepublishOnly": "cross-env DEBUG_COLORS=yes NODE_ENV=production npm run build",
29
29
  "prebuild": "npm run clean",
30
- "start": "cross-env NODE_ENV=production node bin/app",
31
- "dev": "cross-env NODE_ENV=development node bin/app",
32
- "dev-install": "cross-env NODE_ENV=development node bin/install/app",
30
+ "start": "cross-env DEBUG_COLORS=yes NODE_ENV=production node bin/app",
31
+ "dev": "cross-env DEBUG_COLORS=yes NODE_ENV=development node bin/app",
32
+ "dev-install": "cross-env DEBUG_COLORS=yes NODE_ENV=development node bin/install/app",
33
33
  "build": "npm run babel",
34
34
  "build:watch": "npm run babel:watch",
35
35
  "clean": "rimraf lib",
@@ -37,7 +37,7 @@
37
37
  "babel:watch": "npm run babel -- -w",
38
38
  "lint": "eslint .",
39
39
  "lint:fix": "npm run lint -- --fix",
40
- "test": "NODE_ENV=test mocha test --recursive -r @babel/register --verbose --color",
40
+ "test": " DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive -r @babel/register --verbose --color",
41
41
  "pre-commit": "npm run lint && npm run test && npm run build && git add lib"
42
42
  },
43
43
  "bin": {
@@ -50,7 +50,7 @@
50
50
  "deps-head": "bin/head.sh"
51
51
  },
52
52
  "dependencies": {
53
- "commander": "^9.1.0",
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.21.1",
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",
@@ -27,9 +27,10 @@ const OPTIONS = {
27
27
  shell: true,
28
28
  stdio: 'inherit',
29
29
  env: {
30
+ DEBUG_COLORS: 'yes',
30
31
  FORCE_COLOR: PLATFORM === 'win32'
31
- ? 2
32
- : 3
32
+ ? 3
33
+ : 2
33
34
  }
34
35
  }
35
36
 
@@ -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,
@@ -38,9 +40,10 @@ const OPTIONS = {
38
40
  shell: true,
39
41
  stdio: 'inherit',
40
42
  env: {
43
+ DEBUG_COLORS: 'yes',
41
44
  FORCE_COLOR: PLATFORM === 'win32'
42
- ? 2
43
- : 3
45
+ ? 3
46
+ : 2
44
47
  }
45
48
  }
46
49
 
@@ -69,14 +72,14 @@ function use (key) {
69
72
  *
70
73
  * @return {Array}
71
74
  */
72
- export const getInstallSaveExactCommands = (p, r, f) => {
75
+ export const getInstallSaveExactCommands = (p, r, f, a) => {
73
76
  log('getInstallSaveExactCommands')
74
77
 
75
78
  const c = transform(p)
76
79
  const commands = `npm i ${c}`
77
80
 
78
81
  return normalizeCommands(
79
- getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands)))
82
+ getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, getSaveExactParameter(commands))))
80
83
  )
81
84
  }
82
85
 
@@ -91,14 +94,14 @@ export const getInstallSaveExactCommands = (p, r, f) => {
91
94
  *
92
95
  * @return {Array}
93
96
  */
94
- export const getInstallCommands = (p, r, f) => {
97
+ export const getInstallCommands = (p, r, f, a) => {
95
98
  log('getInstallCommands')
96
99
 
97
100
  const c = transform(p)
98
101
  const commands = `npm i ${c}`
99
102
 
100
103
  return normalizeCommands(
101
- getRegistryParameter(r, getForceParameter(f, commands))
104
+ getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, commands)))
102
105
  )
103
106
  }
104
107
 
@@ -113,10 +116,10 @@ export const getInstallCommands = (p, r, f) => {
113
116
  *
114
117
  * @return {Array}
115
118
  */
116
- export function getInstallSaveBundleSaveExactCommands (p, r, f) {
119
+ export function getInstallSaveBundleSaveExactCommands (p, r, f, a) {
117
120
  log('getInstallSaveBundleSaveExactCommands')
118
121
 
119
- const commands = getInstallSaveExactCommands(p, r, f)
122
+ const commands = getInstallSaveExactCommands(p, r, f, a)
120
123
 
121
124
  return normalizeCommands(
122
125
  getSaveBundleParameter(commands)
@@ -134,10 +137,10 @@ export function getInstallSaveBundleSaveExactCommands (p, r, f) {
134
137
  *
135
138
  * @return {Array}
136
139
  */
137
- export function getInstallSaveBundleCommands (p, r, f) {
140
+ export function getInstallSaveBundleCommands (p, r, f, a) {
138
141
  log('getInstallSaveBundleCommands')
139
142
 
140
- const commands = getInstallCommands(p, r, f)
143
+ const commands = getInstallCommands(p, r, f, a)
141
144
 
142
145
  return normalizeCommands(
143
146
  getSaveBundleParameter(commands)
@@ -155,10 +158,10 @@ export function getInstallSaveBundleCommands (p, r, f) {
155
158
  *
156
159
  * @return {Array}
157
160
  */
158
- export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
161
+ export function getInstallSaveOptionalSaveExactCommands (p, r, f, a) {
159
162
  log('getInstallSaveOptionalSaveExactCommands')
160
163
 
161
- const commands = getInstallSaveExactCommands(p, r, f)
164
+ const commands = getInstallSaveExactCommands(p, r, f, a)
162
165
 
163
166
  return normalizeCommands(
164
167
  getSaveOptionalParameter(commands)
@@ -176,10 +179,10 @@ export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
176
179
  *
177
180
  * @return {Array}
178
181
  */
179
- export function getInstallSaveOptionalCommands (p, r, f) {
182
+ export function getInstallSaveOptionalCommands (p, r, f, a) {
180
183
  log('getInstallSaveOptionalCommands')
181
184
 
182
- const commands = getInstallCommands(p, r, f)
185
+ const commands = getInstallCommands(p, r, f, a)
183
186
 
184
187
  return normalizeCommands(
185
188
  getSaveOptionalParameter(commands)
@@ -197,10 +200,10 @@ export function getInstallSaveOptionalCommands (p, r, f) {
197
200
  *
198
201
  * @return {Array}
199
202
  */
200
- export function getInstallSaveDevSaveExactCommands (p, r, f) {
203
+ export function getInstallSaveDevSaveExactCommands (p, r, f, a) {
201
204
  log('getInstallSaveDevSaveExactCommands')
202
205
 
203
- const commands = getInstallSaveExactCommands(p, r, f)
206
+ const commands = getInstallSaveExactCommands(p, r, f, a)
204
207
 
205
208
  return normalizeCommands(
206
209
  getSaveDevParameter(commands)
@@ -218,10 +221,10 @@ export function getInstallSaveDevSaveExactCommands (p, r, f) {
218
221
  *
219
222
  * @return {Array}
220
223
  */
221
- export function getInstallSaveDevCommands (p, r, f) {
224
+ export function getInstallSaveDevCommands (p, r, f, a) {
222
225
  log('getInstallSaveDevCommands')
223
226
 
224
- const commands = getInstallCommands(p, r, f)
227
+ const commands = getInstallCommands(p, r, f, a)
225
228
 
226
229
  return normalizeCommands(
227
230
  getSaveDevParameter(commands)
@@ -239,10 +242,10 @@ export function getInstallSaveDevCommands (p, r, f) {
239
242
  *
240
243
  * @return {Array}
241
244
  */
242
- export function getInstallSaveProdSaveExactCommands (p, r, f) {
245
+ export function getInstallSaveProdSaveExactCommands (p, r, f, a) {
243
246
  log('getInstallSaveProdSaveExactCommands')
244
247
 
245
- const commands = getInstallSaveExactCommands(p, r, f)
248
+ const commands = getInstallSaveExactCommands(p, r, f, a)
246
249
 
247
250
  return normalizeCommands(
248
251
  getSaveProdParameter(commands)
@@ -260,10 +263,10 @@ export function getInstallSaveProdSaveExactCommands (p, r, f) {
260
263
  *
261
264
  * @return {Array}
262
265
  */
263
- export function getInstallSaveProdCommands (p, r, f) {
266
+ export function getInstallSaveProdCommands (p, r, f, a) {
264
267
  log('getInstallSaveProdCommands')
265
268
 
266
- const commands = getInstallCommands(p, r, f)
269
+ const commands = getInstallCommands(p, r, f, a)
267
270
 
268
271
  return normalizeCommands(
269
272
  getSaveProdParameter(commands)
@@ -282,13 +285,13 @@ export function getInstallSaveProdCommands (p, r, f) {
282
285
  *
283
286
  * @return {Promise}
284
287
  */
285
- export function installSaveBundleSaveExact (d, p, r, f) {
288
+ export function installSaveBundleSaveExact (d, p, r, f, a) {
286
289
  log('installSaveBundleSaveExact')
287
290
 
288
291
  return (
289
292
  new Promise((resolve, reject) => {
290
293
  const log = use('install-save-bundle-save-exact')
291
- const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f))
294
+ const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f, a))
292
295
 
293
296
  /**
294
297
  * log(commands)
@@ -317,13 +320,13 @@ export function installSaveBundleSaveExact (d, p, r, f) {
317
320
  *
318
321
  * @return {Promise}
319
322
  */
320
- export function installSaveBundle (d, p, r, f) {
323
+ export function installSaveBundle (d, p, r, f, a) {
321
324
  log('installSaveBundle')
322
325
 
323
326
  return (
324
327
  new Promise((resolve, reject) => {
325
328
  const log = use('install-save-bundle')
326
- const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f))
329
+ const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f, a))
327
330
 
328
331
  /**
329
332
  * log(commands)
@@ -352,13 +355,13 @@ export function installSaveBundle (d, p, r, f) {
352
355
  *
353
356
  * @return {Promise}
354
357
  */
355
- export function installSaveOptionalSaveExact (d, p, r, f) {
358
+ export function installSaveOptionalSaveExact (d, p, r, f, a) {
356
359
  log('installSaveOptionalSaveExact')
357
360
 
358
361
  return (
359
362
  new Promise((resolve, reject) => {
360
363
  const log = use('install-save-otional-save-exact')
361
- const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f))
364
+ const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f, a))
362
365
 
363
366
  /**
364
367
  * log(commands)
@@ -387,13 +390,13 @@ export function installSaveOptionalSaveExact (d, p, r, f) {
387
390
  *
388
391
  * @return {Promise}
389
392
  */
390
- export function installSaveOptional (d, p, r, f) {
393
+ export function installSaveOptional (d, p, r, f, a) {
391
394
  log('installSaveOptional')
392
395
 
393
396
  return (
394
397
  new Promise((resolve, reject) => {
395
398
  const log = use('install-save-otional')
396
- const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f))
399
+ const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f, a))
397
400
 
398
401
  /**
399
402
  * log(commands)
@@ -422,13 +425,13 @@ export function installSaveOptional (d, p, r, f) {
422
425
  *
423
426
  * @return {Promise}
424
427
  */
425
- export function installSaveDevSaveExact (d, p, r, f) {
428
+ export function installSaveDevSaveExact (d, p, r, f, a) {
426
429
  log('installSaveDevSaveExact')
427
430
 
428
431
  return (
429
432
  new Promise((resolve, reject) => {
430
433
  const log = use('install-save-dev-save-exact')
431
- const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f))
434
+ const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f, a))
432
435
 
433
436
  /**
434
437
  * log(commands)
@@ -457,13 +460,13 @@ export function installSaveDevSaveExact (d, p, r, f) {
457
460
  *
458
461
  * @return {Promise}
459
462
  */
460
- export function installSaveDev (d, p, r, f) {
463
+ export function installSaveDev (d, p, r, f, a) {
461
464
  log('installSaveDev')
462
465
 
463
466
  return (
464
467
  new Promise((resolve, reject) => {
465
468
  const log = use('install-save-dev')
466
- const commands = getCommands(d, getInstallSaveDevCommands(p, r, f))
469
+ const commands = getCommands(d, getInstallSaveDevCommands(p, r, f, a))
467
470
 
468
471
  /**
469
472
  * log(commands)
@@ -492,13 +495,13 @@ export function installSaveDev (d, p, r, f) {
492
495
  *
493
496
  * @return {Promise}
494
497
  */
495
- export function installSaveProdSaveExact (d, p, r, f) {
498
+ export function installSaveProdSaveExact (d, p, r, f, a) {
496
499
  log('installSaveProdSaveExact')
497
500
 
498
501
  return (
499
502
  new Promise((resolve, reject) => {
500
503
  const log = use('install-save-prod-save-exact')
501
- const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f))
504
+ const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f, a))
502
505
 
503
506
  /**
504
507
  * log(commands)
@@ -527,13 +530,13 @@ export function installSaveProdSaveExact (d, p, r, f) {
527
530
  *
528
531
  * @return {Promise}
529
532
  */
530
- export function installSaveProd (d, p, r, f) {
533
+ export function installSaveProd (d, p, r, f, a) {
531
534
  log('installSaveProd')
532
535
 
533
536
  return (
534
537
  new Promise((resolve, reject) => {
535
538
  const log = use('install-save-prod')
536
- const commands = getCommands(d, getInstallSaveProdCommands(p, r, f))
539
+ const commands = getCommands(d, getInstallSaveProdCommands(p, r, f, a))
537
540
 
538
541
  /**
539
542
  * log(commands)
@@ -563,16 +566,16 @@ export function installSaveProd (d, p, r, f) {
563
566
  *
564
567
  * @return {Promise}
565
568
  */
566
- 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) {
567
570
  log('executeBundle')
568
571
 
569
572
  const depsExact = getDepsExact(packages, configuration)
570
573
 
571
- if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force)
574
+ if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force, author)
572
575
 
573
576
  const deps = getDeps(packages)
574
577
 
575
- if (deps.length) await installSaveBundle(directory, deps, registry, force)
578
+ if (deps.length) await installSaveBundle(directory, deps, registry, force, author)
576
579
  }
577
580
 
578
581
  /**
@@ -588,16 +591,16 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
588
591
  *
589
592
  * @return {Promise}
590
593
  */
591
- 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) {
592
595
  log('executeOptional')
593
596
 
594
597
  const depsExact = getDepsExact(packages, configuration)
595
598
 
596
- if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry)
599
+ if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry, force, author)
597
600
 
598
601
  const deps = getDeps(packages)
599
602
 
600
- if (deps.length) await installSaveOptional(directory, deps, registry)
603
+ if (deps.length) await installSaveOptional(directory, deps, registry, force, author)
601
604
  }
602
605
 
603
606
  /**
@@ -613,16 +616,16 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
613
616
  *
614
617
  * @return {Promise}
615
618
  */
616
- 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) {
617
620
  log('executeDev')
618
621
 
619
622
  const depsExact = getDepsExact(packages, configuration)
620
623
 
621
- if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force)
624
+ if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force, author)
622
625
 
623
626
  const deps = getDeps(packages)
624
627
 
625
- if (deps.length) await installSaveDev(directory, deps, registry, force)
628
+ if (deps.length) await installSaveDev(directory, deps, registry, force, author)
626
629
  }
627
630
 
628
631
  /**
@@ -638,14 +641,14 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
638
641
  *
639
642
  * @return {Promise}
640
643
  */
641
- 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) {
642
645
  log('executeProd')
643
646
 
644
647
  const depsExact = getDepsExact(packages, configuration)
645
648
 
646
- if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force)
649
+ if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force, author)
647
650
 
648
651
  const deps = getDeps(packages)
649
652
 
650
- if (deps.length) await installSaveProd(directory, deps, registry, force)
653
+ if (deps.length) await installSaveProd(directory, deps, registry, force, author)
651
654
  }
@@ -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,
@@ -39,9 +41,10 @@ const OPTIONS = {
39
41
  shell: true,
40
42
  stdio: 'inherit',
41
43
  env: {
44
+ DEBUG_COLORS: 'yes',
42
45
  FORCE_COLOR: PLATFORM === 'win32'
43
- ? 2
44
- : 3
46
+ ? 3
47
+ : 2
45
48
  }
46
49
  }
47
50
 
@@ -57,14 +60,14 @@ const OPTIONS = {
57
60
  *
58
61
  * @return {Array}
59
62
  */
60
- export const getInstallSaveExactCommands = (p, s, r, f) => {
63
+ export const getInstallSaveExactCommands = (p, s, r, f, a) => {
61
64
  log('getInstallSaveExactCommands')
62
65
 
63
66
  const c = transform(p)
64
67
  const commands = `npm i ${c}`
65
68
 
66
69
  return normalizeCommands(
67
- getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands))))
70
+ getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, getSaveExactParameter(commands)))))
68
71
  )
69
72
  }
70
73
 
@@ -80,14 +83,14 @@ export const getInstallSaveExactCommands = (p, s, r, f) => {
80
83
  *
81
84
  * @return {Array}
82
85
  */
83
- export const getInstallCommands = (p, s, r, f) => {
86
+ export const getInstallCommands = (p, s, r, f, a) => {
84
87
  log('getInstallCommands')
85
88
 
86
89
  const c = transform(p)
87
90
  const commands = `npm i ${c}`
88
91
 
89
92
  return normalizeCommands(
90
- getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, commands)))
93
+ getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getAuthorParameter(a, commands))))
91
94
  )
92
95
  }
93
96
 
@@ -104,12 +107,12 @@ export const getInstallCommands = (p, s, r, f) => {
104
107
  *
105
108
  * @return {Promise}
106
109
  */
107
- export function installSaveExact (d, p, s, r, f) {
110
+ export function installSaveExact (d, p, s, r, f, a) {
108
111
  log('installSaveExact')
109
112
 
110
113
  return (
111
114
  new Promise((resolve, reject) => {
112
- const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f))
115
+ const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f, a))
113
116
 
114
117
  const {
115
118
  stdout,
@@ -135,12 +138,12 @@ export function installSaveExact (d, p, s, r, f) {
135
138
  *
136
139
  * @return {Promise}
137
140
  */
138
- export function install (d, p, s, r, f) {
141
+ export function install (d, p, s, r, f, a) {
139
142
  log('install')
140
143
 
141
144
  return (
142
145
  new Promise((resolve, reject) => {
143
- const commands = getCommands(d, getInstallCommands(p, s, r, f))
146
+ const commands = getCommands(d, getInstallCommands(p, s, r, f, a))
144
147
 
145
148
  const {
146
149
  stdout,
@@ -166,14 +169,14 @@ export function install (d, p, s, r, f) {
166
169
  *
167
170
  * @return {Promise}
168
171
  */
169
- 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) {
170
173
  log('execute')
171
174
 
172
175
  const depsExact = getDepsExact(packages, configuration)
173
176
 
174
- if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force)
177
+ if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force, author)
175
178
 
176
179
  const deps = getDeps(packages)
177
180
 
178
- if (deps.length) await install(directory, deps, save, registry, force)
181
+ if (deps.length) await install(directory, deps, save, registry, force, author)
179
182
  }