@modernpoacher/deps 1.6.14 → 1.6.15
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 +7 -5
- package/lib/common/git/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/install/index.js +1 -1
- package/package.json +1 -1
- package/src/common/git/index.js +2 -2
- package/src/index.js +2 -2
- package/src/install/index.js +2 -2
package/bin/common/index.js
CHANGED
|
@@ -51,8 +51,8 @@ const OPTIONS = {
|
|
|
51
51
|
env: {
|
|
52
52
|
DEBUG_COLORS: 'yes',
|
|
53
53
|
FORCE_COLOR: PLATFORM === 'win32'
|
|
54
|
-
?
|
|
55
|
-
:
|
|
54
|
+
? 3
|
|
55
|
+
: 2
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ const MESSAGE = 'Either no error message has been defined or no error has been s
|
|
|
62
62
|
|
|
63
63
|
const tidy = (v) => v.replace(/\n\n/gm, '\n').trim()
|
|
64
64
|
|
|
65
|
-
const trim = (v) => v.split('\n').map((v) => v.
|
|
65
|
+
const trim = (v) => v.split('\n').map((v) => v.trim()).join('\n').trim()
|
|
66
66
|
|
|
67
67
|
const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePath = relative.bind(null, process.cwd())
|
|
68
68
|
|
|
@@ -95,10 +95,12 @@ function use (key) {
|
|
|
95
95
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
96
96
|
|
|
97
97
|
return function use (v) {
|
|
98
|
-
|
|
98
|
+
const s = v.trim()
|
|
99
|
+
|
|
100
|
+
if (s === '') return
|
|
99
101
|
|
|
100
102
|
return (
|
|
101
|
-
log(trim(
|
|
103
|
+
log(trim(s))
|
|
102
104
|
)
|
|
103
105
|
}
|
|
104
106
|
}
|
package/lib/common/git/index.js
CHANGED
|
@@ -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:{DEBUG_COLORS:'yes',FORCE_COLOR:_env.PLATFORM==='win32'?2
|
|
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]}"
|
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'?2
|
|
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);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/lib/install/index.js
CHANGED
|
@@ -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'?2
|
|
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);}
|
package/package.json
CHANGED
package/src/common/git/index.js
CHANGED
package/src/index.js
CHANGED