@modernpoacher/deps 1.6.18 → 1.6.21

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,8 +66,6 @@ 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('-m, --message [message]', 'Git commit message')
70
- .option('-a, --author [author]', 'Git commit author')
71
69
  .parse(argv)
72
70
 
73
71
  /*
@@ -98,9 +96,7 @@ async function app () {
98
96
  saveOptional: O,
99
97
  saveBundle: B,
100
98
  force,
101
- registry,
102
- message,
103
- author
99
+ registry
104
100
  } = commander.opts()
105
101
 
106
102
  log({
@@ -116,7 +112,7 @@ async function app () {
116
112
  log('Prod')
117
113
 
118
114
  try {
119
- await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, message, author)
115
+ await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
120
116
  } catch (e) {
121
117
  handleError(e)
122
118
  }
@@ -124,7 +120,7 @@ async function app () {
124
120
  log('Dev')
125
121
 
126
122
  try {
127
- await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, message, author)
123
+ await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
128
124
  } catch (e) {
129
125
  handleError(e)
130
126
  }
@@ -133,7 +129,7 @@ async function app () {
133
129
  log('Prod')
134
130
 
135
131
  try {
136
- await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force, message, author)
132
+ await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
137
133
  } catch (e) {
138
134
  handleError(e)
139
135
  }
@@ -142,7 +138,7 @@ async function app () {
142
138
  log('Dev')
143
139
 
144
140
  try {
145
- await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force, message, author)
141
+ await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
146
142
  } catch (e) {
147
143
  handleError(e)
148
144
  }
@@ -151,7 +147,7 @@ async function app () {
151
147
  log('Optional')
152
148
 
153
149
  try {
154
- await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force, message, author)
150
+ await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force)
155
151
  } catch (e) {
156
152
  handleError(e)
157
153
  }
@@ -160,7 +156,7 @@ async function app () {
160
156
  log('Bundle')
161
157
 
162
158
  try {
163
- await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force, message, author)
159
+ await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force)
164
160
  } catch (e) {
165
161
  handleError(e)
166
162
  }
@@ -108,10 +108,9 @@ function use (key) {
108
108
  }
109
109
 
110
110
  function handleError ({ code = CODE, message = MESSAGE } = {}) {
111
- log({
112
- code,
113
- message
114
- })
111
+ const log = debug('@modernpoacher/deps:error')
112
+ if (code > 1) log(code)
113
+ log(message)
115
114
  }
116
115
 
117
116
  const handlePackageError = ({ message = MESSAGE } = {}) => log(`Package error: "${message}"`)
package/bin/deps.sh CHANGED
@@ -2,11 +2,14 @@
2
2
  #
3
3
  # https://google.github.io/styleguide/shellguide.html#s7-naming-conventions
4
4
 
5
+ export PATH=/usr/local/bin:$PATH
6
+
7
+ eval \`ssh-agent\`
8
+
5
9
  EXP="[-0-9a-zA-Z]*$"
6
10
 
7
11
  function update {
8
12
  git checkout $default_branch
9
-
10
13
  git pull
11
14
 
12
15
  rm -rf node_modules package-lock.json
@@ -15,8 +18,8 @@ function update {
15
18
 
16
19
  git add package.json package-lock.json
17
20
  git commit -m "Updated \`package.json\` &/ \`package-lock.json\`"
18
-
19
21
  git push
22
+ git push --tags
20
23
  }
21
24
 
22
25
  function can_update {
@@ -34,14 +34,17 @@ const {
34
34
  } = require('@modernpoacher/deps/common/git')
35
35
 
36
36
  const {
37
- REGISTRY
37
+ REGISTRY,
38
+ getAuthor
38
39
  } = require('@modernpoacher/deps/common')
39
40
 
40
41
  const {
41
42
  handleError,
42
43
  rmrf,
43
44
  npmi,
44
- deps
45
+ deps,
46
+ hasConfiguration,
47
+ getConfiguration
45
48
  } = require('~/bin/common')
46
49
 
47
50
  const {
@@ -60,7 +63,7 @@ const DIRECTORY = process.cwd()
60
63
 
61
64
  function handleCommandError (e) {
62
65
  const {
63
- code = 'NONE'
66
+ code = 0
64
67
  } = e
65
68
 
66
69
  if (code !== 128) {
@@ -68,13 +71,24 @@ function handleCommandError (e) {
68
71
  message
69
72
  } = e
70
73
 
71
- log({
72
- code,
73
- message
74
- })
74
+ const log = debug('@modernpoacher/deps:error')
75
+ if (code > 1) log(code)
76
+ log(message)
75
77
  }
76
78
  }
77
79
 
80
+ async function getAuthorFromConfiguration (path) {
81
+ log('getAuthorFromConfiguration')
82
+
83
+ const CONFIGURATION = await hasConfiguration(path)
84
+ ? await getConfiguration(path)
85
+ : {}
86
+
87
+ return (
88
+ getAuthor(CONFIGURATION)
89
+ )
90
+ }
91
+
78
92
  const filterDeps = (v) => !!v // de-falsy
79
93
 
80
94
  const reduceDeps = (a, v) => a.includes(v) ? a : a.concat(v) // de-dupe
@@ -118,12 +132,24 @@ async function mapRevParse (directory) {
118
132
  }
119
133
  }
120
134
 
121
- async function iterate ([directory, ...directories] = [], registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
135
+ async function iterate ([directory, ...directories] = [], registry, force, message, author) {
122
136
  log('iterate')
123
137
 
124
- if (directory) await execute(directory, registry, force, message, author)
138
+ if (directory) {
139
+ const path = resolve(directory)
125
140
 
126
- if (directories.length) await iterate(directories, registry, force, message, author)
141
+ try {
142
+ if (path === await gitRevParse(path)) {
143
+ await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
144
+ }
145
+ } catch (e) {
146
+ handleCommandError(e)
147
+ }
148
+ }
149
+
150
+ if (directories.length) {
151
+ await iterate(directories, registry, force, message, author)
152
+ }
127
153
  }
128
154
 
129
155
  async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
@@ -146,7 +172,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
146
172
  }
147
173
  }
148
174
 
149
- async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
175
+ async function executeFrom (directory, registry, force, message, author) {
150
176
  log('executeFrom')
151
177
 
152
178
  const path = resolve(directory)
@@ -154,7 +180,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
154
180
  try {
155
181
  if (path === await gitRevParse(path)) {
156
182
  return (
157
- await execute(path, registry, force, message, author)
183
+ await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
158
184
  )
159
185
  }
160
186
  } catch (e) {
@@ -162,7 +188,7 @@ async function executeFrom (directory = DIRECTORY, registry = REGISTRY, force =
162
188
  }
163
189
  }
164
190
 
165
- async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
191
+ async function executeOnly (directory, registry, force, message, author) {
166
192
  log('executeOnly')
167
193
 
168
194
  const path = resolve(directory)
@@ -170,7 +196,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
170
196
  try {
171
197
  if (path === await gitRevParse(path)) {
172
198
  return (
173
- await execute(path, registry, force, message, author)
199
+ await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
174
200
  )
175
201
  }
176
202
  } catch (e) {
@@ -178,7 +204,7 @@ async function executeOnly (directory = DIRECTORY, registry = REGISTRY, force =
178
204
  }
179
205
  }
180
206
 
181
- async function executePath (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
207
+ async function executePath (directory, registry, force, message, author) {
182
208
  log('executePath')
183
209
 
184
210
  const path = resolve(directory)
@@ -186,7 +212,7 @@ async function executePath (directory = DIRECTORY, registry = REGISTRY, force =
186
212
  try {
187
213
  if (path === await gitRevParse(path)) {
188
214
  return (
189
- await execute(path, registry, force, message, author)
215
+ await execute(path, registry, force, message, author || await getAuthorFromConfiguration(path))
190
216
  )
191
217
  }
192
218
  } catch (e) {
@@ -1,5 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
+ export PATH=/usr/local/bin:$PATH
4
+
5
+ eval \`ssh-agent\`
6
+
3
7
  EXP="[-0-9a-zA-Z]*$"
4
8
 
5
9
  DIR=$(echo "$PWD" | sed 's/\\/\//g' | sed 's/://') && [[ $(cat "$DIR/.git/refs/remotes/origin/HEAD" 2> /dev/null) =~ $EXP ]] && echo "${BASH_REMATCH[0]}"
package/bin/head.sh CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
+ export PATH=/usr/local/bin:$PATH
4
+
5
+ eval \`ssh-agent\`
6
+
3
7
  EXP="[-0-9a-zA-Z]*$"
4
8
 
5
9
  function report {
@@ -66,8 +66,6 @@ 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('-m, --message [message]', 'Git commit message')
70
- .option('-a, --author [author]', 'Git commit author')
71
69
  .parse(argv)
72
70
 
73
71
  /*
@@ -100,9 +98,7 @@ async function app () {
100
98
  peer: p,
101
99
  save,
102
100
  registry,
103
- force,
104
- message,
105
- author
101
+ force
106
102
  } = commander.opts()
107
103
 
108
104
  log({
@@ -120,7 +116,7 @@ async function app () {
120
116
  log('Prod')
121
117
 
122
118
  try {
123
- await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force, message, author)
119
+ await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
124
120
  } catch (e) {
125
121
  handleError(e)
126
122
  }
@@ -129,7 +125,7 @@ async function app () {
129
125
  log('Dev')
130
126
 
131
127
  try {
132
- await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force, message, author)
128
+ await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
133
129
  } catch (e) {
134
130
  handleError(e)
135
131
  }
@@ -138,7 +134,7 @@ async function app () {
138
134
  log('Optional')
139
135
 
140
136
  try {
141
- await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force, message, author)
137
+ await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
142
138
  } catch (e) {
143
139
  handleError(e)
144
140
  }
@@ -147,7 +143,7 @@ async function app () {
147
143
  log('Bundle')
148
144
 
149
145
  try {
150
- await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force, message, author)
146
+ await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
151
147
  } catch (e) {
152
148
  handleError(e)
153
149
  }
@@ -156,7 +152,7 @@ async function app () {
156
152
  log('Peer')
157
153
 
158
154
  try {
159
- await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force, message, author)
155
+ await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
160
156
  } catch (e) {
161
157
  handleError(e)
162
158
  }
package/bin/push.sh CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
+ export PATH=/usr/local/bin:$PATH
4
+
5
+ eval \`ssh-agent\`
6
+
3
7
  EXP="[-0-9a-zA-Z]*$"
4
8
 
5
9
  function report {
package/bin/wipe.sh CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
+ export PATH=/usr/local/bin:$PATH
4
+
5
+ eval \`ssh-agent\`
6
+
3
7
  EXP="[-0-9a-zA-Z]*$"
4
8
 
5
9
  function report {
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCommands=exports.getBundleDependencies=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 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.getAuthor=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 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}
5
- `);exports.getCommands=getCommands;const getProdDependencies=({dependencies={}}={})=>dependencies;exports.getProdDependencies=getProdDependencies;const getDevDependencies=({devDependencies={}}={})=>devDependencies;exports.getDevDependencies=getDevDependencies;const getOptionalDependencies=({optionalDependencies={}}={})=>optionalDependencies;exports.getOptionalDependencies=getOptionalDependencies;const getBundleDependencies=({bundleDependencies=[]}={})=>bundleDependencies;exports.getBundleDependencies=getBundleDependencies;const getPeerDependencies=({peerDependencies}={})=>peerDependencies;exports.getPeerDependencies=getPeerDependencies;const isPreRelease=v=>/-/.test(v);exports.isPreRelease=isPreRelease;const isExact=v=>/^\d/.test(v);exports.isExact=isExact;function getDepsExact(values,configuration){log('getDepsExact');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator.concat({name,version:Reflect.has(configuration,name)?Reflect.get(configuration,name):version}):accumulator,[]);}function getDeps(values){log('getDeps');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator:isPreRelease(version)?accumulator.concat({name,version}):accumulator.concat({name,version:'latest'}),[]);}function normalizeCommands(value){while(/\s\s|\n/.test(value)){value=value.replace(/\s\s/gm,String.fromCharCode(32)).replace(/\n/gm,String.fromCharCode(32));}return value.trim();}const transformDependency=({name='@modernpoacher/deps',version='latest'}={})=>`${name}@${version}`;exports.transformDependency=transformDependency;function transform(value){log('transform');return Array.isArray(value)?value.map(transformDependency).join(String.fromCharCode(32)).trim():transformDependency(value);}
5
+ `);exports.getCommands=getCommands;const getProdDependencies=({dependencies={}}={})=>dependencies;exports.getProdDependencies=getProdDependencies;const getDevDependencies=({devDependencies={}}={})=>devDependencies;exports.getDevDependencies=getDevDependencies;const getOptionalDependencies=({optionalDependencies={}}={})=>optionalDependencies;exports.getOptionalDependencies=getOptionalDependencies;const getBundleDependencies=({bundleDependencies=[]}={})=>bundleDependencies;exports.getBundleDependencies=getBundleDependencies;const getPeerDependencies=({peerDependencies}={})=>peerDependencies;exports.getPeerDependencies=getPeerDependencies;const getAuthor=({author}={})=>author;exports.getAuthor=getAuthor;const isPreRelease=v=>/-/.test(v);exports.isPreRelease=isPreRelease;const isExact=v=>/^\d/.test(v);exports.isExact=isExact;function getDepsExact(values,configuration){log('getDepsExact');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator.concat({name,version:Reflect.has(configuration,name)?Reflect.get(configuration,name):version}):accumulator,[]);}function getDeps(values){log('getDeps');return Object.entries(values).reduce((accumulator,[name,version])=>isExact(version)?accumulator:isPreRelease(version)?accumulator.concat({name,version}):accumulator.concat({name,version:'latest'}),[]);}function normalizeCommands(value){while(/\s\s|\n/.test(value)){value=value.replace(/\s\s/gm,String.fromCharCode(32)).replace(/\n/gm,String.fromCharCode(32));}return value.trim();}const transformDependency=({name='@modernpoacher/deps',version='latest'}={})=>`${name}@${version}`;exports.transformDependency=transformDependency;function transform(value){log('transform');return Array.isArray(value)?value.map(transformDependency).join(String.fromCharCode(32)).trim():transformDependency(value);}
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.executeBundle=executeBundle;exports.executeDev=executeDev;exports.executeOptional=executeOptional;exports.executeProd=executeProd;exports.getInstallCommands=void 0;exports.getInstallSaveBundleCommands=getInstallSaveBundleCommands;exports.getInstallSaveBundleSaveExactCommands=getInstallSaveBundleSaveExactCommands;exports.getInstallSaveDevCommands=getInstallSaveDevCommands;exports.getInstallSaveDevSaveExactCommands=getInstallSaveDevSaveExactCommands;exports.getInstallSaveExactCommands=void 0;exports.getInstallSaveOptionalCommands=getInstallSaveOptionalCommands;exports.getInstallSaveOptionalSaveExactCommands=getInstallSaveOptionalSaveExactCommands;exports.getInstallSaveProdCommands=getInstallSaveProdCommands;exports.getInstallSaveProdSaveExactCommands=getInstallSaveProdSaveExactCommands;exports.installSaveBundle=installSaveBundle;exports.installSaveBundleSaveExact=installSaveBundleSaveExact;exports.installSaveDev=installSaveDev;exports.installSaveDevSaveExact=installSaveDevSaveExact;exports.installSaveOptional=installSaveOptional;exports.installSaveOptionalSaveExact=installSaveOptionalSaveExact;exports.installSaveProd=installSaveProd;exports.installSaveProdSaveExact=installSaveProdSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _child_process=require("child_process");var _env=require("./common/env");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_env.PLATFORM}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};function use(key){const log=(0,_debug.default)(`@modernpoacher/deps:${key}`);return function use(v){const s=v.trim();if(s==='')return;return log(s);};}const getInstallSaveExactCommands=(p,r,f)=>{log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,r,f)=>{log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands)));};exports.getInstallCommands=getInstallCommands;function getInstallSaveBundleSaveExactCommands(p,r,f){log('getInstallSaveBundleSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalizeCommands)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,r,f){log('installSaveBundleSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-bundle-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveBundleSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveBundle(d,p,r,f){log('installSaveBundle');return new Promise((resolve,reject)=>{const log=use('install-save-bundle');const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptionalSaveExact(d,p,r,f){log('installSaveOptionalSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-otional-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveOptional(d,p,r,f){log('installSaveOptional');return new Promise((resolve,reject)=>{const log=use('install-save-otional');const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDevSaveExact(d,p,r,f){log('installSaveDevSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-dev-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveDevSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveDev(d,p,r,f){log('installSaveDev');return new Promise((resolve,reject)=>{const log=use('install-save-dev');const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProdSaveExact(d,p,r,f){log('installSaveProdSaveExact');return new Promise((resolve,reject)=>{const log=use('install-save-prod-save-exact');const commands=(0,_common.getCommands)(d,getInstallSaveProdSaveExactCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function installSaveProd(d,p,r,f){log('installSaveProd');return new Promise((resolve,reject)=>{const log=use('install-save-prod');const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveBundleSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveBundle(directory,deps,registry,force);}async function executeOptional(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeOptional');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveOptionalSaveExact(directory,depsExact,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry,force);}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=getInstallCommands;exports.getInstallSaveBundleCommands=getInstallSaveBundleCommands;exports.getInstallSaveBundleSaveExactCommands=getInstallSaveBundleSaveExactCommands;exports.getInstallSaveDevCommands=getInstallSaveDevCommands;exports.getInstallSaveDevSaveExactCommands=getInstallSaveDevSaveExactCommands;exports.getInstallSaveExactCommands=getInstallSaveExactCommands;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);};}function 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))));}function 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)));}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,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await installSaveOptional(directory,deps,registry,force);}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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.execute=execute;exports.getInstallSaveExactCommands=exports.getInstallCommands=void 0;exports.install=install;exports.installSaveExact=installSaveExact;var _debug=_interopRequireDefault(require("debug"));var _path=require("path");var _os=require("os");var _child_process=require("child_process");var _env=require("../common/env");var _common=require("../common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps:install');log(`\`install\` (${_os.platform}) is awake`);const OPTIONS={maxBuffer:1024*2000,shell:true,stdio:'inherit',env:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?3:2}};const getInstallSaveExactCommands=(p,s,r,f)=>{log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,(0,_common.getSaveExactParameter)(commands)))));};exports.getInstallSaveExactCommands=getInstallSaveExactCommands;const getInstallCommands=(p,s,r,f)=>{log('getInstallCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalizeCommands)((0,_common.getNoSaveParameter)(s,(0,_common.getRegistryParameter)(r,(0,_common.getForceParameter)(f,commands))));};exports.getInstallCommands=getInstallCommands;function installSaveExact(d,p,s,r,f){log('installSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveExactCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}function install(d,p,s,r,f){log('install');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallCommands(p,s,r,f));const{stdout,stderr}=(0,_child_process.exec)(commands,{...OPTIONS,cwd:(0,_path.normalize)(d)},(e,v)=>!e?resolve(v):reject(e));stdout.on('data',log);stderr.on('data',log);});}async function execute(directory=_common.DIRECTORY,packages={},configuration={},save=false,registry=_common.REGISTRY,force=false){log('execute');const depsExact=(0,_common.getDepsExact)(packages,configuration);if(depsExact.length)await installSaveExact(directory,depsExact,save,registry,force);const deps=(0,_common.getDeps)(packages);if(deps.length)await install(directory,deps,save,registry,force);}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.execute=execute;exports.getInstallCommands=getInstallCommands;exports.getInstallSaveExactCommands=getInstallSaveExactCommands;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}};function 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)))));}function 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))));}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);}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "1.6.18",
3
+ "version": "1.6.21",
4
4
  "description": "Update NPM package dependencies from the command line",
5
5
  "keywords": [
6
6
  "deps",
@@ -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": " DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive -r @babel/register --verbose --color",
40
+ "test": "cross-env 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": {
@@ -57,23 +57,23 @@
57
57
  "supports-color": "8.1.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@babel/cli": "^7.17.6",
61
- "@babel/core": "^7.17.9",
60
+ "@babel/cli": "^7.17.10",
61
+ "@babel/core": "^7.18.0",
62
62
  "@babel/eslint-parser": "^7.17.0",
63
- "@babel/preset-env": "^7.16.11",
63
+ "@babel/preset-env": "^7.18.0",
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.22.0",
67
+ "core-js": "^3.22.5",
68
68
  "cross-env": "^7.0.3",
69
- "eslint": "7.32.0",
70
- "eslint-config-standard": "^16.0.3",
69
+ "eslint": "^8.16.0",
70
+ "eslint-config-standard": "^17.0.0",
71
71
  "eslint-import-resolver-babel-module": "^5.3.1",
72
72
  "eslint-plugin-import": "^2.26.0",
73
73
  "eslint-plugin-node": "^11.1.0",
74
- "eslint-plugin-promise": "5.2.0",
75
- "husky": "^7.0.4",
76
- "mocha": "^9.2.2",
74
+ "eslint-plugin-promise": "^6.0.0",
75
+ "husky": "^8.0.1",
76
+ "mocha": "^10.0.0",
77
77
  "rimraf": "^3.0.2"
78
78
  },
79
79
  "_moduleAliases": {
@@ -119,7 +119,7 @@ export const getNoSaveParameter = (s, commands) => s ? commands : commands.conca
119
119
  export const getSaveExactParameter = (commands) => commands.concat(' --save-exact')
120
120
 
121
121
  /**
122
- * @function getProdDependencies
122
+ * @function getCommands
123
123
  *
124
124
  * Get the installation shell script
125
125
  *
@@ -140,7 +140,7 @@ ${commands}
140
140
  /**
141
141
  * @function getProdDependencies
142
142
  *
143
- * Get the production dependencies by destructuring the package
143
+ * Get the production dependencies by destructuring the package or configuration
144
144
  *
145
145
  * @param {Object} package
146
146
  *
@@ -151,7 +151,7 @@ export const getProdDependencies = ({ dependencies = {} } = {}) => dependencies
151
151
  /**
152
152
  * @function getDevDependencies
153
153
  *
154
- * Get the development dependencies by destructuring the package
154
+ * Get the development dependencies by destructuring the package or configuration
155
155
  *
156
156
  * @param {Object} package
157
157
  *
@@ -162,7 +162,7 @@ export const getDevDependencies = ({ devDependencies = {} } = {}) => devDependen
162
162
  /**
163
163
  * @function getOptionalDependencies
164
164
  *
165
- * Get the optional dependencies by destructuring the package
165
+ * Get the optional dependencies by destructuring the package or configuration
166
166
  *
167
167
  * @param {Object} package
168
168
  *
@@ -173,7 +173,7 @@ export const getOptionalDependencies = ({ optionalDependencies = {} } = {}) => o
173
173
  /**
174
174
  * @function getBundleDependencies
175
175
  *
176
- * Get the bundle dependencies by destructuring the package
176
+ * Get the bundle dependencies by destructuring the package or configuration
177
177
  *
178
178
  * @param {Object} package
179
179
  *
@@ -184,7 +184,7 @@ export const getBundleDependencies = ({ bundleDependencies = [] } = {}) => bundl
184
184
  /**
185
185
  * @function getPeerDependencies
186
186
  *
187
- * Get the peer dependencies by destructuring the package
187
+ * Get the peer dependencies by destructuring the package or configuration
188
188
  *
189
189
  * @param {Object} package
190
190
  *
@@ -192,6 +192,17 @@ export const getBundleDependencies = ({ bundleDependencies = [] } = {}) => bundl
192
192
  */
