demo 3 лет назад
Родитель
Сommit
45a52e48bf
1 измененных файлов: 32 добавлений и 42 удалений
  1. 32
    42
      index.js

+ 32
- 42
index.js Просмотреть файл

@@ -3,6 +3,7 @@ var utils = require('bbhverse');
var any = utils.any;
var Tasq = utils.Tasq
var statuslog = utils.Traq
var Traq = utils.Traq
Tasq.addlistener(statuslog.statuslog)


@@ -145,8 +146,8 @@ var gitInstallDir = "C:\\Program Files\\Git\\bin\\sh.exe"

var brandName = 'elixir';
// Runas windowshta clobbers and removes the NODE_ENV !!! We therefore pass it in.
var nodeenv = process.env.NODE_ENV || processedArgs.node_env || 'development'
if(nodeenv.trim() === 'production') nodeenv = 'production'
var nodeenv = process.env.NODE_ENV.trim() || processedArgs.node_env || 'development'
// var repomanifest = require('../'+brandName+'-config-'+ nodeenv +'/repo-manifest')()
var exludeMergeRepos = [];
var useGitPull = processedArgs.useGitPull || false;
@@ -202,18 +203,16 @@ var configrepo = brandName+'-config-'+nodeenv
var configpath = '../' + configrepo;
var configPromise = null

if(!existsSync(configpath)){
configPromise = performPull(configrepo)
}
if(!existsSync(configpath)){ configPromise = performPull(configrepo) }
else configPromise = Promise.resolve(true)

configPromise.then(()=>{

var manifestpath = '../'+brandName+'-config-'+nodeenv+'/repo-manifest';
// var manifestpath = '../'+brandName+'-config-'+'production'+'/repo-manifest';
console.dir(manifestpath)
// console.dir(manifestpath)
var repomanifest = require(manifestpath)()
console.dir(repomanifest)
// console.dir(repomanifest)

var gitRepos = repomanifest.repos

@@ -709,16 +708,7 @@ var __runcmd = function(label){
// elxr pull -- Defaults to run config
var env = Object.assign({}, process.env); // Shallow clone it.
// console.dir(env)
console.log('Running exlr pull : ' + path.dirname(__dirname))
// nodeShellExec('cmd', ['/c', 'setup\\utility\\chess.bat', 'pull'], {
// // nodeShellExec('cmd', ['/c', '..\\setup\\utility\\chess.bat', 'pull'], {
// stdio: ['pipe', process.stdout, process.stderr],
// inherit : true,
// shell: true,
// cwd : path.dirname(__dirname),
// env: env
// })

var useGitPull = processedArgs.useGitPull || false;
var getPullCmd = (repo)=>{
@@ -834,65 +824,65 @@ var __runcmd = function(label){
}
, 'npmi' : ()=>{
var tasks = [];
var bowerRepos = ['client']

var npmbuildrepos = ['loopback-jsonapi-model-serializer']
npmbuildrepos.forEach(repo => {
tasks.push(()=>{
var p = nodeShellExec('npm', ['i --force'], {
return nodeShellExec('npm', ['i --force'], {
inherit : true, shell: true
, cwd : repo
, env: process.env
, title : `npm i for ${repo}`
}).catch((e)=>{
console.error('Ignoring Benign Error'); console.error(e)
console.error('Ignoring Benign Error'); console.error(e);
}).then(()=>{
console.log(`--------------------npm run build for ${repo}--------------------`)
return nodeShellExec('npm', ['run build'], {
inherit : true, shell: true
, cwd : repo
, env: process.env
, title : `npm run build for ${repo}`
}).catch(Tasq.catch)
})


return p;
}).then(Tasq.then).catch(Tasq.catch)
})
})
})
any(tasks).then(()=>{

gitRepos = gitRepos.concat(elevatedRunasRepos);
gitRepos.push('client/server');
gitRepos = gitRepos.concat(elevatedRunasRepos);

var rmtasks = []
var repotasks = []
gitRepos.forEach(repo => {
console.log('npm i for ' + repo)
repotasks.push(
nodeShellExec('rm', ['package-lock.json'], {
rmtasks.push(()=>{
console.log(`--------------------rm package-lock.json for ${repo}--------------------`)
return nodeShellExec('rm', ['package-lock.json'], {
inherit : true, shell: true
, cwd : repo
, env: process.env
, title : `rm 'package-lock.json' for ${repo}`
}).catch((e)=>{console.error(e)})
.then(()=>{
if( npmbuildrepos.indexOf(repo) < 0) {
// tasks.push(()=>{
}).catch((e)=>{console.error(e)})
})
if( npmbuildrepos.indexOf(repo) < 0) {
repotasks.push(
()=>{
console.log(`--------------------npm i for ${repo}--------------------`)
var p = nodeShellExec('npm', ['i --force'], {
inherit : true, shell: true
, cwd : repo
, env: process.env
, title : `npm i for ${repo}`
}).catch(Tasq.catch)
}).then(Tasq.then).catch(Tasq.catch)
return p;
// })
}
})
)
})
}
})

var bowerRepos = ['client']
bowerRepos.forEach(repo => {
repotasks.push(()=>{
var p = nodeShellExec('bower', ['install'], {
@@ -900,12 +890,12 @@ var __runcmd = function(label){
, cwd : repo
, env: process.env
, title : `bower i for ${repo}`
}).catch(Tasq.catch)
}).then(Tasq.then).catch(Tasq.catch)
return p;
})
})

return any(repotasks);
return Promise.all(rmtasks).then(()=>any(repotasks));
}).catch(e=>{
}).finally(statuslog.finally)

Загрузка…
Отмена
Сохранить