Browse Source

Elxr Upgrades

master
pb 1 year ago
parent
commit
0c94636753
1 changed files with 44 additions and 39 deletions
  1. 44
    39
      index.js

+ 44
- 39
index.js View File



"use strict"; "use strict";



var __g = require('global-this'); var __g = require('global-this');
var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns. var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns.
__g.env = ENV __g.env = ENV
var statuslog = utils.Traq var statuslog = utils.Traq
var Traq = utils.Traq var Traq = utils.Traq



var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns. var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns.
const cliargs = utils.cliargs; const cliargs = utils.cliargs;
const processedArgs = cliargs(process.argv.slice(2)); const processedArgs = cliargs(process.argv.slice(2));
// , 'undefined' : true // , 'undefined' : true
} }


var __default = {
// Common baseline repos for all chess chessinstances.
repos : [
{ repo : 'ember-masonry-grid' /*, branch : master*/ } // Default need not be specified.
, { repo : 'bbhverse' }
, { repo : 'clientverse' }
, { repo : 'serververse' }
, { repo : 'elxr' }
, { repo : 'ember-searchable-select' }
, { repo : 'loopback-component-jsonapi' }
, { repo : 'loopback-jsonapi-model-serializer' }
, { repo : 'loopback-connector-mysql' }
, { repo : 'loopback-connector-ds' }
, { repo : 'ember-service-worker' }
, { repo : 'ember-service-worker-asset-cache' }
, { repo : 'ember-service-worker-cache-fallback' }
, { repo : 'ember-service-worker-index' }
, { repo : 'ember-sw-client-route' }
, { repo : 'global-this' }
]
// Requires elevation only in windows
, elevated : [ { repo : 'chess-server-lib', requiresElevation : true } ]
, exludeMergeRepos : { }
}; // PB : TODO -- Use initialized instance instead of __default everywhere.

