@modernpoacher/deps 1.5.4 → 1.5.7
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/common/index.js +20 -11
- package/lib/common/index.js +2 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/common/index.js +2 -2
- package/src/index.js +38 -0
package/bin/common/index.js
CHANGED
|
@@ -58,27 +58,27 @@ cd "${directory}"
|
|
|
58
58
|
|
|
59
59
|
rm -rf node_modules package-lock.json
|
|
60
60
|
|
|
61
|
-
exit 0
|
|
61
|
+
# exit 0
|
|
62
62
|
`)
|
|
63
63
|
|
|
64
64
|
const getNpmiCommands = (directory = DIRECTORY, registry = REGISTRY, force = false) => normalise(`
|
|
65
65
|
cd "${directory}"
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
. "${NVM}" 2> /dev/null
|
|
68
68
|
|
|
69
69
|
${getRegistryParameter(registry, getForceParameter(force, 'npm i'))}
|
|
70
70
|
|
|
71
|
-
exit 0
|
|
71
|
+
# exit 0
|
|
72
72
|
`)
|
|
73
73
|
|
|
74
74
|
const getDepsCommands = (directory = DIRECTORY, registry = REGISTRY, force = false) => normalise(`
|
|
75
75
|
cd "${directory}"
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
. "${NVM}" 2> /dev/null
|
|
78
78
|
|
|
79
79
|
${getRegistryParameter(registry, getForceParameter(force, 'deps'))}
|
|
80
80
|
|
|
81
|
-
exit 0
|
|
81
|
+
# exit 0
|
|
82
82
|
`)
|
|
83
83
|
|
|
84
84
|
function use (key) {
|
|
@@ -228,15 +228,18 @@ function rmrf (directory = DIRECTORY) {
|
|
|
228
228
|
|
|
229
229
|
return (
|
|
230
230
|
new Promise((resolve, reject) => {
|
|
231
|
+
const log = use('rmrf')
|
|
231
232
|
const commands = getRmrfCommands(directory)
|
|
232
233
|
|
|
234
|
+
log(commands)
|
|
235
|
+
|
|
233
236
|
const {
|
|
234
237
|
stdout,
|
|
235
238
|
stderr
|
|
236
239
|
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
237
240
|
|
|
238
|
-
stdout.on('data',
|
|
239
|
-
stderr.on('data',
|
|
241
|
+
stdout.on('data', log)
|
|
242
|
+
stderr.on('data', log)
|
|
240
243
|
})
|
|
241
244
|
)
|
|
242
245
|
}
|
|
@@ -246,15 +249,18 @@ function npmi (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
246
249
|
|
|
247
250
|
return (
|
|
248
251
|
new Promise((resolve, reject) => {
|
|
252
|
+
const log = use('npmi')
|
|
249
253
|
const commands = getNpmiCommands(directory, registry, force)
|
|
250
254
|
|
|
255
|
+
log(commands)
|
|
256
|
+
|
|
251
257
|
const {
|
|
252
258
|
stdout,
|
|
253
259
|
stderr
|
|
254
260
|
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
255
261
|
|
|
256
|
-
stdout.on('data',
|
|
257
|
-
stderr.on('data',
|
|
262
|
+
stdout.on('data', log)
|
|
263
|
+
stderr.on('data', log)
|
|
258
264
|
})
|
|
259
265
|
)
|
|
260
266
|
}
|
|
@@ -264,15 +270,18 @@ function deps (directory = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
264
270
|
|
|
265
271
|
return (
|
|
266
272
|
new Promise((resolve, reject) => {
|
|
273
|
+
const log = use('deps')
|
|
267
274
|
const commands = getDepsCommands(directory, registry, force)
|
|
268
275
|
|
|
276
|
+
log(commands)
|
|
277
|
+
|
|
269
278
|
const {
|
|
270
279
|
stdout,
|
|
271
280
|
stderr
|
|
272
281
|
} = exec(commands, { cwd: directory }, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
273
282
|
|
|
274
|
-
stdout.on('data',
|
|
275
|
-
stderr.on('data',
|
|
283
|
+
stdout.on('data', log)
|
|
284
|
+
stderr.on('data', log)
|
|
276
285
|
})
|
|
277
286
|
)
|
|
278
287
|
}
|
package/lib/common/index.js
CHANGED
|
@@ -3,9 +3,9 @@ export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
|
3
3
|
|
|
4
4
|
cd "${directory}"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
. "${NVM}" 2> /dev/null
|
|
7
7
|
|
|
8
8
|
${commands}
|
|
9
9
|
|
|
10
|
-
exit 0
|
|
10
|
+
# exit 0
|
|
11
11
|
`.replace(/\n\n/gm,String.fromCharCode(10)).trim();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 normalise(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 _os=require("os");var _child_process=require("child_process");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_os.platform}) is awake`);const getInstallSaveExactCommands=(p,r,f)=>{log('getInstallSaveExactCommands');const c=(0,_common.transform)(p);const commands=`npm i ${c}`;return(0,_common.normalise)((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.normalise)((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.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveProdParameter)(commands));}function installSaveBundleSaveExact(d,p,r,f){log('installSaveBundleSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveBundleSaveExactCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveBundle(d,p,r,f){log('installSaveBundle');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveBundleCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptionalSaveExact(d,p,r,f){log('installSaveOptionalSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveOptionalSaveExactCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptional(d,p,r,f){log('installSaveOptional');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveOptionalCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDevSaveExact(d,p,r,f){log('installSaveDevSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveDevSaveExactCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDev(d,p,r,f){log('installSaveDev');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveDevCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProdSaveExact(d,p,r,f){log('installSaveProdSaveExact');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveProdSaveExactCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProd(d,p,r,f){log('installSaveProd');return new Promise((resolve,reject)=>{const commands=(0,_common.getCommands)(d,getInstallSaveProdCommands(p,r,f));(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const 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 _os=require("os");var _child_process=require("child_process");var _common=require("./common");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}const log=(0,_debug.default)('@modernpoacher/deps');log(`\`deps\` (${_os.platform}) is awake`);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.normalise)((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.normalise)((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.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveBundleCommands(p,r,f){log('getInstallSaveBundleCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveBundleParameter)(commands));}function getInstallSaveOptionalSaveExactCommands(p,r,f){log('getInstallSaveOptionalSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveOptionalCommands(p,r,f){log('getInstallSaveOptionalCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveOptionalParameter)(commands));}function getInstallSaveDevSaveExactCommands(p,r,f){log('getInstallSaveDevSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveDevCommands(p,r,f){log('getInstallSaveDevCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveDevParameter)(commands));}function getInstallSaveProdSaveExactCommands(p,r,f){log('getInstallSaveProdSaveExactCommands');const commands=getInstallSaveExactCommands(p,r,f);return(0,_common.normalise)((0,_common.getSaveProdParameter)(commands));}function getInstallSaveProdCommands(p,r,f){log('getInstallSaveProdCommands');const commands=getInstallCommands(p,r,f);return(0,_common.normalise)((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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveBundle(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptionalSaveExact(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveOptional(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDevSaveExact(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveDev(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProdSaveExact(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}function installSaveProd(d,p,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));log(commands);(0,_child_process.spawn)('/bin/bash',['-c',commands],{shell:true,stdio:'inherit'},e=>!e?resolve():reject(e)).on('close',resolve).on('error',reject);});}async function executeBundle(directory=_common.DIRECTORY,packages={},configuration={},registry=_common.REGISTRY,force=false){log('executeBundle');const 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);}
|
package/package.json
CHANGED
package/src/common/index.js
CHANGED
|
@@ -129,11 +129,11 @@ export PATH=/usr/local/bin:$PATH &> /dev/null
|
|
|
129
129
|
|
|
130
130
|
cd "${directory}"
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
. "${NVM}" 2> /dev/null
|
|
133
133
|
|
|
134
134
|
${commands}
|
|
135
135
|
|
|
136
|
-
exit 0
|
|
136
|
+
# exit 0
|
|
137
137
|
`).replace(/\n\n/gm, String.fromCharCode(10)).trim()
|
|
138
138
|
|
|
139
139
|
/**
|
package/src/index.js
CHANGED
|
@@ -29,6 +29,20 @@ const log = debug('@modernpoacher/deps')
|
|
|
29
29
|
|
|
30
30
|
log(`\`deps\` (${platform}) is awake`)
|
|
31
31
|
|
|
32
|
+
function use (key) {
|
|
33
|
+
const log = debug(`@modernpoacher/deps:${key}`)
|
|
34
|
+
|
|
35
|
+
return function use (v) {
|
|
36
|
+
const s = v.trim()
|
|
37
|
+
|
|
38
|
+
if (s === '') return
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
log(s)
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
/**
|
|
33
47
|
* @function getInstallSaveExactCommands
|
|
34
48
|
*
|
|
@@ -258,8 +272,11 @@ export function installSaveBundleSaveExact (d, p, r, f) {
|
|
|
258
272
|
|
|
259
273
|
return (
|
|
260
274
|
new Promise((resolve, reject) => {
|
|
275
|
+
const log = use('install-save-bundle-save-exact')
|
|
261
276
|
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
262
277
|
|
|
278
|
+
log(commands)
|
|
279
|
+
|
|
263
280
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
264
281
|
.on('close', resolve)
|
|
265
282
|
.on('error', reject)
|
|
@@ -284,8 +301,11 @@ export function installSaveBundle (d, p, r, f) {
|
|
|
284
301
|
|
|
285
302
|
return (
|
|
286
303
|
new Promise((resolve, reject) => {
|
|
304
|
+
const log = use('install-save-bundle')
|
|
287
305
|
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f))
|
|
288
306
|
|
|
307
|
+
log(commands)
|
|
308
|
+
|
|
289
309
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
290
310
|
.on('close', resolve)
|
|
291
311
|
.on('error', reject)
|
|
@@ -310,8 +330,11 @@ export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
|
310
330
|
|
|
311
331
|
return (
|
|
312
332
|
new Promise((resolve, reject) => {
|
|
333
|
+
const log = use('install-save-otional-save-exact')
|
|
313
334
|
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
314
335
|
|
|
336
|
+
log(commands)
|
|
337
|
+
|
|
315
338
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
316
339
|
.on('close', resolve)
|
|
317
340
|
.on('error', reject)
|
|
@@ -336,8 +359,11 @@ export function installSaveOptional (d, p, r, f) {
|
|
|
336
359
|
|
|
337
360
|
return (
|
|
338
361
|
new Promise((resolve, reject) => {
|
|
362
|
+
const log = use('install-save-otional')
|
|
339
363
|
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f))
|
|
340
364
|
|
|
365
|
+
log(commands)
|
|
366
|
+
|
|
341
367
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
342
368
|
.on('close', resolve)
|
|
343
369
|
.on('error', reject)
|
|
@@ -362,8 +388,11 @@ export function installSaveDevSaveExact (d, p, r, f) {
|
|
|
362
388
|
|
|
363
389
|
return (
|
|
364
390
|
new Promise((resolve, reject) => {
|
|
391
|
+
const log = use('install-save-dev-save-exact')
|
|
365
392
|
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
366
393
|
|
|
394
|
+
log(commands)
|
|
395
|
+
|
|
367
396
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
368
397
|
.on('close', resolve)
|
|
369
398
|
.on('error', reject)
|
|
@@ -388,8 +417,11 @@ export function installSaveDev (d, p, r, f) {
|
|
|
388
417
|
|
|
389
418
|
return (
|
|
390
419
|
new Promise((resolve, reject) => {
|
|
420
|
+
const log = use('install-save-dev')
|
|
391
421
|
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f))
|
|
392
422
|
|
|
423
|
+
log(commands)
|
|
424
|
+
|
|
393
425
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
394
426
|
.on('close', resolve)
|
|
395
427
|
.on('error', reject)
|
|
@@ -414,8 +446,11 @@ export function installSaveProdSaveExact (d, p, r, f) {
|
|
|
414
446
|
|
|
415
447
|
return (
|
|
416
448
|
new Promise((resolve, reject) => {
|
|
449
|
+
const log = use('install-save-prod-save-exact')
|
|
417
450
|
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
418
451
|
|
|
452
|
+
log(commands)
|
|
453
|
+
|
|
419
454
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
420
455
|
.on('close', resolve)
|
|
421
456
|
.on('error', reject)
|
|
@@ -440,8 +475,11 @@ export function installSaveProd (d, p, r, f) {
|
|
|
440
475
|
|
|
441
476
|
return (
|
|
442
477
|
new Promise((resolve, reject) => {
|
|
478
|
+
const log = use('install-save-prod')
|
|
443
479
|
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f))
|
|
444
480
|
|
|
481
|
+
log(commands)
|
|
482
|
+
|
|
445
483
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
446
484
|
.on('close', resolve)
|
|
447
485
|
.on('error', reject)
|