Browse Source

Current Build

production
chess 3 years ago
parent
commit
b47d6ef87a
1 changed files with 137 additions and 200 deletions
  1. 137
    200
      i.js

+ 137
- 200
i.js View File

@@ -1,4 +1,4 @@
/* Version: 1.0.0 - August 11, 2021 17:45:09 */
/* Version: 1.0.0 - August 23, 2021 14:13:43 */
'use strict';

var path$1 = require('path');
@@ -12546,7 +12546,7 @@ var moment = createCommonjsModule(function (module, exports) {
return hooks;

})));
}, "/$$rollup_base$$/node_modules/moment");
}, "E:/elixir/production_A/bbhverse/node_modules/moment");

let array8 = arrayUntyped,
array16 = arrayUntyped,
@@ -17921,7 +17921,6 @@ function md5ii(a, b, c, d, x, s, t) {
}

var v3 = v35('v3', 0x30, md5);
var v3$1 = v3;

function v4(options, buf, offset) {
options = options || {};
@@ -18039,7 +18038,6 @@ function sha1(bytes) {
}

var v5 = v35('v5', 0x50, sha1);
var v5$1 = v5;

var nil = '00000000-0000-0000-0000-000000000000';

@@ -18054,9 +18052,9 @@ function version$1(uuid) {
var esmBrowser = /*#__PURE__*/Object.freeze({
__proto__: null,
v1: v1,
v3: v3$1,
v3: v3,
v4: v4,
v5: v5$1,
v5: v5,
NIL: nil,
version: version$1,
validate: validate,
@@ -18064,7 +18062,7 @@ var esmBrowser = /*#__PURE__*/Object.freeze({
parse: parse$1
});

var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(esmBrowser);
var require$$1 = /*@__PURE__*/getAugmentedNamespace(esmBrowser);

// var __g = __G.__g;
globalThis_1.mediator = mediator.apply({});
@@ -19061,7 +19059,7 @@ const BitArray = (function(){


// var uuidv1 = require('uuid/v1');
const { v1: uuidv1 } = require$$1$1;
const { v1: uuidv1 } = require$$1;
console.log(uuidv1);

// Mixins.
@@ -23922,11 +23920,8 @@ var common = {
childrenIgnored: childrenIgnored_1
};

var require$$1 = glob_1;

var sync = globSync;
globSync.GlobSync = GlobSync$1;
require$$1.Glob;



@@ -24531,48 +24526,6 @@ function slice (args) {
return array
}

// Approach:
//
// 1. Get the minimatch set
// 2. For each pattern in the set, PROCESS(pattern, false)
// 3. Store matches per-set, then uniq them
//
// PROCESS(pattern, inGlobStar)
// Get the first [n] items from pattern that are all strings
// Join these together. This is PREFIX.
// If there is no more remaining, then stat(PREFIX) and
// add to matches if it succeeds. END.
//
// If inGlobStar and PREFIX is symlink and points to dir
// set ENTRIES = []
// else readdir(PREFIX) as ENTRIES
// If fail, END
//
// with ENTRIES
// If pattern[n] is GLOBSTAR
// // handle the case where the globstar match is empty
// // by pruning it out, and testing the resulting pattern
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
// // handle other cases.
// for ENTRY in ENTRIES (not dotfiles)
// // attach globstar + tail onto the entry
// // Mark that this entry is a globstar match
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
//
// else // not globstar
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
// Test ENTRY against pattern[n]
// If fails, continue
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
//
// Caveat:
// Cache all stats and readdirs results to minimize syscall. Since all
// we ever care about is existence and directory-ness, we can just keep
// `true` for files, and [children,...] for directories, or `false` for
// things that don't exist.

var glob_1 = glob;

var EE = require$$0__default$1['default'].EventEmitter;


@@ -24585,63 +24538,7 @@ var ownProp = common.ownProp;

var childrenIgnored = common.childrenIgnored;
var isIgnored = common.isIgnored;



function glob (pattern, options, cb) {
if (typeof options === 'function') cb = options, options = {};
if (!options) options = {};

if (options.sync) {
if (cb)
throw new TypeError('callback provided to sync glob')
return sync(pattern, options)
}

return new Glob(pattern, options, cb)
}

glob.sync = sync;
var GlobSync = glob.GlobSync = sync.GlobSync;

// old api surface
glob.glob = glob;

function extend (origin, add) {
if (add === null || typeof add !== 'object') {
return origin
}

var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin
}

glob.hasMagic = function (pattern, options_) {
var options = extend({}, options_);
options.noprocess = true;

var g = new Glob(pattern, options);
var set = g.minimatch.set;

if (!pattern)
return false

if (set.length > 1)
return true

for (var j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== 'string')
return true
}

return false
};

glob.Glob = Glob;
var GlobSync = sync.GlobSync;
inherits(Glob, EE);
function Glob (pattern, options, cb) {
if (typeof options === 'function') {
@@ -25436,7 +25333,7 @@ var nodeShellExec = cliverse.nodeShellExec;



const BUILD_VERSION = 'Version: 1.0.0 - built on August 11, 2021 17:45:09';
const BUILD_VERSION = 'Version: 1.0.0 - built on August 23, 2021 14:13:43';
const runtimestamp = (new Date()).getTime();
function getVersion() { return BUILD_VERSION; }
console.log(getVersion());
@@ -25459,14 +25356,6 @@ const fs = fs__default['default'];
const cliargs = bbhverse.cliargs;
const processedArgs = cliargs(process.argv.slice(2));
console.dir(processedArgs);
// PB : TODO -- defaults for valuless arguments if passed.
// Object.keys(processedArgs).forEach(a=>{
// if(Object.prototype.toString.call(processedArgs[a]) === '[object Undefined]' || !processedArgs[a]) || trim(processedArgs[a])) == '') {

// }
// })

require$$1.sync;

var ENV = Object.assign({}, process.env); // Shallow clone it.

@@ -25541,7 +25430,6 @@ var getTaskWithElevation = function(tasdef){
var getTaskWithoutElevation = function(tasdef){
return ()=>{
if(!processedArgs.runas) { return tasdef.regularpulltasks(); }
else Promise.resolve(true);
}
};

@@ -25963,6 +25851,40 @@ var op = {
// git remote equivalents...
// git branch --set-upstream-to=elixir-unc/master master
// git push --set-upstream elixir-unc branch..
, 'remote': (args) => {
// Subcommands!
if(!processedArgs.v) return false;

var serial_perform = (repo) => {
var options = { cwd: instanceroot + '/' + repo };
return [
['git', ['remote', '-v'], options]
]
};

var x = (args) => {
var tasq = () => {
// console.log(args)
return nodeShellExec.apply(null, args).catch(e => {
// We continue on failure.
console.error(tasq.toString());
})
};
tasq.toString = function(){
return JSON.stringify(args)
};
return tasq;
};

var perform = (dir) => {
return any(serial_perform(dir.name).map(x))
};

dirs(perform);
}

, 'remote set-url': (args) => {
// git remote set-url elixir-unc //10.10.5.60/gitrepo/chess/bbhverse
var __args = {
@@ -26009,7 +25931,7 @@ var op = {
};
var perform_git_seturl = (dir) => {
op['is-git-repo'](dir).then((logEntry) => {
any(serial_perform_git_seturl(dir.name).map(x));
return any(serial_perform_git_seturl(dir.name).map(x))
}).catch((e) => {
// console.log('Failed : ' + dir.name)
});
@@ -27031,19 +26953,41 @@ var elxr = {
}
, getpulltask(def){

def = (def ? (
def.requiresElevation = true,
def.reqularRepos = def.repos,
def.elevatedRepos = def.elevatedRunasRepos
// def can be an instance config
// Or an object with many repos and elevated repos
// Or a single repo ( Either Elevated or normal. )

) : false) || {
requiresElevation : true,
reqularRepos : gitRepos,
elevatedRepos : elevatedRunasRepos
def = def || {
repos : repomanifest.repos,
elevated : repomanifest.elevated
};

var elevatedpulltasks = null;
if(def.repo) {
// Single repo case.
if(def.repo.requiresElevation) {
elevatedpulltasks = function() {
return performPull(def.repo).then(() => {
return true;
}).catch((e) => {
console.error(e);
})
};
return
}
else {
var regularpulltasks = function(){
var pendingpulls = [];
pendingpulls.push(performPull(def.repo));
return Promise.all(pendingpulls).finally(Traq.finally)
};
}
if(elevatedpulltasks) return getTaskWithElevation( { elevatedpulltasks, regularpulltasks} )
else return getTaskWithoutElevation({ regularpulltasks})
}
console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`);
// console.log(`-------------------Processing pull for : ${def.repo} ${def.branch}`)
console.dir(def);

Object.assign({}, process.env); // Shallow clone it.
@@ -27051,30 +26995,30 @@ var elxr = {

processedArgs.useGitPull || false;

if(def.elevatedRepos || def.reqularRepos) {
if(def.elevatedRepos) def.requiresElevation = true;
if(def.elevated || def.repos) {
if(def.elevated) def.requiresElevation = true;
else delete def.requiresElevation;
}
else {
if(def.requiresElevation) def.elevatedRepos = [def];
else def.reqularRepos = [def];
if(def.requiresElevation) def.elevated = [def];
else def.repos = [def];
}

var elevatedpulltasks = null;
var regularpulltasks = function(){ return Promise.resolve(true) };
if(def.elevatedRepos){
if(def.elevated){
elevatedpulltasks = function() {
return any(def.elevatedRepos.map((def) => performPull(def.repo))).then(() => {
return any(def.elevated.map((def) => performPull(def.repo))).then(() => {
return true;
}).catch((e) => {
console.error(e);
})
};
}
if(def.reqularRepos) {
if(def.repos) {
var regularpulltasks = function(){
var pendingpulls = [];
def.reqularRepos.forEach((def) => { pendingpulls.push(performPull(def.repo)); });
def.repos.forEach((def) => { pendingpulls.push(performPull(def.repo)); });
return Promise.all(pendingpulls).finally(Traq.finally)
};
}
@@ -27098,7 +27042,7 @@ function preworkerconfig(){
// The main elxr cli process
function elxrworker() {
var subcommandlabels = {
remote : `remote ${processedArgs._[1]}`
remote : (`remote ${processedArgs._[1] || ''}`).trim()
};

var __runcmd = function (label) {
@@ -27216,6 +27160,29 @@ We will run your choice at the next prompt.
})
}

var mergeObjByKey = function(arrOfObjs, keyName) {

var keyedDistinct = {};
var distinctArrOfObjs = [];

arrOfObjs.forEach( o => {
if(o) (keyedDistinct[o[keyName]] || (keyedDistinct[o[keyName]] = []) ).push(o);
});
Object.keys(keyedDistinct).forEach(key => {
distinctArrOfObjs.push( bbhverse.assign( ...keyedDistinct[key] ) ); // PB : TODO -- Shallow use utils.assign
});

return distinctArrOfObjs;
};

var cacheWriteInstanceConfig = function(chessinstances){
var instanceName = chessinstances['current_run'].instanceName;
var node_env = chessinstances['current_run'].node_env;
chessinstances[instanceName][node_env].repos = mergeObjByKey(chessinstances[instanceName][node_env].repos, 'repo') ;
chessinstances[instanceName][node_env].elevated = mergeObjByKey(chessinstances[instanceName][node_env].elevated, 'repo') ;
fs.writeFileSync(instanceroot + '/chessinstances.js', 'module.exports = ' + JSON.stringify(chessinstances, null, 2) + '', { 'flag': 'w' });
};

var acquireConfig = function (selected, chessinstances) {

var configrepo = selected.instanceName + '-config-' + selected.node_env;
@@ -27228,9 +27195,11 @@ var acquireConfig = function (selected, chessinstances) {
chessinstances[selected.instanceName][selected.node_env] = chessinstances[selected.instanceName][selected.node_env] || {};
chessinstances['current_run'] = { instanceName: selected.instanceName, node_env: selected.node_env };
// Config from server always override merges into selection ecept for the current selection.
// PB : TODO -- utils.assign Array merges are non-distinct...
selectedinstance = bbhverse.assign(chessinstances[selected.instanceName][selected.node_env], selected, repomanifest);
// chessinstances[selectedinstance.instanceName][selectedinstance.node_env] = selectedinstance;
fs.writeFileSync(instanceroot + '/chessinstances.js', 'module.exports = ' + JSON.stringify(chessinstances, null, 2) + '', { 'flag': 'w' });
cacheWriteInstanceConfig(chessinstances);
selectedinstance = chessinstances[selected.instanceName][selected.node_env];
// PB : TODO -- We should probably write the new server config also...
selectedinstance.reposerver = selectedinstance.reposerver || selectedinstance.reposervers[0]; // PB : TODO -- Attempt first one that is available and online...
ENV.NODE_ENV = selectedinstance.node_env;
@@ -27671,45 +27640,44 @@ acquireElevationState().then(() => {
selectedinstance = Object.assign(detectedInstance, clioverrides);
var todo = Promise.resolve(true);
var promptkeys = { 'instanceName' : processedArgs._[1] };

var reconfirm = {
'instanceName' : selectedinstance['instanceName'] === 'chess'
};
var prompts = [];
var eachPrompt = function(k, i, a){
// No local instances config found. We use a default initialized instance available in selectedinstance
// Confirm those that were not supplied as user choices in runtime args and proceed to reattempt.
if(promptkeys[k] && selectedinstance[k] !== promptkeys[k] || promptkeys[k] === undefined && selectedinstance[k] === undefined
|| reconfirm[k]) {
prompts.push(async ()=>{
// PB : NOTE -- Important in async cases when this needs to be in the same state as when it was invoked.
// We take a snapshot... Shallow.. !! If required deep should be used based on use case.
// If latest altered state is required we can reerence this directly.
// var asyncthis = Object.assign(this);
Object.defineProperty(selectedinstance, k, getPromptableAsyncPropDescriptor(k, choices[k], promptkeys[k] || selectedinstance[k] ));
return await selectedinstance[k]
});
}
delete promptkeys[k];
};
try {
chessinstances = acquirelocalinstances(selectedinstance);
var promptkeys = {
'instanceName' : processedArgs._[1]
};

var reconfirm = {
'instanceName' : true
};

initinstances(chessinstances, selectedinstance);
var instanceNameChoices = new Set(Object.keys( chessinstances) );
instanceNameChoices.delete('current_run');
instanceNameChoices.add(selectedinstance['instanceName']);
instanceNameChoices.add(promptkeys['instanceName']);
if(promptkeys['instanceName']) instanceNameChoices.add(promptkeys['instanceName']);
var choices = {
'instanceName' : Array.from(instanceNameChoices)
, 'reposerver' : selectedinstance['reposervers']
};
var prompts = [];
var eachPrompt = function(k, i, a){
// No local instances config found. We use a default initialized instance available in selectedinstance
// Confirm those that were not supplied as user choices in runtime args and proceed to reattempt.
if(selectedinstance[k] !== promptkeys[k] || promptkeys[k] === undefined || reconfirm[k]) {
prompts.push(async ()=>{
// PB : NOTE -- Important in async cases when this needs to be in the same state as when it was invoked.
// We take a snapshot... Shallow.. !! If required deep should be used based on use case.
// If latest altered state is required we can reerence this directly.
// var asyncthis = Object.assign(this);
Object.defineProperty(selectedinstance, k, getPromptableAsyncPropDescriptor(k, choices[k], promptkeys[k] || selectedinstance[k] ));
return await selectedinstance[k]
});
}
delete promptkeys[k];
};

Object.keys(__interactve_promts).forEach(eachPrompt, __interactve_promts);
Object.keys(promptkeys).forEach(eachPrompt, promptkeys);
@@ -27718,51 +27686,20 @@ acquireElevationState().then(() => {
}
catch (e) {
console.error(e);
// Basic keys that must be prompted and confirmed if not supplied as cmd line args.
// PB: TODO --- This should be cmd specific interpretation of location parameters !!!
var promptkeys = {
'instanceName' : processedArgs._[1]
};

var reconfirm = {
'instanceName' : true
};

console.error(e); // Missing chessinstances is not an error...
initinstances(chessinstances, selectedinstance);
var instanceNameChoices = new Set(Object.keys( chessinstances) );
instanceNameChoices.delete('current_run');
instanceNameChoices.add(selectedinstance['instanceName']);
instanceNameChoices.add(promptkeys['instanceName']);
if(promptkeys['instanceName']) instanceNameChoices.add(promptkeys['instanceName']);
var choices = {
'instanceName' : Array.from(instanceNameChoices)
, 'reposerver' : selectedinstance['reposervers']
};
var prompts = [];
var eachPrompt = function(k, i, a){
// No local instances config found. We use a default initialized instance available in selectedinstance
// Confirm those that were not supplied as user choices in runtime args and proceed to reattempt.
if(selectedinstance[k] !== promptkeys[k] || promptkeys[k] === undefined || reconfirm[k]) {
prompts.push(async ()=>{
// PB : NOTE -- Important in async cases when this needs to be in the same state as when it was invoked.
// We take a snapshot... Shallow.. !! If required deep should be used based on use case.
// If latest altered state is required we can reerence this directly.
// var asyncthis = Object.assign(this);
Object.defineProperty(selectedinstance, k, getPromptableAsyncPropDescriptor(k, choices[k], promptkeys[k] || selectedinstance[k] ));
return await selectedinstance[k]
});
}
delete promptkeys[k];
};

Object.keys(__interactve_promts).forEach(eachPrompt, __interactve_promts);
Object.keys(promptkeys).forEach(eachPrompt, promptkeys);

Loading…
Cancel
Save