193
193
  export const getPeerDependencies = ({ peerDependencies } = {}) => peerDependencies
194
194
 
195
+ /**
196
+ * @function getAuthor
197
+ *
198
+ * Get the author by destructuring the package or configuration
199
+ *
200
+ * @param {Object} package
201
+ *
202
+ * @return {Object}
203
+ */
204
+ export const getAuthor = ({ author } = {}) => author
205
+
195
206
  /**
196
207
  * @function isPreRelease
197
208
  *
package/src/index.js CHANGED
@@ -70,7 +70,7 @@ function use (key) {
70
70
  *
71
71
  * @return {Array}
72
72
  */
73
- export const getInstallSaveExactCommands = (p, r, f) => {
73
+ export function getInstallSaveExactCommands (p, r, f) {
74
74
  log('getInstallSaveExactCommands')
75
75
 
76
76
  const c = transform(p)
@@ -92,7 +92,7 @@ export const getInstallSaveExactCommands = (p, r, f) => {
92
92
  *
93
93
  * @return {Array}
94
94
  */
95
- export const getInstallCommands = (p, r, f) => {
95
+ export function getInstallCommands (p, r, f) {
96
96
  log('getInstallCommands')
97
97
 
98
98
  const c = transform(p)
@@ -58,7 +58,7 @@ const OPTIONS = {
58
58
  *
59
59
  * @return {Array}
60
60
  */
61
- export const getInstallSaveExactCommands = (p, s, r, f) => {
61
+ export function getInstallSaveExactCommands (p, s, r, f) {
62
62
  log('getInstallSaveExactCommands')
63
63
 
64
64
  const c = transform(p)
@@ -81,7 +81,7 @@ export const getInstallSaveExactCommands = (p, s, r, f) => {
81
81
  *
82
82
  * @return {Array}
83
83
  */
84
- export const getInstallCommands = (p, s, r, f) => {
84
+ export function getInstallCommands (p, s, r, f) {
85
85
  log('getInstallCommands')
86
86
 
87
87
  const c = transform(p)