var cmds = { var cmds = {
remote : { remote : {
interpret() { return utils.assign_core( { keycase: true, arraymergetype : utils.assign_core.DISTINCT_UNION } interpret() { return utils.assign_core( { keycase: true, arraymergetype : utils.assign_core.DISTINCT_UNION }
, switch : { , switch : {
interpret() { interpret() {
return { cmd : subcommandlabels['switch'], runchoice : 'c', username : processedArgs._[2] return { cmd : subcommandlabels['switch'], runchoice : 'c', username : processedArgs._[2]
, reposerver : __default.reposerver
, reposerver : __default.reposerver // .?.?.?
} }
} }
, getPossiblePrompts(){ return { username : true, reposerver : 'http://git.bbh' } } // Requires only one argument... , getPossiblePrompts(){ return { username : true, reposerver : 'http://git.bbh' } } // Requires only one argument...
var interpreted = this var interpreted = this
// Non custom command has universal positiona args. // Non custom command has universal positiona args.
processedArgs._[1] ? interpreted.instanceName = processedArgs._[1] : null; processedArgs._[1] ? interpreted.instanceName = processedArgs._[1] : null;
interpreted.runchoice = interpreted.cmd ? 'c' : null
// interpreted.runchoice = processedArgs._[0] || selectedinstance.runchoice; // interpreted.runchoice = processedArgs._[0] || selectedinstance.runchoice;
// return clioverrides // return clioverrides
// cmds[cmd] = { // cmds[cmd] = {
if( shouldPrompt(k, possiblePrompts, target) ) { if( shouldPrompt(k, possiblePrompts, target) ) {
delete reconfirm[k]; delete reconfirm[k];
// console.log(k) // console.log(k)
console.dir(possiblePrompts); //console.dir(target)
// console.dir(possiblePrompts); //console.dir(target)
prompts.push(async ()=>{ prompts.push(async ()=>{
// PB : NOTE -- Important in async cases when this {{target}} needs to be in the same state as when it was invoked. // PB : NOTE -- Important in async cases when this {{target}} needs to be in the same state as when it was invoked.
// We need to take a snapshot... Shallow.. !! If required deep should be used based on use case. // We need to take a snapshot... Shallow.. !! If required deep should be used based on use case.
// PB : TODO -- Override cli prefs and call with undefined selectedinstance only if there is no cli overide or selection. // PB : TODO -- Override cli prefs and call with undefined selectedinstance only if there is no cli overide or selection.
acquirelocalinstances( { root : ENV.wd } ) acquirelocalinstances( { root : ENV.wd } )


function createLocalChessInstance( cfg ){
// return createInstance(cfg)
reconfirm = getReconfirmAll()
var inst = {};
var __new = Object.assign({}, __default, cfg)
inst[cfg.node_env] = __new; return inst;
}

if(chessinstances.error) { if(chessinstances.error) {
delete chessinstances.error delete chessinstances.error
// use installchoices only when we don't find chessinstances. // use installchoices only when we don't find chessinstances.
return pendingtasks.then((instance)=>{ return pendingtasks.then((instance)=>{
// PB : TODO -- Embed defaults in the build instead of inlining here... // PB : TODO -- Embed defaults in the build instead of inlining here...
var __default = {
// Common baseline repos for all chess chessinstances.
repos : [
{ repo : 'ember-masonry-grid' /*, branch : master*/ } // Default need not be specified.
, { repo : 'bbhverse' }
, { repo : 'clientverse' }
, { repo : 'serververse' }
, { repo : 'elxr' }
, { repo : 'ember-searchable-select' }
, { repo : 'loopback-component-jsonapi' }
, { repo : 'loopback-jsonapi-model-serializer' }
, { repo : 'loopback-connector-mysql' }
, { repo : 'loopback-connector-ds' }
, { repo : 'ember-service-worker' }
, { repo : 'ember-service-worker-asset-cache' }
, { repo : 'ember-service-worker-cache-fallback' }
, { repo : 'ember-service-worker-index' }
, { repo : 'ember-sw-client-route' }
, { repo : 'global-this' }
]
// Requires elevation only in windows
, elevated : [ { repo : 'chess-server-lib', requiresElevation : true } ]
, exludeMergeRepos : { }
}; // PB : TODO -- Use initialized instance instead of __default everywhere.
// PB : TODO -- All these values instanceName, node_env, username, reposervers should come from instace overridden by a finalized cliovrrides... // PB : TODO -- All these values instanceName, node_env, username, reposervers should come from instace overridden by a finalized cliovrrides...
// Also attepmt to load preconfig specially for new chessinstances from ../chess-config/... // Also attepmt to load preconfig specially for new chessinstances from ../chess-config/...
, instance_specific_config_manifest , instance_specific_config_manifest
, clioverrides , clioverrides
) )
console.dir(__pvt)
// console.dir(__pvt)
// Unmergable server overrides // Unmergable server overrides
Object.keys(instance_specific_config_manifest).forEach( key => { Object.keys(instance_specific_config_manifest).forEach( key => {
__pvt[key] = instance_specific_config_manifest[key] __pvt[key] = instance_specific_config_manifest[key]
} }
// promptkeys.runchoice = promptkeys.cmd ? 'c' : undefined // promptkeys.runchoice = promptkeys.cmd ? 'c' : undefined


function createLocalChessInstance( cfg ){
// return createInstance(cfg)
reconfirm = getReconfirmAll()
var inst = {};
var __new = Object.assign({}, __default, cfg)
inst[cfg.node_env] = __new; return inst;
}


var choices = { var choices = {
'instanceName' : [] 'instanceName' : []
, 'reposerver' : [] , 'reposerver' : []
var remotes = []; var remotes = [];
var instanceNames = [] var instanceNames = []
var instanceTypes = ['development', 'production']; var instanceTypes = ['development', 'production'];

// Accumulate all known choices from every possible instance...
Object.keys( chessinstances).forEach(instanceName => { Object.keys( chessinstances).forEach(instanceName => {
if(instanceName === 'current_run') return;
if(instanceName === 'current_run') return ;
Object.keys( chessinstances[instanceName] ).forEach(node_env=>{ Object.keys( chessinstances[instanceName] ).forEach(node_env=>{
var instance = chessinstances[instanceName][node_env]; var instance = chessinstances[instanceName][node_env];
reposervers = reposervers.concat(instance.reposervers) reposervers = reposervers.concat(instance.reposervers)
// if(cmdprompts.instanceName) { // if(cmdprompts.instanceName) {
// not an instanceless cmd. // not an instanceless cmd.
console.dir(selectedinstance)
// console.dir(selectedinstance)
try { try {


// chessinstances = acquirelocalinstances(selectedinstance); // chessinstances = acquirelocalinstances(selectedinstance);

Loading…
Cancel
Save