Browse Source

Fixed npm i errors

pull/6/head
guest 3 years ago
parent
commit
303892fc61
1 changed files with 14 additions and 8 deletions
  1. 14
    8
      index.js

+ 14
- 8
index.js View File



return any(tasks).then(() => { return any(tasks).then(() => {


gitRepos.push('chess-server-lib/server');
gitRepos.push({ repo : 'chess-server-lib/server'});
gitRepos = gitRepos.concat(elevatedRunasRepos); gitRepos = gitRepos.concat(elevatedRunasRepos);
// console.dir(gitRepos)
// throw ""


// gitRepos = [ // gitRepos = [
// // 'bbhverse', 'serververse', 'elixir-server', // // 'bbhverse', 'serververse', 'elixir-server',
} }
}) })


// NODE_ENV=development DEBUG=loopback:connector:mssql node --tls-min-v1.0 --inspect elixir/server.js
// PB : NOTE -- npm i for client does not complete when NODE_ENV=production // PB : NOTE -- npm i for client does not complete when NODE_ENV=production
// therefore bower doesn't get installed !!! which then fails installing the bower dependenciew !!! // therefore bower doesn't get installed !!! which then fails installing the bower dependenciew !!!
// We work around this by running npm i for client without any NODE_ENV which probably defualts to development. // We work around this by running npm i for client without any NODE_ENV which probably defualts to development.
// }) // })


var bowerRepos = [{ repo : 'client'}] var bowerRepos = [{ repo : 'client'}]
var bowertasks = []
bowerRepos.forEach(repodef => { bowerRepos.forEach(repodef => {
repotasks.push(() => {
bowertasks.push(() => {
console.log(instanceroot + '/' + repodef.repo + '/node_modules/bower/bin/bower') console.log(instanceroot + '/' + repodef.repo + '/node_modules/bower/bin/bower')
// var p = nodeShellExec('node_modules/bower/bin/bower', ['install'], { // var p = nodeShellExec('node_modules/bower/bin/bower', ['install'], {
var p = nodeShellExec(`"${gitbash}"`, ['-c', '"node_modules/bower/bin/bower i"'], { var p = nodeShellExec(`"${gitbash}"`, ['-c', '"node_modules/bower/bin/bower i"'], {
}) })
}) })
// console.log('rmtasks.length : ' + rmtasks.length) // console.log('rmtasks.length : ' + rmtasks.length)
return Promise.all(rmtasks).then(() => any(repotasks));
return Promise.all(rmtasks).then(() => any(repotasks)).then(()=>any(bowertasks));
}).catch(e => { }).catch(e => {
console.error(e) console.error(e)
}).finally(statuslog.finally) }).finally(statuslog.finally)
tasks = tasks.concat( tasks = tasks.concat(
[ [
() => { () => {
var p = nodeShellExec('mklink', ['/J', 'data', runconfig.use + '-data' + '-' + process.env.NODE_ENV], {
var dataToLink = runconfig.use + '-data' + '-' + process.env.NODE_ENV
if(!existsSync(dataToLink)) dataToLink = runconfig.use + '-data';
var p = nodeShellExec('mklink', ['/J', 'data', dataToLink], {
inherit: true, shell: true inherit: true, shell: true
, cwd : instanceroot , cwd : instanceroot
, env: process.env , env: process.env
return { return {
clusterNodeInstance(selected) { var clusternodename = 'node01' clusterNodeInstance(selected) { var clusternodename = 'node01'
return __acquireData(selected, selected.username, clusternodename return __acquireData(selected, selected.username, clusternodename
, selected.instanceName + '-config-' + selected.node_env + `-${clusternodename}`
, selected.instanceName + '-data-' + selected.node_env + `-${clusternodename}`
, function(e){ console.info('Customized node level config not found. This is not an Error. Will attempt with owner level config.'); , function(e){ console.info('Customized node level config not found. This is not an Error. Will attempt with owner level config.');
return e; } return e; }
) )
} }
, ownerInstnace(selected) { return __acquireData(selected, selected.username, null, null
, ownerInstnace(selected) { return __acquireData(selected, selected.username, null
, selected.instanceName + '-data-' + selected.node_env
, function(e){ console.info('Customized user level config not found. This is not an Error. Will attempt global common instance config.'); , function(e){ console.info('Customized user level config not found. This is not an Error. Will attempt global common instance config.');
return e } return e }
) )


var __acquireData = function (selected, owner, clusternodename, datarepo, errHandler) { var __acquireData = function (selected, owner, clusternodename, datarepo, errHandler) {


datarepo = datarepo || selected.instanceName + '-data-' + selected.node_env;
datarepo = datarepo || selected.instanceName + '-data';


var errorHandler = (e) => { var errorHandler = (e) => {
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${owner}/${datarepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){ if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${owner}/${datarepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){

Loading…
Cancel
Save